diff --git a/3rdparty/mmu_man/themes/CompareMessages.cpp b/3rdparty/mmu_man/themes/CompareMessages.cpp index c81d534817..e24f09731d 100644 --- a/3rdparty/mmu_man/themes/CompareMessages.cpp +++ b/3rdparty/mmu_man/themes/CompareMessages.cpp @@ -4,6 +4,7 @@ #include #include +#include "Utils.h" /* returns true if == */ bool CompareMessages(BMessage &a, BMessage &b) @@ -16,7 +17,7 @@ bool CompareMessages(BMessage &a, BMessage &b) if (a.what != b.what) 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++) { if (a.FindData(name, code, i, &adata, &asize) != B_OK) return false; @@ -29,7 +30,7 @@ bool CompareMessages(BMessage &a, BMessage &b) } } /* 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; int32 acount; if (a.GetInfo(name, &acode, &acount) < B_OK) diff --git a/3rdparty/mmu_man/themes/DumpMessage.cpp b/3rdparty/mmu_man/themes/DumpMessage.cpp index 76a085aa63..1829810761 100644 --- a/3rdparty/mmu_man/themes/DumpMessage.cpp +++ b/3rdparty/mmu_man/themes/DumpMessage.cpp @@ -4,7 +4,9 @@ #include #include #include + #include "DumpMessage.h" +#include "Utils.h" //#define WHAT_ALWAYS_HEX 1 @@ -93,7 +95,7 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B stream.Write(buffer, strlen(buffer)); for (field = 0; message->GetInfo(B_ANY_TYPE, field, - &field_name, + GET_INFO_NAME_PTR(&field_name), &field_code, &field_count) == B_OK; field++) { 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); } 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: { 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)", c.red, c.green, c.blue, c.alpha); stream.Write(buffer, strlen(buffer)); @@ -140,54 +133,32 @@ status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, B stream.Write("\n", 1); } break; -#else case 'FONt': { BFont f; - const void *data; - ssize_t len; - if (message->FindData(field_name, index, &data, &len) >= B_OK) { - if (len <= (ssize_t)sizeof(f)) { - // Hack: only Dano has BFont : public BFlattenable - memcpy((void *)&f, data, len); - //stream << f; - font_family family; - font_style style; - font_height height; - f.GetFamilyAndStyle(&family, &style); - f.GetHeight(&height); - BString s; - s << "BFont(" << family; - s << "/" << style << "/" << f.Size(); - s << ", shear=" << f.Shear(); - s << ", rot=" << f.Rotation(); - s << ", height=" << height.ascent; - 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; + if (FindFont(*message, field_name, index, &f) >= B_OK) { +#ifdef B_BEOS_VERSION_DANO + stream << f; +#else + font_family family; + font_style style; + font_height height; + f.GetFamilyAndStyle(&family, &style); + f.GetHeight(&height); + BString s; + s << "BFont(" << family; + s << "/" << style << "/" << f.Size(); + s << ", shear=" << f.Shear(); + s << ", rot=" << f.Rotation(); + s << ", height=" << height.ascent; + s << "+" << height.descent; + s << "+" << height.leading << ")"; + stream.Write(s.String(), s.Length()); #endif + } + stream.Write("\n", 1); + } + break; case B_BOOL_TYPE: { bool value; diff --git a/3rdparty/mmu_man/themes/FileUtils.h b/3rdparty/mmu_man/themes/FileUtils.h deleted file mode 100644 index 8d734ad48e..0000000000 --- a/3rdparty/mmu_man/themes/FileUtils.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _FILE_UTILS_H -#define _FILE_UTILS_H - -#include -#include - -// 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 */ diff --git a/3rdparty/mmu_man/themes/Jamfile b/3rdparty/mmu_man/themes/Jamfile index 811cab9601..c91476e810 100644 --- a/3rdparty/mmu_man/themes/Jamfile +++ b/3rdparty/mmu_man/themes/Jamfile @@ -10,22 +10,22 @@ local addonSources ; addonSources = BackgroundsAddon.cpp BeIDEAddon.cpp + DanoUISettingsAddon.cpp DanoWindowDecorAddon.cpp DeskbarAddon.cpp EddieAddon.cpp + HaikuUISettingsAddon.cpp PeAddon.cpp ScreensaverAddon.cpp SoundplayColorAddon.cpp SoundsAddon.cpp TerminalAddon.cpp - UISettingsAddon.cpp WinampSkinAddon.cpp ; Application <3rdparty>Themes : CompareMessages.cpp DumpMessage.cpp - FileUtils.cpp MakeScreenshot.cpp ParseMessage.cpp TextInputAlert.cpp @@ -35,6 +35,7 @@ Application <3rdparty>Themes : ThemeItem.cpp ThemeManager.cpp ThemesAddon.cpp + Utils.cpp ViewItem.cpp $(addonSources) : be media translation $(TARGET_NETAPI_LIB) $(TARGET_LIBSTDC++) diff --git a/3rdparty/mmu_man/themes/ParseMessage.cpp b/3rdparty/mmu_man/themes/ParseMessage.cpp index 2ba518e8c2..531ace4d40 100644 --- a/3rdparty/mmu_man/themes/ParseMessage.cpp +++ b/3rdparty/mmu_man/themes/ParseMessage.cpp @@ -8,6 +8,7 @@ #include #include "DumpMessage.h" +#include "Utils.h" #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) v.alpha = 255; - //msg->AddRGBColor(name, v); - msg->AddData(name, B_RGB_COLOR_TYPE, &v, 4); + AddRGBColor(*msg, name, v); return B_OK; } @@ -257,11 +257,7 @@ status_t Parse_Msg_BFont(BMessage *msg, TextLineInputDataIO *st, char *name) f.SetFamilyAndStyle(ff, fs); f.SetSize(size); //f.PrintToStream(); -#ifdef B_BEOS_VERSION_DANO - msg->AddFlat(name, &f); -#else - msg->AddData(name, 'FONt', (void *)&f, sizeof(f)); -#endif + AddFont(*msg, name, &f); return B_OK; } diff --git a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp b/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp index 755a3d4418..b7703e3436 100644 --- a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp +++ b/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp @@ -197,7 +197,11 @@ ThemeInterfaceView::AllAttached() preview_frame.OffsetTo(10.0, 20.0); fScreenshotPane = new BView(preview_frame, "screenshot", B_FOLLOW_ALL, B_WILL_DRAW); fBox->AddChild(fScreenshotPane); +#ifdef B_BEOS_VERSION_DANO 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->SetFontSize(20.0); diff --git a/3rdparty/mmu_man/themes/UITheme.h b/3rdparty/mmu_man/themes/UITheme.h index 7d9a1042d4..6f64db05c0 100644 --- a/3rdparty/mmu_man/themes/UITheme.h +++ b/3rdparty/mmu_man/themes/UITheme.h @@ -40,4 +40,31 @@ #define Z_THEMES_FOLDER_NAME "UIThemes" #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 */ diff --git a/3rdparty/mmu_man/themes/FileUtils.cpp b/3rdparty/mmu_man/themes/Utils.cpp similarity index 83% rename from 3rdparty/mmu_man/themes/FileUtils.cpp rename to 3rdparty/mmu_man/themes/Utils.cpp index 98be7d7de1..74c3a563a9 100644 --- a/3rdparty/mmu_man/themes/FileUtils.cpp +++ b/3rdparty/mmu_man/themes/Utils.cpp @@ -1,4 +1,4 @@ -#include "FileUtils.h" +#include "Utils.h" #include #include #include @@ -272,3 +272,66 @@ int testhook() return 0; 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 +} + diff --git a/3rdparty/mmu_man/themes/Utils.h b/3rdparty/mmu_man/themes/Utils.h new file mode 100644 index 0000000000..35751a1a38 --- /dev/null +++ b/3rdparty/mmu_man/themes/Utils.h @@ -0,0 +1,32 @@ +#ifndef _FILE_UTILS_H +#define _FILE_UTILS_H + +#include +#include +#include +#include + +// 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 */ diff --git a/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp b/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp index a27c80d1d6..033bbecd8b 100644 --- a/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp @@ -21,6 +21,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #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) for (int i = 0; i < count_workspaces(); i++) { //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) break; // if no color at all, don't set them 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); for (i = 0; i <= last_change; 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); } @@ -242,7 +243,7 @@ status_t BackgroundThemesAddon::ApplyDefaultTheme(uint32 flags) BMessage backgrounds; rgb_color col = {51,102,152,255}; // Be Blues... ;) backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, true); - backgrounds.AddRGBColor(B__DESKTOP_COLOR, col); + AddRGBColor(backgrounds, B__DESKTOP_COLOR, col); theme.AddMessage(A_MSGNAME, &backgrounds); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp b/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp index e536fa0d8e..5d3ade39ab 100644 --- a/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp @@ -20,6 +20,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #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, sizeof(struct beide_editor_pref)) < B_OK) 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; - 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; 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("Window", "Environment Preferences"); 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", "colorsview"); msg.AddSpecifier("Window", "Environment Preferences"); msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.bg, 4); - err = msgr.SendMessage(msg); + err = msgr.SendMessage(&msg); msg.MakeEmpty(); msg.AddSpecifier("View", "Hilite"); @@ -153,12 +154,12 @@ status_t BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) msg.AddSpecifier("Window", "Environment Preferences"); msg.AddPoint("_drop_point_", BPoint(0,0)); msg.AddData("RGBColor", B_RGB_COLOR_TYPE, &bp.selbg, 4); - err = msgr.SendMessage(msg); + err = msgr.SendMessage(&msg); msg.MakeEmpty(); msg.what = 'SSav'; 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; rgb_color bg = {255, 255, 255, 255}; rgb_color selbg = {216, 216, 216, 255}; - uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); - uisettings.AddRGBColor(B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg); + AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg); + AddRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, selbg); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp b/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp similarity index 98% rename from 3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp rename to 3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp index f409e44b31..16222aaf11 100644 --- a/3rdparty/mmu_man/themes/addons/UISettingsAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp @@ -2,6 +2,9 @@ * ui_settings ThemesAddon class */ +#include +#ifdef B_BEOS_VERSION_DANO + #include #include #include @@ -200,3 +203,5 @@ ThemesAddon *instanciate_themes_addon() { return (ThemesAddon *) new UISettingsThemesAddon; } + +#endif /* B_BEOS_VERSION_DANO */ diff --git a/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp b/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp index 8c49f4d7bb..2996fabf98 100644 --- a/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/DanoWindowDecorAddon.cpp @@ -2,6 +2,9 @@ * window_decor ThemesAddon class */ +#include +#ifdef B_BEOS_VERSION_DANO + #include #include #include @@ -155,3 +158,5 @@ ThemesAddon *instanciate_themes_addon() { return (ThemesAddon *) new DecorThemesAddon; } + +#endif /* B_BEOS_VERSION_DANO */ diff --git a/3rdparty/mmu_man/themes/addons/EddieAddon.cpp b/3rdparty/mmu_man/themes/addons/EddieAddon.cpp index 64aea79798..0704189c9d 100644 --- a/3rdparty/mmu_man/themes/addons/EddieAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/EddieAddon.cpp @@ -20,6 +20,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_eddie @@ -87,18 +88,18 @@ status_t EddieThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) if (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); 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); 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); 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); text << "SelectionColor " << buffer << "\n"; } @@ -133,9 +134,9 @@ status_t EddieThemesAddon::ApplyDefaultTheme(uint32 flags) rgb_color bg = {255, 255, 255, 255}; rgb_color fg = {0, 0, 0, 255}; rgb_color selbg = {180, 200, 240, 255}; - uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); - uisettings.AddRGBColor(B_UI_DOCUMENT_TEXT_COLOR, fg); - uisettings.AddRGBColor("be:c:DocSBg", selbg); + AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg); + AddRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, fg); + AddRGBColor(uisettings, "be:c:DocSBg", selbg); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/PeAddon.cpp b/3rdparty/mmu_man/themes/addons/PeAddon.cpp index 440c5c00e1..b5432c3551 100644 --- a/3rdparty/mmu_man/themes/addons/PeAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/PeAddon.cpp @@ -20,6 +20,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_pe @@ -87,18 +88,18 @@ status_t PeThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) if (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); 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); 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); 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); text << "selection color=#" << buffer << "\n"; } @@ -133,9 +134,9 @@ status_t PeThemesAddon::ApplyDefaultTheme(uint32 flags) rgb_color bg = {255, 255, 255, 255}; rgb_color fg = {0, 0, 0, 255}; rgb_color selbg = {180, 200, 240, 255}; - uisettings.AddRGBColor(B_UI_DOCUMENT_BACKGROUND_COLOR, bg); - uisettings.AddRGBColor(B_UI_DOCUMENT_TEXT_COLOR, fg); - uisettings.AddRGBColor("be:c:DocSBg", selbg); + AddRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, bg); + AddRGBColor(uisettings, B_UI_DOCUMENT_TEXT_COLOR, fg); + AddRGBColor(uisettings, "be:c:DocSBg", selbg); theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp b/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp index 83c2a5312d..078ff17609 100644 --- a/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include diff --git a/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp b/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp index 12f4d8a3b0..32481e6dd1 100644 --- a/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp @@ -15,6 +15,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_soundplay @@ -80,7 +81,7 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) if (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); BMessenger msgr("application/x-vnd.marcone-soundplay"); @@ -93,7 +94,7 @@ status_t SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) wincnt = 1; } BMessage msg(B_PASTE); - msg.AddRGBColor("RGBColor", panelcol); + AddRGBColor(msg, "RGBColor", panelcol); msg.AddPoint("_drop_point_", BPoint(0,0)); // send to every window (the Playlist window needs it too) for (int32 i = 0; i < wincnt; i++) { @@ -116,7 +117,7 @@ status_t SoundplayThemesAddon::ApplyDefaultTheme(uint32 flags) BMessage theme; BMessage uisettings; 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); return ApplyTheme(theme, flags); } diff --git a/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp b/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp index f171a12755..c48854da7c 100644 --- a/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp @@ -17,6 +17,7 @@ #include "ThemesAddon.h" #include "UITheme.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_sounds @@ -105,8 +106,8 @@ status_t SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) BPath path; const char *p; float gain; - void *cookie = NULL; - const char *field_name; + int32 index; + char *field_name; type_code field_code; int32 field_count; BMessage msg; @@ -117,10 +118,10 @@ status_t SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) return err; bmfs.RewindRefs(BMediaFiles::B_SOUNDS); - while (sounds.GetNextName(&cookie, - &field_name, + for (index = 0; sounds.GetInfo(B_ANY_TYPE, index, + GET_INFO_NAME_PTR(&field_name), &field_code, - &field_count) == B_OK) { + &field_count) == B_OK; index++) { if (field_code != B_MESSAGE_TYPE) continue; if (sounds.FindMessage(field_name, &msg) < B_OK) diff --git a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp b/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp index c530f5dc27..614057ba30 100644 --- a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp +++ b/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp @@ -20,7 +20,7 @@ #include "ThemesAddon.h" #include "UITheme.h" -#include "FileUtils.h" +#include "Utils.h" #ifdef SINGLE_BINARY #define instanciate_themes_addon instanciate_themes_addon_terminal @@ -158,7 +158,7 @@ status_t TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) BFont tFont; tp.p.font_size = 12; 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_style 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.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); - 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); - 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); - 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); - 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); - 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); 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), sizeof(struct termprefs)); 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)); tFont.SetFamilyAndStyle(ff, fs); tFont.SetSize(tp.p.font_size); - termpref.AddFlat(TP_FONT, &tFont); - termpref.AddRGBColor(TP_BG, tp.p.bg); - termpref.AddRGBColor(TP_FG, tp.p.fg); - termpref.AddRGBColor(TP_CURBG, tp.p.curbg); - termpref.AddRGBColor(TP_CURFG, tp.p.curfg); - termpref.AddRGBColor(TP_SELBG, tp.p.selbg); - termpref.AddRGBColor(TP_SELFG, tp.p.selfg); + AddFont(termpref, TP_FONT, &tFont); + AddRGBColor(termpref, TP_BG, tp.p.bg); + AddRGBColor(termpref, TP_FG, tp.p.fg); + AddRGBColor(termpref, TP_CURBG, tp.p.curbg); + AddRGBColor(termpref, TP_CURFG, tp.p.curfg); + AddRGBColor(termpref, TP_SELBG, tp.p.selbg); + AddRGBColor(termpref, TP_SELFG, tp.p.selfg); termpref.AddInt32(TP_ENCODING, tp.p.encoding); err = SetMyMessage(theme, termpref); @@ -280,12 +280,12 @@ status_t TerminalThemesAddon::ApplyDefaultTheme(uint32 flags) { BMessage theme; BMessage termpref; - termpref.AddRGBColor("term:c:bg",make_color(255,255,255,0)); - termpref.AddRGBColor("term:c:fg",make_color(0,0,0,0)); - termpref.AddRGBColor("term:c:curbg",make_color(0,0,0,0)); - termpref.AddRGBColor("term:c:curfg",make_color(255,255,255,0)); - termpref.AddRGBColor("term:c:selbg",make_color(0,0,0,0)); - termpref.AddRGBColor("term:c:selfg",make_color(255,255,255,0)); + AddRGBColor(termpref, "term:c:bg",make_color(255,255,255,0)); + AddRGBColor(termpref, "term:c:fg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:curbg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:curfg",make_color(255,255,255,0)); + AddRGBColor(termpref, "term:c:selbg",make_color(0,0,0,0)); + AddRGBColor(termpref, "term:c:selfg",make_color(255,255,255,0)); theme.AddMessage(Z_THEME_TERMINAL_SETTINGS, &termpref); return ApplyTheme(theme, flags); }