It compiles for Haiku now, but doesn't link yet.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23429 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol
2008-01-12 01:05:37 +00:00
parent 9c67580a9f
commit abafff63f4
19 changed files with 235 additions and 139 deletions
+3 -2
View File
@@ -4,6 +4,7 @@
#include <string.h> #include <string.h>
#include <Message.h> #include <Message.h>
#include "Utils.h"
/* returns true if == */ /* returns true if == */
bool CompareMessages(BMessage &a, BMessage &b) bool CompareMessages(BMessage &a, BMessage &b)
@@ -16,7 +17,7 @@ bool CompareMessages(BMessage &a, BMessage &b)
if (a.what != b.what) if (a.what != b.what)
return false; return false;
for (index = 0; a.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { for (index = 0; a.GetInfo(B_ANY_TYPE, index, GET_INFO_NAME_PTR(&name), &code, &count) == B_OK; i++) {
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (a.FindData(name, code, i, &adata, &asize) != B_OK) if (a.FindData(name, code, i, &adata, &asize) != B_OK)
return false; return false;
@@ -29,7 +30,7 @@ bool CompareMessages(BMessage &a, BMessage &b)
} }
} }
/* cross compare */ /* cross compare */
for (index = 0; b.GetInfo(B_ANY_TYPE, index, &name, &code, &count) == B_OK; i++) { for (index = 0; b.GetInfo(B_ANY_TYPE, index, GET_INFO_NAME_PTR(&name), &code, &count) == B_OK; i++) {
type_code acode; type_code acode;
int32 acount; int32 acount;
if (a.GetInfo(name, &acode, &acount) < B_OK) if (a.GetInfo(name, &acode, &acount) < B_OK)
+26 -55
View File
@@ -4,7 +4,9 @@
#include <Font.h> #include <Font.h>
#include <Message.h> #include <Message.h>
#include <String.h> #include <String.h>
#include "DumpMessage.h" #include "DumpMessage.h"
#include "Utils.h"
//#define WHAT_ALWAYS_HEX 1 //#define WHAT_ALWAYS_HEX 1
@@ -93,7 +95,7 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
stream.Write(buffer, strlen(buffer)); stream.Write(buffer, strlen(buffer));
for (field = 0; message->GetInfo(B_ANY_TYPE, field, for (field = 0; message->GetInfo(B_ANY_TYPE, field,
&field_name, GET_INFO_NAME_PTR(&field_name),
&field_code, &field_code,
&field_count) == B_OK; field++) { &field_count) == B_OK; field++) {
if (LookUpFieldName(&easy_name, field_name, names)) { if (LookUpFieldName(&easy_name, field_name, names)) {
@@ -120,19 +122,10 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
DumpMessageToStream(&m, stream, tabCount, names); DumpMessageToStream(&m, stream, tabCount, names);
} }
break; break;
#ifdef B_BEOS_VERSION_DANO
case 'FONt':
{
BFont f;
if (message->FindFlat(field_name, index, &f) >= B_OK)
stream << f;
stream.Write("\n", 1);
}
break;
case B_RGB_COLOR_TYPE: case B_RGB_COLOR_TYPE:
{ {
rgb_color c; rgb_color c;
if (message->FindRGBColor(field_name, index, &c) >= B_OK) { if (FindRGBColor(*message, field_name, index, &c) >= B_OK) {
sprintf(buffer, "rgb_color(%d,%d,%d,%d)", sprintf(buffer, "rgb_color(%d,%d,%d,%d)",
c.red, c.green, c.blue, c.alpha); c.red, c.green, c.blue, c.alpha);
stream.Write(buffer, strlen(buffer)); stream.Write(buffer, strlen(buffer));
@@ -140,54 +133,32 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B
stream.Write("\n", 1); stream.Write("\n", 1);
} }
break; break;
#else
case 'FONt': case 'FONt':
{ {
BFont f; BFont f;
const void *data; if (FindFont(*message, field_name, index, &f) >= B_OK) {
ssize_t len; #ifdef B_BEOS_VERSION_DANO
if (message->FindData(field_name, index, &data, &len) >= B_OK) { stream << f;
if (len <= (ssize_t)sizeof(f)) { #else
// Hack: only Dano has BFont : public BFlattenable font_family family;
memcpy((void *)&f, data, len); font_style style;
//stream << f; font_height height;
font_family family; f.GetFamilyAndStyle(&family, &style);
font_style style; f.GetHeight(&height);
font_height height; BString s;
f.GetFamilyAndStyle(&family, &style); s << "BFont(" << family;
f.GetHeight(&height); s << "/" << style << "/" << f.Size();
BString s; s << ", shear=" << f.Shear();
s << "BFont(" << family; s << ", rot=" << f.Rotation();
s << "/" << style << "/" << f.Size(); s << ", height=" << height.ascent;
s << ", shear=" << f.Shear(); s << "+" << height.descent;
s << ", rot=" << f.Rotation(); s << "+" << height.leading << ")";
s << ", height=" << height.ascent; stream.Write(s.String(), s.Length());
s << "+" << height.descent;
s << "+" << height.leading << ")";
stream.Write(s.String(), s.Length());
} // else too big
}
stream.Write("\n", 1);
}
break;
case B_RGB_COLOR_TYPE:
{
rgb_color c;
const void *data;
ssize_t len;
if (message->FindData(field_name, index, &data, &len) >= B_OK) {
if (len <= (ssize_t)sizeof(c)) {
// Hack
memcpy((void *)&c, data, len);
sprintf(buffer, "rgb_color(%d,%d,%d,%d)",
c.red, c.green, c.blue, c.alpha);
stream.Write(buffer, strlen(buffer));
} // else too big
}
stream.Write("\n", 1);
}
break;
#endif #endif
}
stream.Write("\n", 1);
}
break;
case B_BOOL_TYPE: case B_BOOL_TYPE:
{ {
bool value; bool value;
-17
View File
@@ -1,17 +0,0 @@
#ifndef _FILE_UTILS_H
#define _FILE_UTILS_H
#include <Entry.h>
#include <Font.h>
// find the font file corresponding to family/style
extern status_t find_font_file(entry_ref *to, font_family family, font_style style, float size =-1);
// replace part of paths by symbolic strings "${B_FOO_DIRECTORY}"
extern status_t escape_find_directory(BString *dir);
extern status_t unescape_find_directory(BString *dir);
// copy a file including its attributes
extern status_t copy_file(entry_ref *ref, const char *to);
#endif /* _FILE_UTILS_H */
+3 -2
View File
@@ -10,22 +10,22 @@ local addonSources ;
addonSources = addonSources =
BackgroundsAddon.cpp BackgroundsAddon.cpp
BeIDEAddon.cpp BeIDEAddon.cpp
DanoUISettingsAddon.cpp
DanoWindowDecorAddon.cpp DanoWindowDecorAddon.cpp
DeskbarAddon.cpp DeskbarAddon.cpp
EddieAddon.cpp EddieAddon.cpp
HaikuUISettingsAddon.cpp
PeAddon.cpp PeAddon.cpp
ScreensaverAddon.cpp ScreensaverAddon.cpp
SoundplayColorAddon.cpp SoundplayColorAddon.cpp
SoundsAddon.cpp SoundsAddon.cpp
TerminalAddon.cpp TerminalAddon.cpp
UISettingsAddon.cpp
WinampSkinAddon.cpp WinampSkinAddon.cpp
; ;
Application <3rdparty>Themes : Application <3rdparty>Themes :
CompareMessages.cpp CompareMessages.cpp
DumpMessage.cpp DumpMessage.cpp
FileUtils.cpp
MakeScreenshot.cpp MakeScreenshot.cpp
ParseMessage.cpp ParseMessage.cpp
TextInputAlert.cpp TextInputAlert.cpp
@@ -35,6 +35,7 @@ Application <3rdparty>Themes :
ThemeItem.cpp ThemeItem.cpp
ThemeManager.cpp ThemeManager.cpp
ThemesAddon.cpp ThemesAddon.cpp
Utils.cpp
ViewItem.cpp ViewItem.cpp
$(addonSources) $(addonSources)
: be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++) : be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++)
+3 -7
View File
@@ -8,6 +8,7 @@
#include <TypeConstants.h> #include <TypeConstants.h>
#include "DumpMessage.h" #include "DumpMessage.h"
#include "Utils.h"
#define MAX_TEXT_LINE_INPUT_SIZE 4096 #define MAX_TEXT_LINE_INPUT_SIZE 4096
@@ -193,8 +194,7 @@ status_t Parse_Msg_rgb_color(BMessage *msg, TextLineInputDataIO *st, char *name)
} }
if (!has_alpha) if (!has_alpha)
v.alpha = 255; v.alpha = 255;
//msg->AddRGBColor(name, v); AddRGBColor(*msg, name, v);
msg->AddData(name, B_RGB_COLOR_TYPE, &v, 4);
return B_OK; return B_OK;
} }
@@ -257,11 +257,7 @@ status_t Parse_Msg_BFont(BMessage *msg, TextLineInputDataIO *st, char *name)
f.SetFamilyAndStyle(ff, fs); f.SetFamilyAndStyle(ff, fs);
f.SetSize(size); f.SetSize(size);
//f.PrintToStream(); //f.PrintToStream();
#ifdef B_BEOS_VERSION_DANO AddFont(*msg, name, &f);
msg->AddFlat(name, &f);
#else
msg->AddData(name, 'FONt', (void *)&f, sizeof(f));
#endif
return B_OK; return B_OK;
} }
+4
View File
@@ -197,7 +197,11 @@ ThemeInterfaceView::AllAttached()
preview_frame.OffsetTo(10.0, 20.0); preview_frame.OffsetTo(10.0, 20.0);
fScreenshotPane = new BView(preview_frame, "screenshot", B_FOLLOW_ALL, B_WILL_DRAW); fScreenshotPane = new BView(preview_frame, "screenshot", B_FOLLOW_ALL, B_WILL_DRAW);
fBox->AddChild(fScreenshotPane); fBox->AddChild(fScreenshotPane);
#ifdef B_BEOS_VERSION_DANO
fScreenshotPane->SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); fScreenshotPane->SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR);
#else
fScreenshotPane->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
#endif
fScreenshotNone = new BStringView(BRect(), "sshotnone", _T("No Theme selected"), (uint32) 0, B_FOLLOW_ALL); fScreenshotNone = new BStringView(BRect(), "sshotnone", _T("No Theme selected"), (uint32) 0, B_FOLLOW_ALL);
fScreenshotNone->SetFontSize(20.0); fScreenshotNone->SetFontSize(20.0);
+27
View File
@@ -40,4 +40,31 @@
#define Z_THEMES_FOLDER_NAME "UIThemes" #define Z_THEMES_FOLDER_NAME "UIThemes"
#define Z_THEME_FILE_NAME "Theme" #define Z_THEME_FILE_NAME "Theme"
/* some field names not always defined */
#ifndef B_BEOS_VERSION_DANO
#define B_UI_PANEL_BACKGROUND_COLOR "be:c:PanBg"
#define B_UI_PANEL_TEXT_COLOR "be:c:PanTx"
#define B_UI_PANEL_LINK_COLOR "be:c:PanLn"
#define B_UI_DOCUMENT_BACKGROUND_COLOR "be:c:DocBg"
#define B_UI_DOCUMENT_TEXT_COLOR "be:c:DocTx"
#define B_UI_DOCUMENT_LINK_COLOR "be:c:DocLn"
#define B_UI_CONTROL_BACKGROUND_COLOR "be:c:CtlBg"
#define B_UI_CONTROL_TEXT_COLOR "be:c:CtlTx"
#define B_UI_CONTROL_BORDER_COLOR "be:c:CtlBr"
#define B_UI_CONTROL_HIGHLIGHT_COLOR "be:c:CtlHg"
#define B_UI_NAVIGATION_BASE_COLOR "be:c:NavBs"
#define B_UI_NAVIGATION_PULSE_COLOR "be:c:NavPl"
#define B_UI_SHINE_COLOR "be:c:Shine"
#define B_UI_SHADOW_COLOR "be:c:Shadow"
#define B_UI_TOOLTIP_BACKGROUND_COLOR "be:c:TipBg"
#define B_UI_TOOLTIP_TEXT_COLOR "be:c:TipTx"
#define B_UI_MENU_BACKGROUND_COLOR "be:c:MenBg"
#define B_UI_MENU_SELECTED_BACKGROUND_COLOR "be:c:MenSBg"
#define B_UI_MENU_ITEM_TEXT_COLOR "be:c:MenTx"
#define B_UI_MENU_SELECTED_ITEM_TEXT_COLOR "be:c:MenSTx"
#define B_UI_MENU_SELECTED_BORDER_COLOR "be:c:MenSBr"
#define B_UI_SUCCESS_COLOR "be:c:Success"
#define B_UI_FAILURE_COLOR "be:c:Failure"
#endif
#endif /* _Z_UI_THEME_H */ #endif /* _Z_UI_THEME_H */
@@ -1,4 +1,4 @@
#include "FileUtils.h" #include "Utils.h"
#include <FindDirectory.h> #include <FindDirectory.h>
#include <Path.h> #include <Path.h>
#include <String.h> #include <String.h>
@@ -272,3 +272,66 @@ int testhook()
return 0; return 0;
return 1; return 1;
} }
status_t
FindRGBColor(BMessage &message, const char *name, int32 index, rgb_color *c)
{
#ifdef B_BEOS_VERSION_DANO
return message.FindRGBColor(name, index, c);
#else
const void *data;
ssize_t len;
status_t err;
err = message.FindData(name, index, &data, &len);
if (err < B_OK)
return err;
if (len > (ssize_t)sizeof(*c))
return E2BIG;
// Hack
memcpy((void *)c, data, len);
return B_OK;
#endif
}
status_t
AddRGBColor(BMessage &message, const char *name, rgb_color a_color, type_code type)
{
#ifdef B_BEOS_VERSION_DANO
return message.AddRGBColor(name, a_color, type);
#else
return message.AddData(name, type, &a_color, sizeof(a_color));
#endif
}
status_t
FindFont(BMessage &message, const char *name, int32 index, BFont *f)
{
#ifdef B_BEOS_VERSION_DANO
return message.FindFlat(name, index, f);
#else
const void *data;
ssize_t len;
status_t err = message.FindData(name, index, &data, &len);
if (err < B_OK)
return err;
if (len > (ssize_t)sizeof(*f))
return E2BIG;
// Hack: only Dano has BFont : public BFlattenable
memcpy((void *)f, data, len);
return B_OK;
#endif
}
status_t
AddFont(BMessage &message, const char *name, BFont *f, int32 count = 1)
{
#ifdef B_BEOS_VERSION_DANO
return message.AddFlat(name, f, count);
#else
return message.AddData(name, 'FONt', (void *)&f, sizeof(f), true, count);
#endif
}
+32
View File
@@ -0,0 +1,32 @@
#ifndef _FILE_UTILS_H
#define _FILE_UTILS_H
#include <Entry.h>
#include <Font.h>
#include <GraphicsDefs.h>
#include <Message.h>
// find the font file corresponding to family/style
extern status_t find_font_file(entry_ref *to, font_family family, font_style style, float size =-1);
// replace part of paths by symbolic strings "${B_FOO_DIRECTORY}"
extern status_t escape_find_directory(BString *dir);
extern status_t unescape_find_directory(BString *dir);
// copy a file including its attributes
extern status_t copy_file(entry_ref *ref, const char *to);
extern status_t FindRGBColor(BMessage &message, const char *name, int32 index, rgb_color *c);
extern status_t AddRGBColor(BMessage &message, const char *name, rgb_color a_color, type_code type = B_RGB_COLOR_TYPE);
extern status_t FindFont(BMessage &message, const char *name, int32 index, BFont *f);
extern status_t AddFont(BMessage &message, const char *name, BFont *f, int32 count = 1);
#ifdef B_BEOS_VERSION_DANO
#define GET_INFO_NAME_PTR(p) (const char **)(p)
#else
#define GET_INFO_NAME_PTR(p) (p)
#endif
#endif /* _FILE_UTILS_H */
+4 -3
View File
@@ -21,6 +21,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_backgrounds #define instanciate_themes_addon instanciate_themes_addon_backgrounds
@@ -136,7 +137,7 @@ status_t BackgroundThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
// should work as the rest of the fields (grouping) // should work as the rest of the fields (grouping)
for (int i = 0; i < count_workspaces(); i++) { for (int i = 0; i < count_workspaces(); i++) {
//ssize_t sz = 4; //ssize_t sz = 4;
if (backgrounds.FindRGBColor(B__DESKTOP_COLOR, i, &col) != B_OK && i == 0) if (FindRGBColor(backgrounds, B__DESKTOP_COLOR, i, &col) != B_OK && i == 0)
//if (backgrounds.FindData(B__DESKTOP_COLOR, (type_code)'RGBC', i, (const void **)&c, &sz) != B_OK && i == 0) //if (backgrounds.FindData(B__DESKTOP_COLOR, (type_code)'RGBC', i, (const void **)&c, &sz) != B_OK && i == 0)
break; // if no color at all, don't set them break; // if no color at all, don't set them
bs.SetDesktopColor(col, i, true); bs.SetDesktopColor(col, i, true);
@@ -224,7 +225,7 @@ status_t BackgroundThemesAddon::MakeTheme(BMessage &theme, uint32 flags)
//printf("ws col cnt %d\n", last_change); //printf("ws col cnt %d\n", last_change);
for (i = 0; i <= last_change; i++) { for (i = 0; i <= last_change; i++) {
col = bs.DesktopColor(i); col = bs.DesktopColor(i);
backgrounds.AddRGBColor(B__DESKTOP_COLOR, col); AddRGBColor(backgrounds, B__DESKTOP_COLOR, col);
//backgrounds->AddData(B__DESKTOP_COLOR, (type_code)'RGBC', &col, 4); //backgrounds->AddData(B__DESKTOP_COLOR, (type_code)'RGBC', &col, 4);
} }
@@ -242,7 +243,7 @@ status_t BackgroundThemesAddon::ApplyDefaultTheme(uint32 flags)
BMessage backgrounds; BMessage backgrounds;
rgb_color col = {51,102,152,255}; // Be Blues... ;) rgb_color col = {51,102,152,255}; // Be Blues... ;)
backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, true); backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, true);
backgrounds.AddRGBColor(B__DESKTOP_COLOR, col); AddRGBColor(backgrounds, B__DESKTOP_COLOR, col);
theme.AddMessage(A_MSGNAME, &backgrounds); theme.AddMessage(A_MSGNAME, &backgrounds);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }
+9 -8
View File
@@ -20,6 +20,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_beide #define instanciate_themes_addon instanciate_themes_addon_beide
@@ -112,9 +113,9 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
if (beideSettings.ReadAttr("AppEditorPrefs", 'rPWM', 0LL, &bp, if (beideSettings.ReadAttr("AppEditorPrefs", 'rPWM', 0LL, &bp,
sizeof(struct beide_editor_pref)) < B_OK) sizeof(struct beide_editor_pref)) < B_OK)
return B_ERROR; return B_ERROR;
if (uisettings.FindRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, &col) >= B_OK) if (FindRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, 0, &col) >= B_OK)
bp.bg = col; bp.bg = col;
if (uisettings.FindRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, &col) >= B_OK) if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK)
bp.selbg = col; bp.selbg = col;
if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) { if (true/* || flags & UI_THEME_SETTINGS_SAVE*/) {
@@ -138,14 +139,14 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
click.AddSpecifier("View", "listview"); click.AddSpecifier("View", "listview");
click.AddSpecifier("Window", "Environment Preferences"); click.AddSpecifier("Window", "Environment Preferences");
click.AddPoint("be:view_where", BPoint(58.0,103.0)); click.AddPoint("be:view_where", BPoint(58.0,103.0));
err = msgr.SendMessage(click); err = msgr.SendMessage(&click);
msg.AddSpecifier("View", "Background"); msg.AddSpecifier("View", "Background");
msg.AddSpecifier("View", "colorsview"); msg.AddSpecifier("View", "colorsview");
msg.AddSpecifier("Window", "Environment Preferences"); msg.AddSpecifier("Window", "Environment Preferences");
msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddPoint("_drop_point_", BPoint(0,0));
msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.bg, 4); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.bg, 4);
err = msgr.SendMessage(msg); err = msgr.SendMessage(&msg);
msg.MakeEmpty(); msg.MakeEmpty();
msg.AddSpecifier("View", "Hilite"); msg.AddSpecifier("View", "Hilite");
@@ -153,12 +154,12 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
msg.AddSpecifier("Window", "Environment Preferences"); msg.AddSpecifier("Window", "Environment Preferences");
msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddPoint("_drop_point_", BPoint(0,0));
msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.selbg, 4); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.selbg, 4);
err = msgr.SendMessage(msg); err = msgr.SendMessage(&msg);
msg.MakeEmpty(); msg.MakeEmpty();
msg.what = 'SSav'; msg.what = 'SSav';
msg.AddSpecifier("Window", "Environment Preferences"); msg.AddSpecifier("Window", "Environment Preferences");
err = msgr.SendMessage(msg); err = msgr.SendMessage(&msg);
} }
} }
} }
@@ -178,8 +179,8 @@ status_t BeIDEThemesAddon::ApplyDefaultTheme(uint32 flags)
BMessage uisettings; BMessage uisettings;
rgb_color bg = {255, 255, 255, 255}; rgb_color bg = {255, 255, 255, 255};
rgb_color selbg = {216, 216, 216, 255}; rgb_color selbg = {216, 216, 216, 255};
uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg);
uisettings.AddRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg); AddRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg);
theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }
@@ -2,6 +2,9 @@
* ui_settings ThemesAddon class * ui_settings ThemesAddon class
*/ */
#include <BeBuild.h>
#ifdef B_BEOS_VERSION_DANO
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <InterfaceDefs.h> #include <InterfaceDefs.h>
@@ -200,3 +203,5 @@ ThemesAddon *instanciate_themes_addon()
{ {
return (ThemesAddon *) new UISettingsThemesAddon; return (ThemesAddon *) new UISettingsThemesAddon;
} }
#endif /* B_BEOS_VERSION_DANO */
@@ -2,6 +2,9 @@
* window_decor ThemesAddon class * window_decor ThemesAddon class
*/ */
#include <BeBuild.h>
#ifdef B_BEOS_VERSION_DANO
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Directory.h> #include <Directory.h>
@@ -155,3 +158,5 @@ ThemesAddon *instanciate_themes_addon()
{ {
return (ThemesAddon *) new DecorThemesAddon; return (ThemesAddon *) new DecorThemesAddon;
} }
#endif /* B_BEOS_VERSION_DANO */
+8 -7
View File
@@ -20,6 +20,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_eddie #define instanciate_themes_addon instanciate_themes_addon_eddie
@@ -87,18 +88,18 @@ status_t EddieThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
if (err) if (err)
return err; return err;
if (uisettings.FindRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, &col) >= B_OK) { if (FindRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "BackgroundColor " << buffer << "\n"; text << "BackgroundColor " << buffer << "\n";
} }
if (uisettings.FindRGBColor(B_UI_DOCUMENT_TEXT_COLOR, &col) >= B_OK) { if (FindRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "TextColor " << buffer << "\n"; text << "TextColor " << buffer << "\n";
} }
if (uisettings.FindRGBColor("be:c:DocSBg", &col) >= B_OK) { if (FindRGBColor(uisettings, "be:c:DocSBg", 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "SelectionColor " << buffer << "\n"; text << "SelectionColor " << buffer << "\n";
} else if (uisettings.FindRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, &col) >= B_OK) { } else if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "SelectionColor " << buffer << "\n"; text << "SelectionColor " << buffer << "\n";
} }
@@ -133,9 +134,9 @@ status_t EddieThemesAddon::ApplyDefaultTheme(uint32 flags)
rgb_color bg = {255, 255, 255, 255}; rgb_color bg = {255, 255, 255, 255};
rgb_color fg = {0, 0, 0, 255}; rgb_color fg = {0, 0, 0, 255};
rgb_color selbg = {180, 200, 240, 255}; rgb_color selbg = {180, 200, 240, 255};
uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg);
uisettings.AddRGBColor(B_UI_DOCUMENT_TEXT_COLOR, fg); AddRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, fg);
uisettings.AddRGBColor("be:c:DocSBg", selbg); AddRGBColor(uisettings, "be:c:DocSBg", selbg);
theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }
+8 -7
View File
@@ -20,6 +20,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_pe #define instanciate_themes_addon instanciate_themes_addon_pe
@@ -87,18 +88,18 @@ status_t PeThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
if (err) if (err)
return err; return err;
if (uisettings.FindRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, &col) >= B_OK) { if (FindRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "low color=#" << buffer << "\n"; text << "low color=#" << buffer << "\n";
} }
if (uisettings.FindRGBColor(B_UI_DOCUMENT_TEXT_COLOR, &col) >= B_OK) { if (FindRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "text color=#" << buffer << "\n"; text << "text color=#" << buffer << "\n";
} }
if (uisettings.FindRGBColor("be:c:DocSBg", &col) >= B_OK) { if (FindRGBColor(uisettings, "be:c:DocSBg", 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "selection color=#" << buffer << "\n"; text << "selection color=#" << buffer << "\n";
} else if (uisettings.FindRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, &col) >= B_OK) { } else if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK) {
sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue); sprintf(buffer, "%02x%02x%02x", col.red, col.green, col.blue);
text << "selection color=#" << buffer << "\n"; text << "selection color=#" << buffer << "\n";
} }
@@ -133,9 +134,9 @@ status_t PeThemesAddon::ApplyDefaultTheme(uint32 flags)
rgb_color bg = {255, 255, 255, 255}; rgb_color bg = {255, 255, 255, 255};
rgb_color fg = {0, 0, 0, 255}; rgb_color fg = {0, 0, 0, 255};
rgb_color selbg = {180, 200, 240, 255}; rgb_color selbg = {180, 200, 240, 255};
uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg);
uisettings.AddRGBColor(B_UI_DOCUMENT_TEXT_COLOR, fg); AddRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, fg);
uisettings.AddRGBColor("be:c:DocSBg", selbg); AddRGBColor(uisettings, "be:c:DocSBg", selbg);
theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }
+2
View File
@@ -10,6 +10,8 @@
#include <Messenger.h> #include <Messenger.h>
#include <Path.h> #include <Path.h>
#include <Roster.h> #include <Roster.h>
#include <String.h>
#include <File.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
+4 -3
View File
@@ -15,6 +15,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_soundplay #define instanciate_themes_addon instanciate_themes_addon_soundplay
@@ -80,7 +81,7 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
if (err) if (err)
return err; return err;
if (uisettings.FindRGBColor(B_UI_PANEL_BACKGROUND_COLOR, &panelcol) < B_OK) if (FindRGBColor(uisettings, B_UI_PANEL_BACKGROUND_COLOR, 0, &panelcol) < B_OK)
panelcol = make_color(216,216,216,255); panelcol = make_color(216,216,216,255);
BMessenger msgr("application/x-vnd.marcone-soundplay"); BMessenger msgr("application/x-vnd.marcone-soundplay");
@@ -93,7 +94,7 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
wincnt = 1; wincnt = 1;
} }
BMessage msg(B_PASTE); BMessage msg(B_PASTE);
msg.AddRGBColor("RGBColor", panelcol); AddRGBColor(msg, "RGBColor", panelcol);
msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddPoint("_drop_point_", BPoint(0,0));
// send to every window (the Playlist window needs it too) // send to every window (the Playlist window needs it too)
for (int32 i = 0; i < wincnt; i++) { for (int32 i = 0; i < wincnt; i++) {
@@ -116,7 +117,7 @@ status_t SoundplayThemesAddon::ApplyDefaultTheme(uint32 flags)
BMessage theme; BMessage theme;
BMessage uisettings; BMessage uisettings;
rgb_color bg = {216, 216, 216, 255}; rgb_color bg = {216, 216, 216, 255};
uisettings.AddRGBColor(B_UI_PANEL_BACKGROUND_COLOR, bg); AddRGBColor(uisettings, B_UI_PANEL_BACKGROUND_COLOR, bg);
theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }
+6 -5
View File
@@ -17,6 +17,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_sounds #define instanciate_themes_addon instanciate_themes_addon_sounds
@@ -105,8 +106,8 @@ status_t SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
BPath path; BPath path;
const char *p; const char *p;
float gain; float gain;
void *cookie = NULL; int32 index;
const char *field_name; char *field_name;
type_code field_code; type_code field_code;
int32 field_count; int32 field_count;
BMessage msg; BMessage msg;
@@ -117,10 +118,10 @@ status_t SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
return err; return err;
bmfs.RewindRefs(BMediaFiles::B_SOUNDS); bmfs.RewindRefs(BMediaFiles::B_SOUNDS);
while (sounds.GetNextName(&cookie, for (index = 0; sounds.GetInfo(B_ANY_TYPE, index,
&field_name, GET_INFO_NAME_PTR(&field_name),
&field_code, &field_code,
&field_count) == B_OK) { &field_count) == B_OK; index++) {
if (field_code != B_MESSAGE_TYPE) if (field_code != B_MESSAGE_TYPE)
continue; continue;
if (sounds.FindMessage(field_name, &msg) < B_OK) if (sounds.FindMessage(field_name, &msg) < B_OK)
+22 -22
View File
@@ -20,7 +20,7 @@
#include "ThemesAddon.h" #include "ThemesAddon.h"
#include "UITheme.h" #include "UITheme.h"
#include "FileUtils.h" #include "Utils.h"
#ifdef SINGLE_BINARY #ifdef SINGLE_BINARY
#define instanciate_themes_addon instanciate_themes_addon_terminal #define instanciate_themes_addon instanciate_themes_addon_terminal
@@ -158,7 +158,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
BFont tFont; BFont tFont;
tp.p.font_size = 12; tp.p.font_size = 12;
strcpy(tp.p.font, "Courier10 BT/Roman"); strcpy(tp.p.font, "Courier10 BT/Roman");
if (termpref.FindFlat(TP_FONT, &tFont) == B_OK) { if (FindFont(termpref, TP_FONT, 0, &tFont) == B_OK) {
font_family ff; font_family ff;
font_style fs; font_style fs;
tFont.GetFamilyAndStyle(&ff, &fs); tFont.GetFamilyAndStyle(&ff, &fs);
@@ -170,17 +170,17 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
tp.p.cursor_blink_rate = 1000000; tp.p.cursor_blink_rate = 1000000;
tp.p.refresh_rate = 0; tp.p.refresh_rate = 0;
if (termpref.FindRGBColor(TP_BG, &tp.p.bg) != B_OK) if (FindRGBColor(termpref, TP_BG, 0, &tp.p.bg) != B_OK)
tp.p.bg = make_color(255,255,255,255); tp.p.bg = make_color(255,255,255,255);
if (termpref.FindRGBColor(TP_FG, &tp.p.fg) != B_OK) if (FindRGBColor(termpref, TP_FG, 0, &tp.p.fg) != B_OK)
tp.p.fg = make_color(0,0,0,255); tp.p.fg = make_color(0,0,0,255);
if (termpref.FindRGBColor(TP_CURBG, &tp.p.curbg) != B_OK) if (FindRGBColor(termpref, TP_CURBG, 0, &tp.p.curbg) != B_OK)
tp.p.curbg = make_color(255,255,255,255); tp.p.curbg = make_color(255,255,255,255);
if (termpref.FindRGBColor(TP_CURFG, &tp.p.curfg) != B_OK) if (FindRGBColor(termpref, TP_CURFG, 0, &tp.p.curfg) != B_OK)
tp.p.curfg = make_color(0,0,0,255); tp.p.curfg = make_color(0,0,0,255);
if (termpref.FindRGBColor(TP_SELBG, &tp.p.selbg) != B_OK) if (FindRGBColor(termpref, TP_SELBG, 0, &tp.p.selbg) != B_OK)
tp.p.selbg = make_color(0,0,0,255); tp.p.selbg = make_color(0,0,0,255);
if (termpref.FindRGBColor(TP_SELFG, &tp.p.selfg) != B_OK) if (FindRGBColor(termpref, TP_SELFG, 0, &tp.p.selfg) != B_OK)
tp.p.selfg = make_color(255,255,255,255); tp.p.selfg = make_color(255,255,255,255);
if (termpref.FindInt32(TP_ENCODING, (int32 *)&tp.p.encoding) != B_OK) if (termpref.FindInt32(TP_ENCODING, (int32 *)&tp.p.encoding) != B_OK)
@@ -218,7 +218,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags)
//msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref)); //msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref));
msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs)); msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs));
msg.AddSpecifier("Window", 0L); msg.AddSpecifier("Window", 0L);
err = msgr.SendMessage(msg); err = msgr.SendMessage(&msg);
} }
} }
} }
@@ -263,13 +263,13 @@ status_t TerminalThemesAddon::MakeTheme(BMessage &theme, uint32 flags)
strncpy(fs, str.String(), sizeof(fs)); strncpy(fs, str.String(), sizeof(fs));
tFont.SetFamilyAndStyle(ff, fs); tFont.SetFamilyAndStyle(ff, fs);
tFont.SetSize(tp.p.font_size); tFont.SetSize(tp.p.font_size);
termpref.AddFlat(TP_FONT, &tFont); AddFont(termpref, TP_FONT, &tFont);
termpref.AddRGBColor(TP_BG, tp.p.bg); AddRGBColor(termpref, TP_BG, tp.p.bg);
termpref.AddRGBColor(TP_FG, tp.p.fg); AddRGBColor(termpref, TP_FG, tp.p.fg);
termpref.AddRGBColor(TP_CURBG, tp.p.curbg); AddRGBColor(termpref, TP_CURBG, tp.p.curbg);
termpref.AddRGBColor(TP_CURFG, tp.p.curfg); AddRGBColor(termpref, TP_CURFG, tp.p.curfg);
termpref.AddRGBColor(TP_SELBG, tp.p.selbg); AddRGBColor(termpref, TP_SELBG, tp.p.selbg);
termpref.AddRGBColor(TP_SELFG, tp.p.selfg); AddRGBColor(termpref, TP_SELFG, tp.p.selfg);
termpref.AddInt32(TP_ENCODING, tp.p.encoding); termpref.AddInt32(TP_ENCODING, tp.p.encoding);
err = SetMyMessage(theme, termpref); err = SetMyMessage(theme, termpref);
@@ -280,12 +280,12 @@ status_t TerminalThemesAddon::ApplyDefaultTheme(uint32 flags)
{ {
BMessage theme; BMessage theme;
BMessage termpref; BMessage termpref;
termpref.AddRGBColor("term:c:bg",make_color(255,255,255,0)); AddRGBColor(termpref, "term:c:bg",make_color(255,255,255,0));
termpref.AddRGBColor("term:c:fg",make_color(0,0,0,0)); AddRGBColor(termpref, "term:c:fg",make_color(0,0,0,0));
termpref.AddRGBColor("term:c:curbg",make_color(0,0,0,0)); AddRGBColor(termpref, "term:c:curbg",make_color(0,0,0,0));
termpref.AddRGBColor("term:c:curfg",make_color(255,255,255,0)); AddRGBColor(termpref, "term:c:curfg",make_color(255,255,255,0));
termpref.AddRGBColor("term:c:selbg",make_color(0,0,0,0)); AddRGBColor(termpref, "term:c:selbg",make_color(0,0,0,0));
termpref.AddRGBColor("term:c:selfg",make_color(255,255,255,0)); AddRGBColor(termpref, "term:c:selfg",make_color(255,255,255,0));
theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref); theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref);
return ApplyTheme(theme, flags); return ApplyTheme(theme, flags);
} }