diff --git a/3rdparty/mmu_man/themes/BeThemeImporter.cpp b/3rdparty/mmu_man/themes/BeThemeImporter.cpp deleted file mode 100644 index f9d91094cb..0000000000 --- a/3rdparty/mmu_man/themes/BeThemeImporter.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * BeThemeImporter class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "UITheme.h" -#include "Utils.h" -#include "BeThemeImporter.h" - - -#define DEBUG_TI -#ifdef DEBUG_TI -#define FENTRY PRINT(("ThemeImporter[%s]::%s()\n", Name(), __FUNCTION__)) -#else -#define FENTRY -#endif - -#define QSTR "(name==\"TrackerTheme\")" - -static const deskbar_location kDeskbarLocationMap[] = { - //2:top 1:topright 5:bottom - B_DESKBAR_LEFT_TOP, B_DESKBAR_RIGHT_TOP, B_DESKBAR_TOP, - B_DESKBAR_LEFT_BOTTOM, B_DESKBAR_RIGHT_BOTTOM, B_DESKBAR_BOTTOM -}; - - -// #pragma mark - - - -BeThemeImporter::BeThemeImporter() - :ThemeImporter("BeTheme") -{ - FENTRY; - BVolumeRoster r; - BVolume v; - // TODO: query all volumes ? - r.GetBootVolume(&v); - fQuery.Clear(); - fQuery.SetVolume(&v); - fQuery.SetPredicate(QSTR); -} - - -BeThemeImporter::~BeThemeImporter() -{ - FENTRY; - fQuery.Clear(); -} - - -const char * -BeThemeImporter::Description() -{ - FENTRY; - return "Imports BeTheme themes"; -} - - -status_t -BeThemeImporter::FetchThemes() -{ - FENTRY; - return fQuery.Fetch(); -} - - -status_t -BeThemeImporter::ImportNextTheme(BMessage **theme) -{ - FENTRY; - status_t err; - BEntry ent; - int i, j; - - err = fQuery.GetNextEntry(&ent); - if (err < B_OK) - return err; - BDirectory dir; - BDirectory settingsDir; - BPath path; - err = ent.GetParent(&dir); - ent.GetParent(&ent); - ent.GetPath(&path); - if (err < 0) - return err; - err = settingsDir.SetTo(&dir, "Settings"); - if (err < 0) - return B_ERROR; - PRINT(("BeThemeImporter: importing from '%s'\n", path.Path())); - - BMessage global(Z_THEME_MESSAGE_WHAT); - BMessage info; - BMessage decor; - BMessage backgrounds; - BMessage deskbar; - info.AddString(Z_THEME_NAME, path.Leaf()); - global.AddString(Z_THEME_LOCATION, path.Path()); - - BFile file; - int32 value; - int64 llvalue; - int32 first; - - err = file.SetTo(&settingsDir, "Description", B_READ_ONLY); - if (err < B_OK) - return B_ERROR; - BString str; - char *buff; - buff = str.LockBuffer(1024); - memset(buff, 0, 1024); - file.Read(buff, 1024-1); - if (err < B_OK) - return err; - str.UnlockBuffer(); - info.AddString(Z_THEME_DESCRIPTION, str.String()); - info.AddString(Z_THEME_SCREENSHOT_FILENAME, "Settings/Preview.jpg"); - - - err = file.SetTo(&settingsDir, "Deskbar", B_READ_ONLY); - if (err < B_OK) - return B_ERROR; - str = ""; - buff = str.LockBuffer(1024); - memset(buff, 0, 1024); - file.Read(buff, 1024-1); - if (err < B_OK) - return err; - str.UnlockBuffer(); - str.ReplaceSet("\r\n", " "); - for (i = 0; str.Length() > 0; i++) { - BString token; - first = str.FindFirst(' '); - first = first < 0 ? str.Length() : first + 1; - str.MoveInto(token, 0, first); - if (token.Length() < 2) - continue; - if (sscanf(token.String(), "POS:%ld", &value) >= 1) { - value = (value < 6) ? kDeskbarLocationMap[value] : B_DESKBAR_RIGHT_TOP; - deskbar.AddInt32("db:location", value); - } - if (sscanf(token.String(), "EXP:%ld", &value) >= 1) { - deskbar.AddBool("db:expanded", value != 0); - } - if (sscanf(token.String(), "DECOR:%ld", &value) >= 1) { - value = (value < 4) ? value : 0; - decor.AddInt32("window:R5:decor", value); - switch (value) { - case R5_DECOR_BEOS: - default: - decor.AddString("window:decor", "R5"); - // fallbacks - decor.AddString("window:decor", "Default"); - decor.AddString("window:decor", "ClassicBe"); - decor.AddString("window:decor", "BeDecorator"); - break; - case R5_DECOR_WIN95: - decor.AddString("window:decor", "Win95"); - // fallbacks - decor.AddString("window:decor", "Win2k"); - decor.AddString("window:decor", "Win"); - decor.AddString("window:decor", "Redmond"); - decor.AddString("window:decor", "Seattle"); - decor.AddString("window:decor", "WinDecorator"); - break; - - case R5_DECOR_AMIGA: - decor.AddString("window:decor", "Amiga"); - // fallbacks - decor.AddString("window:decor", "AmigaOS"); - decor.AddString("window:decor", "AmigaOS4"); - break; - case R5_DECOR_MAC: - decor.AddString("window:decor", "Mac"); - // fallbacks - decor.AddString("window:decor", "MacOS"); - decor.AddString("window:decor", "Baqua"); - decor.AddString("window:decor", "Cupertino"); - decor.AddString("window:decor", "MacDecorator"); - break; - } - } - } - - err = file.SetTo(&settingsDir, "WorkSpaces", B_READ_ONLY); - if (err < B_OK) - return B_ERROR; - buff = str.LockBuffer(1024); - memset(buff, 0, 1024); - file.Read(buff, 1024-1); - if (err < B_OK) - return err; - str.UnlockBuffer(); - BString line; - for (i = 0; str.Length() > 0; i++) { - first = str.FindFirst('\n'); - first = first < 0 ? str.Length() : first + 1; - str.MoveInto(line, 0, first); - if (line.Length() < 2) - break; - - rgb_color color; - bool erasetext = false; - int32 mode = B_BACKGROUND_MODE_SCALED; - //int32 set = 0; // ? - BPoint offset; - uint32 workspaces = 0; - - for (j = 0; line.Length() > 0; j++) { - BString token; - first = line.FindFirst(' '); - first = first < 0 ? line.Length() : first + 1; - line.MoveInto(token, 0, first); - if (token.Length() < 2) - break; - - if (sscanf(token.String(), "R:%ld", &value) >= 1) { - color.red = (int8) value; - } - if (sscanf(token.String(), "G:%ld", &value) >= 1) { - color.green = (int8) value; - } - if (sscanf(token.String(), "B:%ld", &value) >= 1) { - color.blue = (int8) value; - } - color.alpha = 255; - if (sscanf(token.String(), "BGM:%ld", &value) >= 1) { - mode = value; - } - if (sscanf(token.String(), "ERASETEXT:%ld", &value) >= 1) { - erasetext = value != 0; - } - if (sscanf(token.String(), "x:%ld", &value) >= 1) { - offset.x = value; - } - if (sscanf(token.String(), "y:%ld", &value) >= 1) { - offset.y = value; - } - - if (sscanf(token.String(), "WORKSPACE:%Lx", &llvalue) >= 1) { - workspaces = (uint32)llvalue; - } - - } - - BString image(path.Path()); - image << "/Settings/"; - image << "Background" << i << ".jpg"; - - backgrounds.AddString(B_BACKGROUND_IMAGE, image.String()); - backgrounds.AddInt32(B_BACKGROUND_MODE, mode); - backgrounds.AddPoint(B_BACKGROUND_ORIGIN, offset); - backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, erasetext); - backgrounds.AddInt32(B_BACKGROUND_WORKSPACES, workspaces); - AddRGBColor(backgrounds, "be:desktop_color", color); - } - - - global.AddMessage(Z_THEME_INFO_MESSAGE, &info); - global.AddMessage(Z_THEME_WINDOW_DECORATIONS, &decor); - global.AddMessage(Z_THEME_BACKGROUND_SETTINGS, &backgrounds); - global.AddMessage(Z_THEME_DESKBAR_SETTINGS, &deskbar); - *theme = new BMessage(global); - //global.PrintToStream(); - - return B_OK; -} - - -status_t -BeThemeImporter::EndImports() -{ - FENTRY; - fQuery.Clear(); - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/BeThemeImporter.h b/3rdparty/mmu_man/themes/BeThemeImporter.h deleted file mode 100644 index 4abd9e0d01..0000000000 --- a/3rdparty/mmu_man/themes/BeThemeImporter.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _BE_THEME_IMPORTER_H -#define _BE_THEME_IMPORTER_H -/* - * BeTheme Importer class header - */ - -#include - -#include "ThemeImporter.h" - -namespace Z { -namespace ThemeManager { - -class BeThemeImporter : public ThemeImporter { -public: - BeThemeImporter(); -virtual ~BeThemeImporter(); - - /* presentation */ - -virtual const char *Description(); /* tooltip... */ - - /* Theme manipulation */ - -virtual status_t FetchThemes(); -virtual status_t ImportNextTheme(BMessage **theme); -virtual status_t EndImports(); - - /* */ - -private: - -friend class Z::ThemeManager::ThemeManager; - BQuery fQuery; -}; - -} // ns ThemeManager -} // ns Z - -using namespace Z::ThemeManager; - -#endif /* _BE_THEME_IMPORTER_H */ diff --git a/3rdparty/mmu_man/themes/CompareMessages.cpp b/3rdparty/mmu_man/themes/CompareMessages.cpp deleted file mode 100644 index d7a4a34890..0000000000 --- a/3rdparty/mmu_man/themes/CompareMessages.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * function to compare 2 BMessages - */ -#include - -#include -#include "Utils.h" - -/* returns true if == */ -bool CompareMessages(BMessage &a, BMessage &b) -{ - char *name; - type_code code; - int32 count, index, i; - const void *adata, *bdata; - ssize_t asize, bsize; - - if (a.what != b.what) - return false; - 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; - if (b.FindData(name, code, i, &bdata, &bsize) != B_OK) - return false; - if (asize != bsize) - return false; - if (memcmp(adata, bdata, asize)) - return false; - } - } - /* cross compare */ - 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) - return false; - if (code != acode) - return false; - if (count != acount) - return false; - } - return true; -} - diff --git a/3rdparty/mmu_man/themes/DumpMessage.cpp b/3rdparty/mmu_man/themes/DumpMessage.cpp deleted file mode 100644 index 6b2842e073..0000000000 --- a/3rdparty/mmu_man/themes/DumpMessage.cpp +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include -#include -#include -#include -#include -#include - -#include "DumpMessage.h" -#include "Utils.h" - -//#define WHAT_ALWAYS_HEX 1 - -const char *msg_header_comment = "// new BMessage\n"; // avoids mime to think it's a .bmp ("BM") - -status_t HexDumpToStream(const void *data, size_t len, BDataIO &stream, const char *prefix = NULL) -{ - const unsigned char *p = (unsigned char *)data; - char buffer[100]; - size_t i, j; - for (i=0; i= len) - sprintf(buffer, " "); - //else if (p[i+j] < 255 && p[i+j] >= 0x20) - else if (isalpha(p[i+j])) - sprintf(buffer, "%c", p[i+j]); - else - sprintf(buffer, "."); - stream.Write(buffer, 1); - } - sprintf(buffer, "'\n"); - stream.Write(buffer, strlen(buffer)); - } - return B_OK; -} - -/* look up human readable names from an other BMessage */ -bool LookUpFieldName(const char **name, const char *field_name, BMessage *names) -{ - if (names == NULL) - return false; - if (names->FindString(field_name, name) == B_OK) - return true; - return false; -} - -status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount, BMessage *names) -{ - int32 field, index; - char *field_name; - type_code field_code; - int32 field_count; - char buffer[80]; - char tabs[20]; - const char *easy_name; - - if (message == NULL) - return EINVAL; - - if (tabCount < 1) - stream.Write(msg_header_comment, strlen(msg_header_comment)); - - memset(tabs, '\t', (++tabCount) + 1); - tabs[tabCount+1] = '\0'; - //tabCount; - -#ifndef WHAT_ALWAYS_HEX - if ( isalnum(message->what & 0x0ff) && - isalnum((message->what >> 8) & 0x0ff) && - isalnum((message->what >> 16) & 0x0ff) && - isalnum((message->what >> 24) & 0x0ff)) - sprintf(buffer, "BMessage('%c%c%c%c') {\n", - (char)(message->what >> 24) & 0x0ff, - (char)(message->what >> 16) & 0x0ff, - (char)(message->what >> 8) & 0x0ff, - (char)message->what & 0x0ff); - else -#endif - sprintf(buffer, "BMessage(0x%08lx) {\n", message->what); -// stream.Write(tabs+2, tabCount-2); - stream.Write(buffer, strlen(buffer)); - - for (field = 0; message->GetInfo(B_ANY_TYPE, field, - GET_INFO_NAME_PTR(&field_name), - &field_code, - &field_count) == B_OK; field++) { - if (LookUpFieldName(&easy_name, field_name, names)) { - stream.Write(tabs+1, tabCount); - stream.Write("// ", 3); - stream.Write(easy_name, strlen(easy_name)); - stream.Write("\n", 1); - } - - for (index=0; index < field_count; index++) { - stream.Write(tabs+1, tabCount); - stream.Write(field_name, strlen(field_name)); - if (field_count > 1) { - sprintf(buffer, "[%ld]", index); - stream.Write(buffer, strlen(buffer)); - } - stream.Write(" = ", 3); - - switch (field_code) { - case 'MSGG': - { - BMessage m; - if (message->FindMessage(field_name, index, &m) >= B_OK) - DumpMessageToStream(&m, stream, tabCount, names); - } - break; - case B_RGB_COLOR_TYPE: - { - rgb_color c; - 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)); - } - stream.Write("\n", 1); - } - break; - case 'FONt': - { - BFont f; - 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; - if (message->FindBool(field_name, index, &value) >= B_OK) { - sprintf(buffer, "bool(%s)", value?"true":"false"); - stream.Write(buffer, strlen(buffer)); - } - stream.Write("\n", 1); - } - break; - case B_INT32_TYPE: - { - int32 value; - if (message->FindInt32(field_name, index, &value) >= B_OK) { -#if 1 - if (value == 0) - sprintf(buffer, "int32(0 or (nil))"); - else -#endif -// sprintf(buffer, "int32(%d)", value); - sprintf(buffer, "int32(%ld or 0x%lx)", value, value); - stream.Write(buffer, strlen(buffer)); - } - stream.Write("\n", 1); - } - break; - case B_FLOAT_TYPE: - { - float value; - if (message->FindFloat(field_name, index, &value) >= B_OK) { - sprintf(buffer, "float(%f)", value); - stream.Write(buffer, strlen(buffer)); - } - stream.Write("\n", 1); - } - break; - case B_STRING_TYPE: - { - const char *value; - if (message->FindString(field_name, index, &value) >= B_OK) { - BString str(value); - str.CharacterEscape("\\\"\n", '\\'); - //sprintf(buffer, "string(\"%s\", %ld bytes)", str.String(), strlen(value)); - // DO NOT use buffer! - str.Prepend("string(\""); - str << "\", " << strlen(value) << " bytes)"; - stream.Write(str.String(), strlen(str.String())); - } - stream.Write("\n", 1); - } - break; - case B_POINT_TYPE: - { - BPoint value; - if (message->FindPoint(field_name, index, &value) >= B_OK) { - sprintf(buffer, "BPoint(%1.1f, %1.1f)", value.x, value.y); - stream.Write(buffer, strlen(buffer)); - } - stream.Write("\n", 1); - } - break; - default: - { - const void *data; - ssize_t numBytes = 0; - if (message->FindData(field_name, field_code, index, &data, &numBytes) != B_OK) { - //stream.Write("\n", 1); - break; - } - - if ( isalnum(field_code & 0x0ff) && - isalnum((field_code >> 8) & 0x0ff) && - isalnum((field_code >> 16) & 0x0ff) && - isalnum((field_code >> 24) & 0x0ff)) - sprintf(buffer, "'%c%c%c%c' %ld bytes:\n", - (char)(field_code >> 24) & 0x0ff, - (char)(field_code >> 16) & 0x0ff, - (char)(field_code >> 8) & 0x0ff, - (char)field_code & 0x0ff, - numBytes); - else - sprintf(buffer, "0x%08lx %ld bytes:\n", field_code, numBytes); - stream.Write(buffer, strlen(buffer)); - stream.Write("\n", 1); - HexDumpToStream(data, numBytes, stream, tabs); - } - break; - } - } - } - stream.Write(tabs+2, tabCount-1); - stream.Write("}\n", 2); - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/DumpMessage.h b/3rdparty/mmu_man/themes/DumpMessage.h deleted file mode 100644 index 4d235a7569..0000000000 --- a/3rdparty/mmu_man/themes/DumpMessage.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _DUMP_MESSAGE_H -#define _DUMP_MESSAGE_H - -class BMessage; -class BDataIO; - -status_t DumpMessageToStream(BMessage *message, BDataIO &stream, int tabCount = 0, BMessage *names = NULL); - -#endif /* _DUMP_MESSAGE_H */ - diff --git a/3rdparty/mmu_man/themes/Jamfile b/3rdparty/mmu_man/themes/Jamfile deleted file mode 100644 index c09c9215f3..0000000000 --- a/3rdparty/mmu_man/themes/Jamfile +++ /dev/null @@ -1,50 +0,0 @@ -SubDir HAIKU_TOP 3rdparty mmu_man themes ; - -SetSubDirSupportedPlatformsBeOSCompatible ; - -#SubDirC++Flags -DSINGLE_BINARY -DDEBUG=1 ; -SubDirC++Flags -DSINGLE_BINARY ; - -SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) 3rdparty mmu_man themes addons ] ; - -local addonSources ; -addonSources = - BackgroundsAddon.cpp - BeIDEAddon.cpp - BeOSWindowDecorAddon.cpp - DanoUISettingsAddon.cpp - DeskbarAddon.cpp - EddieAddon.cpp - HaikuUISettingsAddon.cpp - HaikuWindowDecorAddon.cpp - PeAddon.cpp - ScreensaverAddon.cpp - SoundplayColorAddon.cpp - SoundsAddon.cpp - TerminalAddon.cpp - WinampSkinAddon.cpp -; - -Application <3rdparty>Themes : - BeThemeImporter.cpp - CompareMessages.cpp - DumpMessage.cpp - MakeScreenshot.cpp - MSThemeImporter.cpp - ParseMessage.cpp - TextInputAlert.cpp - ThemeAddonItem.cpp - ThemesApp.cpp - ThemeImporter.cpp - ThemeInterfaceView.cpp - ThemeItem.cpp - ThemeManager.cpp - ThemesAddon.cpp - Utils.cpp - ViewItem.cpp - $(addonSources) - : be media textencoding translation - $(TARGET_LIBSTDC++) - : Themes.rdef -; - diff --git a/3rdparty/mmu_man/themes/MSThemeImporter.cpp b/3rdparty/mmu_man/themes/MSThemeImporter.cpp deleted file mode 100644 index e342cf6566..0000000000 --- a/3rdparty/mmu_man/themes/MSThemeImporter.cpp +++ /dev/null @@ -1,680 +0,0 @@ -/* - * Copyright 2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * MSThemeImporter class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "UITheme.h" -#include "Utils.h" -#include "MSThemeImporter.h" - - -// references: -// http://www.virtualplastic.net/html/desk_reg.html -// http://blogs.technet.com/josebda/archive/2007/08/06/personalizing-the-desktop-on-a-windows-server-2008-server-core-install.aspx -// http://msdn.microsoft.com/en-us/library/bb773190(VS.85).aspx -// color schemes: -// http://www.debbiesthemes.com/utilities/color_scheme.html -// http://www.endolith.com/wordpress/2008/08/03/wine-colors/ - - -#define DEBUG_TI -#ifdef DEBUG_TI -#define FENTRY PRINT(("ThemeImporter[%s]::%s()\n", Name(), __FUNCTION__)) -#else -#define FENTRY -#endif - -static struct ui_color_map { - const char *wname; - const char *name1; - const char *name2; -} sUIColorMap[] = { -/* - { "ActiveBorder" }, - { "ActiveTitle" }, - { "AppWorkspace", NOT B_UI_PANEL_BACKGROUND_COLOR, NULL }, - { "Background" }, - { "ButtonAlternateFace" }, - { "ButtonDkShadow" }, -*/ - { "ButtonFace", B_UI_CONTROL_BACKGROUND_COLOR, B_UI_PANEL_BACKGROUND_COLOR }, - { "ButtonHilight", B_UI_CONTROL_HIGHLIGHT_COLOR, NULL }, - - { "ButtonLight", B_UI_SHINE_COLOR, NULL }, - { "ButtonShadow", B_UI_SHADOW_COLOR, NULL }, - { "ButtonText", B_UI_CONTROL_TEXT_COLOR, B_UI_PANEL_TEXT_COLOR }, -/* - { "GradientActiveTitle" }, - { "GradientInactiveTitle" }, - { "GrayText" }, - { "Hilight" }, - { "HilightText" }, -*/ - { "HotTrackingColor", B_UI_DOCUMENT_LINK_COLOR, NULL }, -/* - { "InactiveBorder" }, - { "InactiveTitle" }, - { "InactiveTitleText" }, -*/ - { "InfoText", B_UI_TOOLTIP_TEXT_COLOR, NULL }, - { "InfoWindow", B_UI_TOOLTIP_BACKGROUND_COLOR, NULL }, - { "Menu", B_UI_MENU_BACKGROUND_COLOR, NULL }, - { "MenuBar", B_UI_MENU_BACKGROUND_COLOR, NULL }, - { "MenuHilight", B_UI_MENU_SELECTED_BACKGROUND_COLOR, NULL }, - { "MenuText", B_UI_MENU_ITEM_TEXT_COLOR, NULL }, -/* - { "Scrollbar" }, - { "TitleText" }, -*/ - { "Window", B_UI_DOCUMENT_BACKGROUND_COLOR, NULL }, - { "WindowFrame", B_UI_NAVIGATION_BASE_COLOR, B_UI_CONTROL_HIGHLIGHT_COLOR }, - { "WindowText", B_UI_DOCUMENT_TEXT_COLOR, NULL }, - { NULL, NULL, NULL }, -}; - -static struct screensaver_map { - const char *wname; - const char *name; -} sScreensaverMap[] = { - //{ "", "Blackness" } - //{ "", "BSOD" } - { "system32\\logon.scr", "Lissart" }, - { "system32\\scrnsave.scr", "Lissart" }, - { "system32\\ss3dfo.scr", "Lissart" }, - { "system32\\ssbezier.scr", "Lissart" }, - { "system32\\ssflwbox.scr", "Lissart" }, - { "system32\\ssmarque.scr", "Message" }, - { "system32\\ssmypics.scr", "Lissart" }, - { "system32\\ssmyst.scr", "Lissart" }, - { "system32\\sspipes.scr", "Lissart" }, - { "system32\\ssstars.scr", /*"Stars"*/"Nebula" }, - { "system32\\sstext3d.scr", "Lissart" }, - { NULL, NULL } -}; - - -/* -'[' [|.A|.W] ']' -left to map: -AppEvents\\Schemes\\Apps\\.Default\\AppGPFault\\.Current -AppEvents\\Schemes\\Apps\\.Default\\DeviceConnect\\.Current -AppEvents\\Schemes\\Apps\\.Default\\DeviceDisconnect\\.Current -AppEvents\\Schemes\\Apps\\.Default\\DeviceFail\\.Current -AppEvents\\Schemes\\Apps\\.Default\\LowBatteryAlarm\\.Current -AppEvents\\Schemes\\Apps\\.Default\\MenuCommand\\.Current -AppEvents\\Schemes\\Apps\\.Default\\MenuPopup\\.Current -AppEvents\\Schemes\\Apps\\.Default\\PrintComplete\\.Current -AppEvents\\Schemes\\Apps\\.Default\\RingIn\\.Current -AppEvents\\Schemes\\Apps\\.Default\\Ringout\\.Current -AppEvents\\Schemes\\Apps\\.Default\\SystemHand\\.Current -AppEvents\\Schemes\\Apps\\.Default\\SystemQuestion\\.Current -AppEvents\\Schemes\\Apps\\.Default\\SystemStartMenu\\.Current -AppEvents\\Schemes\\Apps\\.Default\\WindowsLogoff\\.Current -AppEvents\\Schemes\\Apps\\.Default\\WindowsLogon\\.Current -AppEvents\\Schemes\\Apps\\Explorer\\EmptyRecycleBin\\.Current -AppEvents\\Schemes\\Apps\\Explorer\\Navigating\\.Current -*/ - -static struct sounds_map { - const char *wname; - const char *name; -} sSoundsMap[] = { - //{ "", "BeShare-DLFinished" }, - //{ "", "BeShare-InactivChat" }, - //{ "", "BeShare-Name Said" }, - //{ "", "BeShare-NoComplete" }, - //{ "", "BeShare-Private Msg" }, - //{ "", "BeShare-PrivateWndw" }, - //{ "", "BeShare-ULFinished" }, - //{ "", "BeShare-ULStarted" }, - //{ "", "BeShare-WatchedUser" }, - { "AppEvents\\Schemes\\Apps\\.Default\\.Default\\.Current", "Beep" }, - //{ "", "Capture" }, - //{ "", "IM Connected" }, - //{ "", "IM Disconnected" }, - //{ "", "IM Message Received" }, - //{ "", "IM Status: Available" }, - //{ "", "IM Status: Away" }, - //{ "", "IM Status: Offline" }, - { "AppEvents\\Schemes\\Apps\\.Default\\SystemExclamation\\.Current", "InfoPopper: Error Message" }, - { "AppEvents\\Schemes\\Apps\\.Default\\SystemAsterisk\\.Current", "InfoPopper: Important Message" }, - { "AppEvents\\Schemes\\Apps\\.Default\\SystemNotification\\.Current", "InfoPopper: Information Message" }, - //{ "", "InfoPopper: Progress Message" }, - //{ "", "Key Down" }, - //{ "", "Key Repeat" }, - //{ "", "Key Up" }, - //{ "", "Mouse Down" }, - //{ "", "Mouse Up" }, - { "AppEvents\\Schemes\\Apps\\.Default\\MailBeep\\.Current", "New E-mail" }, - { "AppEvents\\Schemes\\Apps\\.Default\\SystemStart\\.Current", "Startup" }, - //{ "", "Vision Nick Notification" }, - //{ "AppEvents\\Schemes\\Apps\\.Default\\RestoreDown\\.Current", "Window Activated" }, - // actually *app* close/open... - { "AppEvents\\Schemes\\Apps\\.Default\\Close\\.Current", "Window Close" }, - { "AppEvents\\Schemes\\Apps\\.Default\\Minimize\\.Current", "Window Minimized" }, - { "AppEvents\\Schemes\\Apps\\.Default\\Open\\.Current", "Window Open" }, - // or Activated ? - { "AppEvents\\Schemes\\Apps\\.Default\\RestoreUp\\.Current", "Window Restored" }, - { "AppEvents\\Schemes\\Apps\\.Default\\Maximize\\.Current", "Window Zoomed" }, - //{ "", "Yahoo: Buzz" }, - // non official sounds yet - { "AppEvents\\Schemes\\Apps\\.Default\\SystemExit\\.Current", "Shutdown" }, - { NULL, NULL } -}; - - -// #pragma mark - - - -MSThemeImporter::MSThemeImporter() - :ThemeImporter("MSTheme") -{ - FENTRY; -} - - -MSThemeImporter::~MSThemeImporter() -{ - FENTRY; -} - - -const char * -MSThemeImporter::Description() -{ - FENTRY; - return "Imports MSTheme themes"; -} - - -status_t -MSThemeImporter::FetchThemes() -{ - FENTRY; - status_t err = ENOENT; - BVolumeRoster r; - BVolume v; - - r.Rewind(); - while (r.GetNextVolume(&v) == B_OK) { - fs_info info; - if (fs_stat_dev(v.Device(), &info) != B_OK) - continue; - if (strcmp(info.fsh_name, "ntfs")) - continue; - BDirectory dir; - if (v.GetRootDirectory(&dir) != B_OK) - continue; - if (dir.SetTo(&dir, "WINDOWS/Resources/Themes") == B_OK) { - if (ScanDirectory(dir)) - err = B_OK; - } -#if 0 - if (v.GetRootDirectory(&dir) != B_OK) - continue; - if (dir.SetTo(&dir, "Documents and Settings/revol/Mes documents") == B_OK) { - if (ScanDirectory(dir, 1)) - err = B_OK; - } -#endif -#if 1 - // that's slow... - if (v.GetRootDirectory(&dir) != B_OK) - continue; - if (dir.SetTo(&dir, "Documents and Settings") == B_OK) { - if (ScanDirectory(dir, 3)) - err = B_OK; - } -#endif - } - - return err; -} - - -status_t -MSThemeImporter::ImportNextTheme(BMessage **theme) -{ - FENTRY; - status_t err; - - BEntry *entry = (BEntry *)fEntryList.RemoveItem(0L); - // no more - if (!entry) - return ENOENT; - BPath path; - err = entry->GetPath(&path); - delete entry; - if (err < B_OK) - return err; - BFile file; - err = file.SetTo(path.Path(), B_READ_ONLY); - if (err < B_OK) - return err; - BVolume vol; - err = file.GetVolume(&vol); - if (err < B_OK) - return err; - - PRINT(("MSThemeImporter: importing from '%s'\n", path.Path())); - - // get some standard folders - BDirectory rootDir; - err = vol.GetRootDirectory(&rootDir); - if (err < B_OK) - return err; - - BString encodedContent; - off_t size; - char *buf; - err = file.GetSize(&size); - if (err < B_OK) - return err; - buf = encodedContent.LockBuffer((size_t)size+1); - memset(buf, 0, (size_t)size+1); - if (file.Read(buf, (size_t)size) < size) - return EIO; - encodedContent.UnlockBuffer(); - int32 encodedLength = (int32)size; - BString content; - int32 contentLength = (int32)size * 2; - int32 state = 0; - buf = content.LockBuffer(contentLength+1); - memset(buf, 0, contentLength+1); - err = convert_to_utf8(B_MS_WINDOWS_CONVERSION, - encodedContent.String(), &encodedLength, - buf, &contentLength, - &state); - content.UnlockBuffer(); - if (err < B_OK) - return err; - //PRINT(("'%s'\n", content.String())); - // strip DOS CR - // RemoveSet() seems to be buggy on BeOS (strips UTF-8 chars ???) - content.RemoveAll("\r"); - - // is it really a theme file ? - if (content.IFindFirst("[Theme]") < 0) - return ENOENT; - - BMessage global(Z_THEME_MESSAGE_WHAT); - BMessage info; - BMessage decor; - BMessage backgrounds; - BMessage deskbar; - BMessage ui_settings; - BMessage screensaver; - BMessage sounds; - - BString leaf(path.Leaf()); - leaf.RemoveLast(".theme"); - info.AddString(Z_THEME_NAME, leaf); - global.AddString(Z_THEME_LOCATION, path.Path()); - - BString themeScreensaver("Blackness"); - - BString themeWindowDecor("Win2k"); - int32 themeWindowDecorR5 = R5_DECOR_WIN95; - - BPath themeWallpaperPath; - bool themeWallpaperTiled = false; - int32 themeWallpaperStyle = 0; - BPoint themeWallpaperOrigin(0, 0); - - BString section; - - // on each line - while (content.Length()) { - BString line; - content.MoveInto(line, 0, content.FindFirst('\n')); - content.RemoveFirst("\n"); - //PRINT((":'%s'\n", line.String())); - if (line.Length() < 1) - continue; - if (line[0] == ';') - continue; - if (line[0] == '[') { - section = line; - continue; - } - BString key; - BString value; - line.MoveInto(key, 0, line.FindFirst('=')); - line.RemoveFirst("="); - value = line; - if (section == "[Theme]") { - } else if (section == "[boot]") { - if (!key.ICompare("SCRNSAVE.EXE")) { - for (int i = 0; sScreensaverMap[i].wname; i++) { - if (value.IFindFirst(sScreensaverMap[i].wname) > -1) { - themeScreensaver = sScreensaverMap[i].name; - PRINT(("screensaver: %s -> %s\n", sScreensaverMap[i].wname, sScreensaverMap[i].name)); - } - } - } - // My Computer - } else if (section == "[CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\DefaultIcon]") { - //DefaultValue=%WinDir%explorer.exe,0 - // My Documents - } else if (section == "[CLSID\\{450D8FBA-AD25-11D0-98A8-0800361B1103}\\DefaultIcon]") { - //DefaultValue=%WinDir%SYSTEM32\mydocs.dll,0 - // My Network Places - } else if (section == "[CLSID\\{208D2C60-3AEA-1069-A2D7-08002B30309D}\\DefaultIcon]") { - //DefaultValue=%WinDir%SYSTEM32\shell32.dll,17 - // Recycle Bin - } else if (section == "[CLSID\\{645FF040-5081-101B-9F08-00AA002F954E}\\DefaultIcon]") { - //full=%WinDir%SYSTEM32\shell32.dll,32 - //empty=%WinDir%SYSTEM32\shell32.dll,31 - } else if (section == "[Control Panel\\Colors]") { - int r, g, b; - int nColors = sscanf(value.String(), "%d %d %d", &r, &g, &b); - if (nColors < 3) { - PRINT(("nColors %d < 3\n", nColors)); - continue; - } - rgb_color color = { r, g, b, 255 }; - - if (!key.ICompare("Background")) { - AddRGBColor(backgrounds, "be:desktop_color", color); - continue; - } - for (int i = 0; sUIColorMap[i].wname; i++) { - if (!key.ICompare(sUIColorMap[i].wname)) { - if (sUIColorMap[i].name1) - AddRGBColor(ui_settings, sUIColorMap[i].name1, color); - if (sUIColorMap[i].name2) - AddRGBColor(ui_settings, sUIColorMap[i].name2, color); - break; - } - } - } else if (section == "[Control Panel\\Desktop]") { - if (!key.ICompare("Wallpaper")) { - BPath p; - if (value.Length() < 1) - continue; - - err = ParseWinPath(rootDir, value.String(), p); - if (err < B_OK) - continue; - PRINT(("Wallpaper at '%s'\n", p.Path())); - themeWallpaperPath = p; - } else if (!key.ICompare("TileWallpaper")) { - if (value != 0) - themeWallpaperTiled = true; - } else if (!key.ICompare("WallpaperStyle")) { - int v; - int n = sscanf(value.String(), "%d", &v); - if (n > 0) - themeWallpaperStyle = v; - } else if (!key.ICompare("WallpaperOriginX")) { - int v; - int n = sscanf(value.String(), "%d", &v); - if (n > 0) - themeWallpaperOrigin.x = v; - } else if (!key.ICompare("WallpaperOriginY")) { - int v; - int n = sscanf(value.String(), "%d", &v); - if (n > 0) - themeWallpaperOrigin.y = v; - } else if (!key.ICompare("Pattern")) { - ; - } else if (!key.ICompare("ScreenSaveActive")) { - // force back to none - if (value == "0") - themeScreensaver = "Blackness"; - } - } else if (section == "[Metrics]") { - ; - } else if (section == "[VisualStyles]") { - if (!key.ICompare("Path")) { - if (value.IFindFirst("luna.msstyles") > -1) { - // map Zeta decor - themeWindowDecor = "Redmond"; - } else if (value.IFindFirst("aero.msstyles") > -1) { - ; - } // else use Win2k - } - if (!key.ICompare("ColorStyle")) { - // use the greyish verison - if (value == "Metallic" && themeWindowDecor == "Redmond") - themeWindowDecor = "Seattle"; - } - } else if (section.IFindFirst("AppEvents\\Schemes\\Apps") > -1) { - if (key != "DefaultValue") - continue; - // system sound... - for (int i = 0; sSoundsMap[i].wname; i++) { - if (section.IFindFirst(sSoundsMap[i].wname) > -1) { - BString encodedPath; - if (section.IFindFirst(".W]") > -1) { - // Wide Char weirdly encoded path... - // skip for now. - break; - // someone knows this +AOk- stuff ?? - } else { - // ANSI path (.A or none specified) - // but it's been converted to UTF-8 already - // so we just use that one. - encodedPath = value; - } - PRINT(("Sound: '%s' -> '%s' (%s)\n", section.String(), sSoundsMap[i].name, value.String())); - if (encodedPath.Length() == 0) - break; - BPath soundPath; - if (ParseWinPath(rootDir, encodedPath.String(), soundPath) < B_OK) - break; - BMessage sound('SndI'); - sound.AddString("sounds:file", soundPath.Path()); - sound.AddFloat("sounds:volume", 1.0); - if (sounds.ReplaceMessage(sSoundsMap[i].name, &sound) < B_OK) - sounds.AddMessage(sSoundsMap[i].name, &sound); - } - } - } else { - ;//PRINT(("MSThemeImporter: unknown section '%s', line '%s'\n", section.String(), line.String())); - } - } - - // apply settings now we that have everything - - // force Deskbar at the bottom... it's Windows, right? - // XXX: I couldn't find a reg key for that in any theme, - // but likely there is one. - deskbar_location loc = B_DESKBAR_BOTTOM; - bool expanded = true; - deskbar.AddInt32("db:location", (int32)loc); - deskbar.AddBool("db:expanded", expanded); - - // window decor - decor.AddString("window:decor", themeWindowDecor.String()); - // fallbacks - decor.AddString("window:decor", "Win95"); - decor.AddString("window:decor", "Win2k"); - decor.AddString("window:decor", "Win"); - decor.AddString("window:decor", "Redmond"); - decor.AddString("window:decor", "Seattle"); - decor.AddString("window:decor", "WinDecorator"); - decor.AddInt32("window:R5:decor", themeWindowDecorR5); - - // wallpaper - if (themeWallpaperPath.InitCheck() == B_OK) { - backgrounds.AddString(B_BACKGROUND_IMAGE, themeWallpaperPath.Path()); - backgrounds.AddInt32(B_BACKGROUND_WORKSPACES, 0xffffffff); - int32 wallpaperMode = B_BACKGROUND_MODE_CENTERED; - switch (themeWallpaperStyle) { - case 0: // centered or tiled - if (themeWallpaperTiled) - wallpaperMode = B_BACKGROUND_MODE_TILED; - break; - case 2: // stretched - wallpaperMode = B_BACKGROUND_MODE_SCALED; - break; - case 3: // resized with correct ratio - // let's keep centered - break; - case 4: // resized and cropped with correct ratio - break; - } - backgrounds.AddInt32(B_BACKGROUND_MODE, wallpaperMode); - backgrounds.AddPoint(B_BACKGROUND_ORIGIN, themeWallpaperOrigin); - //XXX: there is a reg key for that, is it used ? - //backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, erasetext); - } - - // ui settings: disable Z-Snake - ui_settings.AddBool(B_UI_MENU_ZSNAKE, false); - - screensaver.AddString("screensaver:modulename", themeScreensaver.String()); - - global.AddMessage(Z_THEME_INFO_MESSAGE, &info); - global.AddMessage(Z_THEME_WINDOW_DECORATIONS, &decor); - global.AddMessage(Z_THEME_BACKGROUND_SETTINGS, &backgrounds); - global.AddMessage(Z_THEME_DESKBAR_SETTINGS, &deskbar); - global.AddMessage(Z_THEME_UI_SETTINGS, &ui_settings); - global.AddMessage(Z_THEME_SCREENSAVER_SETTINGS, &screensaver); - global.AddMessage(Z_THEME_SOUNDS_SETTINGS, &sounds); - *theme = new BMessage(global); - //global.PrintToStream(); - - return B_OK; -} - - -status_t -MSThemeImporter::EndImports() -{ - FENTRY; - return B_OK; -} - - -bool -MSThemeImporter::ScanDirectory(BDirectory &dir, int depth) -{ - //FENTRY; - BEntry ent; - bool found = false; - - if (depth == 0) - return false; - - while (dir.GetNextEntry(&ent) == B_OK) { - if (ent.IsDirectory()) { - BDirectory subdir(&ent); - if (ScanDirectory(subdir, depth - 1)) - found = true; - continue; - } - if (!ent.IsFile()) - continue; - char name[B_FILE_NAME_LENGTH]; - if (ent.GetName(name) != B_OK) - continue; - if (!strstr(name, ".theme")) - continue; - printf("found '%s'\n", name); - fEntryList.AddItem(new BEntry(ent)); - found = true; - } - - return found; -} - - -status_t -MSThemeImporter::ParseWinPath(BDirectory &rootDir, const char *from, BPath &to) -{ - status_t err; - //FENTRY; - //return ENOENT; - //BDirectory winDir(&rootDir, "WINDOWS"); - //BDirectory resourceDir(&winDir, "Resources"); - PRINT(("ParseWinPath(, %s, )\n", from)); - BString p(from); - //p.ReplaceAll('\\', '/'); - to.SetTo(&rootDir, "."); - - if (p.IFindFirst("%WinDir%") == 0) { - to.Append("WINDOWS"); - p.IReplaceFirst("%WinDir%", ""); - } - if (p.IFindFirst("%ResourceDir%") == 0) { - to.Append("WINDOWS/Resources"); - p.IReplaceFirst("%ResourceDir%", ""); - } - //TODO: %ThemeDir% - - //TODO: split and check for correct case - BDirectory dir; - while (p.Length()) { - BString component; - //PRINT(("ParseWinPath: p.L %d p '%s'\n", p.Length(), p.String())); - int32 len = p.FindFirst('\\'); - if (len < 0) - len = p.Length(); - p.MoveInto(component, 0, len); - p.RemoveFirst("\\"); - err = dir.SetTo(to.Path()); - if (err < B_OK) - return err; - //PRINT(("ParseWinPath: at '%s'\n", to.Path())); - //PRINT(("ParseWinPath: testing '%s'\n", component.String())); - if (dir.Contains(component.String())) { - to.Append(component.String()); - continue; - } - // can't find as is, try various capitalizations - // (caseless fs SUXOR) - component.Capitalize(); - //PRINT(("ParseWinPath: testing '%s'\n", component.String())); - if (dir.Contains(component.String())) { - to.Append(component.String()); - continue; - } - component.CapitalizeEachWord(); - //PRINT(("ParseWinPath: testing '%s'\n", component.String())); - if (dir.Contains(component.String())) { - to.Append(component.String()); - continue; - } - component.ToLower(); - //PRINT(("ParseWinPath: testing '%s'\n", component.String())); - if (dir.Contains(component.String())) { - to.Append(component.String()); - continue; - } - component.ToUpper(); - //PRINT(("ParseWinPath: testing '%s'\n", component.String())); - if (dir.Contains(component.String())) { - to.Append(component.String()); - continue; - } - PRINT(("ParseWinPath: failed\n")); - // TODO: loop on GetNextEntry and ICompare ? - return ENOENT; - } - PRINT(("ParseWinPath(, %s, ) -> %s\n", from, to.Path())); - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/MSThemeImporter.h b/3rdparty/mmu_man/themes/MSThemeImporter.h deleted file mode 100644 index 5c25134b02..0000000000 --- a/3rdparty/mmu_man/themes/MSThemeImporter.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _MS_THEME_IMPORTER_H -#define _MS_THEME_IMPORTER_H -/* - * MSTheme Importer class header - */ - -#include - -#include "ThemeImporter.h" - -namespace Z { -namespace ThemeManager { - -class MSThemeImporter : public ThemeImporter { -public: - MSThemeImporter(); -virtual ~MSThemeImporter(); - - /* presentation */ - -virtual const char *Description(); /* tooltip... */ - - /* Theme manipulation */ - -virtual status_t FetchThemes(); -virtual status_t ImportNextTheme(BMessage **theme); -virtual status_t EndImports(); - - /* */ - -private: - -bool ScanDirectory(BDirectory &dir, int depth=-1); -status_t ParseWinPath(BDirectory &rootDir, const char *from, BPath &to); - -friend class Z::ThemeManager::ThemeManager; - BList fEntryList; -}; - -} // ns ThemeManager -} // ns Z - -using namespace Z::ThemeManager; - -#endif /* _MS_THEME_IMPORTER_H */ diff --git a/3rdparty/mmu_man/themes/MakeScreenshot.cpp b/3rdparty/mmu_man/themes/MakeScreenshot.cpp deleted file mode 100644 index 84317ab1ed..0000000000 --- a/3rdparty/mmu_man/themes/MakeScreenshot.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * MakeScreenshot function - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -// PRIVATE: in libzeta for now. -extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); - - -status_t -MakeScreenshot(BBitmap **here) -{ - status_t err; - BScreen bs; - BWindow *win; - BBitmap *shot; - BBitmap *scaledBmp = NULL; - be_app->Lock(); - win = be_app->WindowAt(0); - if (win) { - win->Lock(); - win->Hide(); - win->Unlock(); - } - snooze(500000); - err = bs.GetBitmap(&shot); - if (!err) { - BRect scaledBounds(0,0,640-1,480-1); - scaledBmp = new BBitmap(scaledBounds, B_BITMAP_ACCEPTS_VIEWS, B_RGB32/*shot->ColorSpace()*/); - err = scaledBmp->InitCheck(); - if (!err) { - err = ENOSYS; -#ifdef B_ZETA_VERSION - err = ScaleBitmap(*shot, *scaledBmp); -#endif - if (err) { - // filtered scaling didn't work, do it manually - BView *v = new BView(scaledBounds, "scaleview", B_FOLLOW_NONE, 0); - scaledBmp->AddChild(v); - v->LockLooper(); - v->DrawBitmap(shot); - v->Sync(); - v->UnlockLooper(); - scaledBmp->RemoveChild(v); - delete v; - err = B_OK; - } - } - delete shot; - } - - if (win) { - win->Lock(); - win->Show(); - win->Unlock(); - } - be_app->Unlock(); - - if (err) - return err; - - *here = scaledBmp; - - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/ParseMessage.cpp b/3rdparty/mmu_man/themes/ParseMessage.cpp deleted file mode 100644 index a2ffd8c152..0000000000 --- a/3rdparty/mmu_man/themes/ParseMessage.cpp +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "DumpMessage.h" -#include "Utils.h" - -#define MAX_TEXT_LINE_INPUT_SIZE 4096 - -class TextLineInputDataIO : public BDataIO { -public: - TextLineInputDataIO(BDataIO *input); - ssize_t Read(void *buffer, size_t size); - char GetByte(); - ssize_t Write(const void *data, size_t len); - status_t FillTextLine(); -private: - BDataIO *fIn; - char fTextLine[MAX_TEXT_LINE_INPUT_SIZE]; - char *fCurrent; /* current char in fTextLine */ - int fLeft; -}; - -TextLineInputDataIO::TextLineInputDataIO(BDataIO *input) -{ - fIn = input; - fCurrent = fTextLine; - fLeft = 0; -} - -char TextLineInputDataIO::GetByte() -{ - char buf[2]; - if (Read(buf, 1) == 1) - return buf[0]; - return 0; -} -ssize_t TextLineInputDataIO::Read(void *buffer, size_t size) -{ - size = MIN(size, (size_t)fLeft); - if (size <= 0) - return 0; - fLeft -= size; - memcpy(buffer, fCurrent, size); - fCurrent += size; - return size; -} - -ssize_t TextLineInputDataIO::Write(const void *, size_t) -{ - return EINVAL; -} - -/* - * \return 1 useful line, 0 blank lin or comment, <0 error - */ -status_t TextLineInputDataIO::FillTextLine() -{ - status_t err = ENOENT; - - fCurrent = fTextLine; - while ((fCurrent < (fTextLine + MAX_TEXT_LINE_INPUT_SIZE)) - && ((err = fIn->Read(fCurrent, 1)) > 0) - && *fCurrent != '\n') - fCurrent++; - *fCurrent = '\0'; - fLeft = fCurrent - fTextLine; - fCurrent = fTextLine; -// printf("line: '%s'\n", fCurrent); - - if (err < B_OK) - return err; - if (err == 0) - return -1; // EOF - if (strlen(fCurrent) && strncmp(fCurrent, "//", 2)) - return 1; - return 0; -} - -status_t ParseHexDumpFromStream(const void **, size_t *, BDataIO &) -{ - return B_OK; -} - -status_t Parse_Msg_bool(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - bool v = false; - c = st->GetByte(); - if (c == '1' || c == 't') - v = true; - msg->AddBool(name, v); - return B_OK; -} - -status_t Parse_Msg_int32(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - int64 v = 0; // to forget about overflow - bool opposite = false; - while (isdigit(c = st->GetByte()) || c == '-') { - if (c == '-') - opposite = true; - else - v = v * 10 + (c - '0'); - } - if (c == 'x' && v == 0) { - // hex - while (isalnum(c = st->GetByte())) { - v = v * 16; - if (isdigit(c)) - v += (c - '0'); - else if (isupper(c)) - v += (c - 'A' + 10); - else - v += (c - 'a' + 10); - } - } - if (opposite) - v = -v; - msg->AddInt32(name, (int32)v); - return B_OK; -} - -status_t Parse_Msg_float(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - float v = 0; - int32 div = 1; - bool opposite = false; - while (isdigit(c = st->GetByte()) || c == '-') { - if (c == '-') - opposite = true; - else - v = v * 10 + (c - '0'); - } - if (c == '.') - while (isdigit(c = st->GetByte())) { - div *= 10; - v += (float)(c - '0') / div; - } - if (opposite) - v = -v; - msg->AddFloat(name, v); - return B_OK; -} - -status_t Parse_Msg_string(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - BString v; - bool esc = false; - if (st->GetByte() != '"') - return EINVAL; - while ((c = st->GetByte()) || esc) { - if (esc && !c) { - v << '\n'; - esc = false; - st->FillTextLine(); - continue; - } - if (esc) { - esc = false; - } else if (c == '\\') { - esc = true; - continue; - } else if (c == '"') - break; - v << c; - } - msg->AddString(name, v.String()); - return B_OK; -} - -status_t Parse_Msg_rgb_color(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - rgb_color v = {0, 0, 0, 0}; - bool has_alpha = false; - while (isdigit(c = st->GetByte())) - v.red = v.red * 10 + (c - '0'); - while (isdigit(c = st->GetByte())) - v.green = v.green * 10 + (c - '0'); - while (isdigit(c = st->GetByte())) - v.blue = v.blue * 10 + (c - '0'); - while (isdigit(c = st->GetByte())) { - has_alpha = true; - v.alpha = v.alpha * 10 + (c - '0'); - } - if (!has_alpha) - v.alpha = 255; - AddRGBColor(*msg, name, v); - return B_OK; -} - -float Parse_Msg_read_float(TextLineInputDataIO *st) -{ - char c; - int i; - float f = 0.0F; - float scale = 0.1F; - bool isNegative = false; - - i=0; - while ((c = st->GetByte())) - { - if (isdigit(c)) - { - f = f * 10 + c - '0'; - } - else if (c == '-') - { - isNegative = true; - } - else - { - break; - } - } - while (isdigit(c = st->GetByte())) { - f += (c - '0') * scale; - scale /= 10; - } - - if (isNegative) - f *= -1.0; - - return f; -} - -status_t Parse_Msg_BFont(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - int i; - font_family ff; - font_style fs; - float size = 0.0f; - BFont f; - - i=0; - while ((c = st->GetByte()) != '/') - ff[i++] = c; - ff[i] = '\0'; - i=0; - while ((c = st->GetByte()) != '/') - fs[i++] = c; - fs[i] = '\0'; - - size = Parse_Msg_read_float(st); - -//printf("fam '%s', style '%s'\n", ff, fs); - f.SetFamilyAndStyle(ff, fs); - f.SetSize(size); - //f.PrintToStream(); - AddFont(*msg, name, &f); - return B_OK; -} - -status_t Parse_Msg_BPoint(BMessage *msg, TextLineInputDataIO *st, char *name) -{ - char c; - int i; - BPoint p; - - i=0; - p.x = Parse_Msg_read_float(st); - if ((c = st->GetByte()) != ' ') - return B_ERROR; - p.y = Parse_Msg_read_float(st); - -//printf("BPoint(%f, %f)\n", p.x, p.y); - msg->AddPoint(name, p); - return B_OK; -} - -status_t Parse_Msg_HexDump(BMessage *msg, TextLineInputDataIO *st, char *name, int32 field_code) -{ - (void)msg; - (void)st; - (void)name; - (void)field_code; - return B_OK; -} - -status_t Parse_Msg_BMessage(BMessage *msg, TextLineInputDataIO *st) -{ - char field_name[B_FIELD_NAME_LENGTH]; - char field_code_name[B_FIELD_NAME_LENGTH]; - type_code field_code; - int32 index; // unused ! - int i = 0; - char c; - status_t err; - - c = st->GetByte(); - if (c == '\'') { - msg->what = ((st->GetByte() << 24) & 0xff000000) | - ((st->GetByte() << 16) & 0x0ff0000) | - ((st->GetByte() << 8) & 0x0ff00) | - (st->GetByte() & 0x0ff); - if (st->GetByte() != '\'') - return EINVAL; - if (st->GetByte() != ')') - return EINVAL; - } else if (c == '0') { - if (st->GetByte() != 'x') - return EINVAL; - while (isalnum(c = st->GetByte())) { - //printf("[%c]", c); - if (c >= 'a' && c <= 'f') - msg->what = (msg->what << 4) | (c - 'a' + 10); - else if (c >= 'A' && c <= 'F') - msg->what = (msg->what << 4) | (c - 'A' + 10); - else if (c >= '0' && c <= '9') - msg->what = (msg->what << 4) | (c - '0'); - else return EINVAL; - } - } else - return EINVAL; - if (st->GetByte() != ' ') - return EINVAL; - if (st->GetByte() != '{') - return EINVAL; - //printf("what=0x%08lx\n", msg->what); - - while ((err = st->FillTextLine()) >= 0) { - if (err == 0) - continue; - - - do - c = field_name[0] = st->GetByte(); - while (c == '\t' || c == ' '); - - for (i = 1; (c = st->GetByte()) && (c != '=') && (c != '['); i++) - field_name[i] = c; - field_name[i] = '\0'; - if (i>1 && field_name[i-1] == ' ') - field_name[i-1] = '\0'; - - if (!strcmp(field_name, "}")) - return B_OK; - - if (c == '[') { - for (index = 0; (c = st->GetByte()) && isdigit(c); index = index * 10 + c - '0'); - for (; (c = st->GetByte()) && (c != '='); ); - //PRINT(("index ignored (%ld) for item '%s'\n", index, field_name)); - } - - i = 0; - do - c = field_code_name[0] = st->GetByte(); - while (c && (c == '\t' || c == ' ')); - -// while ((field_code_name[++i] = st->GetByte()) != '('); - for (i = 1; (c = st->GetByte()) && (c != '(') && (c != ' '); i++) - field_code_name[i] = c; - field_code_name[i] = '\0'; - - if (!strncmp(field_name, "//", 2)) - continue; - -// printf("name:'%s' code'%s'\n", field_name, field_code_name); - - if (!strcmp(field_code_name, "BMessage")) { - BMessage *m; - m = new BMessage; - err = Parse_Msg_BMessage(m, st); - if (err < B_OK) { - delete m; - return err; - } - msg->AddMessage(field_name, m); - } else if (!strcmp(field_code_name, "bool")) { - err = Parse_Msg_bool(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "int32")) { - err = Parse_Msg_int32(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "float")) { - err = Parse_Msg_float(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "string")) { - err = Parse_Msg_string(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "rgb_color")) { - err = Parse_Msg_rgb_color(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "BPoint")) { - err = Parse_Msg_BPoint(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strcmp(field_code_name, "BFont")) { - err = Parse_Msg_BFont(msg, st, field_name); - if (err < B_OK) - return err; - } else if (!strncmp(field_code_name, "'", 1)) { - field_code = ((st->GetByte() << 24) & 0xff000000) | - ((st->GetByte() << 16) & 0x0ff0000) | - ((st->GetByte() << 8) & 0x0ff00) | - (st->GetByte() & 0x0ff); - err = Parse_Msg_HexDump(msg, st, field_name, field_code); - if (err < B_OK) - return err; - } else - return EINVAL; - - } - return B_OK; -} - -status_t ParseMessageFromStream(BMessage **message, BDataIO &stream) -{ -// char field_name[B_FIELD_NAME_LENGTH]; - char field_code_name[B_FIELD_NAME_LENGTH]; -// type_code field_code; -// int32 field_count; - int i = 0; - char c; - status_t err; - - if (message == NULL) - return EINVAL; - - BMessage *msg = *message = new BMessage; - TextLineInputDataIO *st = new TextLineInputDataIO(&stream); - while ((err = st->FillTextLine()) == 0); - if (err < 0) - return EINVAL; - - - i = 0; - do - c = field_code_name[0] = st->GetByte(); - while (c && (c == '\t' || c == ' ')); - -// while ((field_code_name[++i] = st->GetByte()) != '('); - for (i = 1; (c = st->GetByte()) && (c != '('); i++) - field_code_name[i] = c; - field_code_name[i] = '\0'; - - - //printf("code'%s'\n", field_code_name); - if (strcmp(field_code_name, "BMessage")) { - PRINT(("bad code name (%s)\n", field_code_name)); - return EINVAL; - } - err = Parse_Msg_BMessage(msg, st); - if (err < B_OK) { - delete msg; - *message = NULL; - return B_ERROR; - } - - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/ParseMessage.h b/3rdparty/mmu_man/themes/ParseMessage.h deleted file mode 100644 index 9eb1c0cbe0..0000000000 --- a/3rdparty/mmu_man/themes/ParseMessage.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _PARSE_MESSAGE_H -#define _PARSE_MESSAGE_H - -class BMessage; -class BDataIO; - -status_t ParseMessageFromStream(BMessage **message, BDataIO &stream); - -#endif /* _PARSE_MESSAGE_H */ - diff --git a/3rdparty/mmu_man/themes/TODO.txt b/3rdparty/mmu_man/themes/TODO.txt deleted file mode 100644 index 6110ecae5e..0000000000 --- a/3rdparty/mmu_man/themes/TODO.txt +++ /dev/null @@ -1,24 +0,0 @@ -TODOs for Theme manager: -* check R5 build -* style cleanup (-> Haiku style) -* enable theme descriptions again (tooltip on listitem ?). -* make ParseMessage more robust -* forbid quitting while themes are loading! -* implement BackupFiles() methods to add required files to a zip. -* fix TerminalAddon: get theme from haiku -* Save as resource/BMessage ? (for editing) -* broadcast _UIC for Haiku -* ideas for addons: - - ~/config/settings/Tracker/DefaultFolderTemplate/ (default background ??) - - Desktop icon size ? - - Desktop shelf ? (dangerous) - - Deskbar logo (Be, leaf...) - - dircolors (cf. http://linux.die.net/man/5/dir_colors ) - - icons (/etc/icons ? svg/hvif, setmime...) - - Tracker usage bar colors - - mouse cursors (needs app_server fixes ??) - - Pulse colors (-> sample code) - - BeIDE/Pe/Eddie full colors (map to singe namespace) - - Vision/BeShare full colors (map to singe namespace) - - Firefox theme ? - diff --git a/3rdparty/mmu_man/themes/TextInputAlert.cpp b/3rdparty/mmu_man/themes/TextInputAlert.cpp deleted file mode 100644 index 0100ac7df4..0000000000 --- a/3rdparty/mmu_man/themes/TextInputAlert.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2007-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -//HACK :P -#define private public -#include -#undef private - -#include "TextInputAlert.h" - -#define TEXT_HEIGHT 25 - - -TextInputAlert::TextInputAlert(const char *title, - const char *text, - const char *initial, /* initial input value */ - const char *button0Label, - const char *button1Label, - const char *button2Label, - button_width widthStyle, - alert_type type) - : BAlert(title, text, button0Label, button1Label, button2Label, widthStyle, type) -{ - ResizeBy(0,TEXT_HEIGHT); - BRect f = Bounds(); - f.InsetBySelf(TEXT_HEIGHT, f.Height()/4 - TEXT_HEIGHT/2); - f.left *= 3; - fText = new BTextControl(f, "text", "Name:", initial, NULL); - fText->SetDivider(f.Width()/3); - ChildAt(0)->AddChild(fText); - TextView()->Hide(); - fText->SetViewColor(ChildAt(0)->ViewColor()); - fText->SetLowColor(ChildAt(0)->LowColor()); - fText->TextView()->SelectAll(); -} - - -TextInputAlert::~TextInputAlert() -{ -} - - -void -TextInputAlert::Show() -{ - BAlert::Show(); -} - - diff --git a/3rdparty/mmu_man/themes/TextInputAlert.h b/3rdparty/mmu_man/themes/TextInputAlert.h deleted file mode 100644 index d204110b3b..0000000000 --- a/3rdparty/mmu_man/themes/TextInputAlert.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2007-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef TEXT_INPUT_ALERT_H -#define TEXT_INPUT_ALERT_H - -#include -#include - -class TextInputAlert : public BAlert { -public: - TextInputAlert(const char *title, - const char *text, - const char *initial, /* initial input value */ - const char *button0Label, - const char *button1Label = NULL, - const char *button2Label = NULL, - button_width widthStyle = B_WIDTH_AS_USUAL, - alert_type type = B_INFO_ALERT); - virtual ~TextInputAlert(); - virtual void Show(); - - const char *Text() const { return fText->Text(); }; - BTextControl *TextControl() const { return fText; }; - - -private: - BTextControl *fText; -}; - -#endif /* TEXT_INPUT_ALERT_H */ - diff --git a/3rdparty/mmu_man/themes/ThemeAddonItem.cpp b/3rdparty/mmu_man/themes/ThemeAddonItem.cpp deleted file mode 100644 index dc059e17f2..0000000000 --- a/3rdparty/mmu_man/themes/ThemeAddonItem.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include "ThemeAddonItem.h" -#include "ThemeInterfaceView.h" -#include "ThemeManager.h" -#include "UITheme.h" -#include -#ifdef B_ZETA_VERSION -#include -#else -#define _T(v) v -#define B_LANGUAGE_CHANGED '_BLC' -#define B_PREF_APP_SET_DEFAULTS 'zPAD' -#define B_PREF_APP_REVERT 'zPAR' -#define B_PREF_APP_ADDON_REF 'zPAA' -#endif -#include -#include -#include -#include -#include -#include - -#define CTRL_OFF_X 40 -#define CTRL_OFF_Y 25 -#define CTRL_SPACING 10 - -//#define HAVE_PREF_BTN - - -ThemeAddonItem::ThemeAddonItem(BRect bounds, ThemeInterfaceView *iview, int32 id) - : ViewItem(bounds, "addonitem", B_FOLLOW_NONE, B_WILL_DRAW) -{ - ThemeManager *tman; - fId = id; - fIView = iview; - tman = iview->GetThemeManager(); - fAddonName = tman->AddonName(id); - BString tip(tman->AddonDescription(id)); -#ifdef B_BEOS_VERSION_DANO - SetToolTipText(tip.String()); - SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); - SetLowUIColor(B_UI_PANEL_BACKGROUND_COLOR); - SetHighUIColor(B_UI_PANEL_TEXT_COLOR); -#else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - SetHighColor(ui_color(B_PANEL_TEXT_COLOR)); -#endif - BMessage *apply = new BMessage(CB_APPLY); - apply->AddInt32("addon", id); - BMessage *save = new BMessage(CB_SAVE); - save->AddInt32("addon", id); - BMessage *prefs = new BMessage(BTN_PREFS); - prefs->AddInt32("addon", id); - fApplyBox = new BCheckBox(BRect(CTRL_OFF_X, CTRL_OFF_Y, CTRL_OFF_X+50, CTRL_OFF_Y+30), "apply", _T("Apply"), apply); - fApplyBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_SET_ALL)?B_CONTROL_ON:B_CONTROL_OFF); - fSaveBox = new BCheckBox(BRect(CTRL_OFF_X+50+CTRL_SPACING, CTRL_OFF_Y, CTRL_OFF_X+100+CTRL_SPACING, CTRL_OFF_Y+30), "save", _T("Save"), save); - fSaveBox->SetValue((tman->AddonFlags(id) & Z_THEME_ADDON_DO_RETRIEVE)?B_CONTROL_ON:B_CONTROL_OFF); -#ifdef B_BEOS_VERSION_DANO - fApplyBox->SetToolTipText(_T("Use this information from themes")); - fSaveBox->SetToolTipText(_T("Save this information to themes")); -#endif -#ifdef HAVE_PREF_BTN - fPrefsBtn = new BButton(BRect(CTRL_OFF_X+100+CTRL_SPACING*2, CTRL_OFF_Y, CTRL_OFF_X+150+CTRL_SPACING*2, CTRL_OFF_Y+30), "prefs", _T("Preferences"), prefs); -#ifdef B_BEOS_VERSION_DANO - fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic.")); -#endif -#endif - BFont fnt; - GetFont(&fnt); - fnt.SetSize(fnt.Size()+1); - fnt.SetFace(B_ITALIC_FACE); - SetFont(&fnt); -} - - -ThemeAddonItem::~ThemeAddonItem() -{ - delete fApplyBox; - delete fSaveBox; -#ifdef HAVE_PREF_BTN - delete fPrefsBtn; -#endif -} - - -void -ThemeAddonItem::DrawItem(BView *ownerview, BRect frame, bool complete) -{ - ViewItem::DrawItem(ownerview, frame, complete); -} - - -void -ThemeAddonItem::AttachedToWindow() -{ - AddChild(fApplyBox); - fApplyBox->SetTarget(fIView); - AddChild(fSaveBox); - fSaveBox->SetTarget(fIView); -#ifdef HAVE_PREF_BTN - AddChild(fPrefsBtn); - fPrefsBtn->SetTarget(fIView); -#endif - RelayoutButtons(); -} - - -void -ThemeAddonItem::MessageReceived(BMessage *message) -{ - switch (message->what) { - case B_LANGUAGE_CHANGED: - break; - } - BView::MessageReceived(message); -} - - -void -ThemeAddonItem::Draw(BRect) -{ - DrawString(fAddonName.String(), BPoint(10, 15/*Bounds().Height()/2*/)); -} - - -void -ThemeAddonItem::RelocalizeStrings() -{ - fApplyBox->SetLabel(_T("Apply")); - fSaveBox->SetLabel(_T("Save")); -#ifdef B_BEOS_VERSION_DANO - fApplyBox->SetToolTipText(_T("Use this information from themes")); - fSaveBox->SetToolTipText(_T("Save this information to themes")); -#endif -#ifdef HAVE_PREF_BTN - fPrefsBtn->SetLabel(_T("Preferences")); -#ifdef B_BEOS_VERSION_DANO - fPrefsBtn->SetToolTipText(_T("Run the preferences panel for this topic.")); -#endif -#endif - RelayoutButtons(); -} - - -void -ThemeAddonItem::RelayoutButtons() -{ - fApplyBox->ResizeToPreferred(); - fSaveBox->MoveTo(fApplyBox->Frame().right+CTRL_SPACING, fApplyBox->Frame().top); - fSaveBox->ResizeToPreferred(); -#ifdef HAVE_PREF_BTN - fPrefsBtn->MoveTo(fSaveBox->Frame().right+CTRL_SPACING, fSaveBox->Frame().top); - fPrefsBtn->ResizeToPreferred(); -#endif -} - - -int32 -ThemeAddonItem::AddonId() -{ - return fId; -} - diff --git a/3rdparty/mmu_man/themes/ThemeAddonItem.h b/3rdparty/mmu_man/themes/ThemeAddonItem.h deleted file mode 100644 index 399254fe2b..0000000000 --- a/3rdparty/mmu_man/themes/ThemeAddonItem.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _ADDON_ITEM_H_ -#define _ADDON_ITEM_H_ - -#include -#include -#include "ViewItem.h" -class ThemeInterfaceView; -class BCheckBox; -class BButton; - -class ThemeAddonItem : public ViewItem -{ -public: - ThemeAddonItem(BRect bounds, ThemeInterfaceView *iview, int32 id); - ~ThemeAddonItem(); - void DrawItem(BView *ownerview, BRect frame, bool complete = false); - void AttachedToWindow(); - void MessageReceived(BMessage *message); - void Draw(BRect updateRect); - - void RelocalizeStrings(); - void RelayoutButtons(); - int32 AddonId(); - -private: - int32 fId; - ThemeInterfaceView *fIView; - BString fAddonName; - BCheckBox *fApplyBox; - BCheckBox *fSaveBox; - BButton *fPrefsBtn; -}; - -#define CB_APPLY 'AiAp' -#define CB_SAVE 'AiSa' -#define BTN_PREFS 'AiPr' - -#endif // _ADDON_ITEM_H_ diff --git a/3rdparty/mmu_man/themes/ThemeImporter.cpp b/3rdparty/mmu_man/themes/ThemeImporter.cpp deleted file mode 100644 index be37d104fb..0000000000 --- a/3rdparty/mmu_man/themes/ThemeImporter.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2007-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * ThemeImporter class - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemeImporter.h" - - -#define DEBUG_TI -#ifdef DEBUG_TI -#define FENTRY PRINT(("ThemesImporter[%s]::%s()\n", Name(), __FUNCTION__)) -#else -#define FENTRY -#endif - - -ThemeImporter::ThemeImporter(const char *name) - :fName(name), - fFlags(0L) -{ - FENTRY; - fSettings.MakeEmpty(); -} - - -ThemeImporter::~ThemeImporter() -{ - FENTRY; -} - - -const char * -ThemeImporter::Name() -{ - return fName.String(); -} - - -const char * -ThemeImporter::Description() -{ - FENTRY; - return "No description yet."; -} - - -status_t -ThemeImporter::LoadSettings(BMessage &settings) -{ - FENTRY; - uint32 flags; - fSettings = settings; - if (fSettings.FindInt32("ta:flags", (int32 *)&flags) >= B_OK) - fFlags = flags; - return B_OK; -} - - -status_t -ThemeImporter::SaveSettings(BMessage &settings) -{ - FENTRY; - status_t err; - err = fSettings.ReplaceInt32("ta:flags", fFlags); - settings = fSettings; - return err; -} - - -void -ThemeImporter::SetFlags(uint32 flags) -{ - fFlags = flags; -} - - -uint32 -ThemeImporter::Flags() -{ - return fFlags; -} - - -status_t -ThemeImporter::FetchThemes() -{ - FENTRY; - return B_OK; -} - - -status_t -ThemeImporter::ImportNextTheme(BMessage **theme) -{ - FENTRY; - return ENOENT; -} - - -status_t -ThemeImporter::EndImports() -{ - FENTRY; - return B_OK; -} - diff --git a/3rdparty/mmu_man/themes/ThemeImporter.h b/3rdparty/mmu_man/themes/ThemeImporter.h deleted file mode 100644 index e2683d2d1d..0000000000 --- a/3rdparty/mmu_man/themes/ThemeImporter.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2007-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _THEME_IMPORTER_H -#define _THEME_IMPORTER_H -/* - * ThemeImporter class header - */ - -class BDirectory; -class BMessage; -class BString; - -namespace Z { -namespace ThemeManager { - -class ThemeManager; - -class ThemeImporter { -public: - ThemeImporter(const char *name); -virtual ~ThemeImporter(); - - /* presentation */ - -virtual const char *Name(); /* pretty name */ -virtual const char *Description(); /* tooltip... */ - // if you override, call it first -virtual status_t LoadSettings(BMessage &settings); - // if you override, call it last -virtual status_t SaveSettings(BMessage &settings); -void SetFlags(uint32 flags); -uint32 Flags(); - - /* Theme manipulation */ - -virtual status_t FetchThemes(); -virtual status_t ImportNextTheme(BMessage **theme); -virtual status_t EndImports(); - - /* */ - -protected: - -friend class Z::ThemeManager::ThemeManager; - BString fName; - uint32 fFlags; - BMessage fSettings; -}; - -} // ns ThemeManager -} // ns Z - -using namespace Z::ThemeManager; - -#endif /* _THEME_IMPORTER_H */ diff --git a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp b/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp deleted file mode 100644 index 3420c30180..0000000000 --- a/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp +++ /dev/null @@ -1,903 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef B_ZETA_VERSION -#include -#include -#include -#else -#define _T(v) v -#define B_PREF_APP_ENABLE_REVERT 'zPAE' -#define B_PREF_APP_SET_DEFAULTS 'zPAD' -#define B_PREF_APP_REVERT 'zPAR' -#define B_PREF_APP_ADDON_REF 'zPAA' -#endif -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include "UITheme.h" -#include "TextInputAlert.h" - -extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); - -/* gui */ -//#include "ThemeSelector.h" -#include "ThemeInterfaceView.h" -#include "ThemeItem.h" -#include "ThemeAddonItem.h" - -/* impl */ -#include "ThemeManager.h" - -const uint32 kThemeChanged = 'mThC'; -const uint32 kApplyThemeBtn = 'TmAp'; -const uint32 kCreateThemeBtn = 'TmCr'; -const uint32 kReallyCreateTheme = 'TmCR'; -const uint32 kSaveThemeBtn = 'TmSa'; -const uint32 kDeleteThemeBtn = 'TmDe'; -const uint32 kHidePreviewBtn = 'TmHP'; -const uint32 kThemeSelected = 'TmTS'; -const uint32 kMakeScreenshot = 'TmMS'; - -const uint32 kHideSSPulse = 'TmH1'; -const uint32 kShowSSPulse = 'TmH2'; - -static const uint32 skOnlineThemes = 'TmOL'; -static const char* skThemeURL = "http://www.zeta-os.com/cms/download.php?list.4"; - -#define HIDESS_OFFSET (Bounds().Width()/2 - 130) - - -// #pragma mark - refs_filter - - -filter_result -refs_filter(BMessage *message, BHandler **handler, BMessageFilter *filter) -{ - (void)handler; - (void)filter; - switch (message->what) { - case B_REFS_RECEIVED: - message->PrintToStream(); - break; - } - return B_DISPATCH_MESSAGE; -} - - -// #pragma mark - MyInvoker - - -class MyInvoker : public BInvoker { -public: - MyInvoker(BMessage* message, - const BHandler* handler, - const BLooper* looper = NULL); - virtual ~MyInvoker(); - virtual status_t Invoke(BMessage* message = NULL); - void SetOwner(TextInputAlert *alert); -private: - TextInputAlert* fOwner; -}; - - -MyInvoker::MyInvoker(BMessage* message, - const BHandler* handler, - const BLooper* looper) - : BInvoker(message, handler, looper) -{ -} - - -MyInvoker::~MyInvoker() -{ -} - - -status_t -MyInvoker::Invoke(BMessage* message) -{ - BMessage *out = Message(); - if (out) { - if (out->ReplaceString("text", fOwner->TextControl()->TextView()->Text()) == B_OK || - out->AddString("text", fOwner->TextControl()->TextView()->Text()) == B_OK) - return BInvoker::Invoke(); - } - return EINVAL; -} - - -void -MyInvoker::SetOwner(TextInputAlert *alert) -{ - fOwner = alert; -} - - -// #pragma mark - - - -//extern "C" BView *get_pref_view(const BRect& Bounds) -extern "C" BView * -themes_pref(const BRect& Bounds) -{ - return new ThemeInterfaceView(Bounds); -} - - -// #pragma mark - ThemeInterfaceView - - -ThemeInterfaceView::ThemeInterfaceView(BRect _bounds) - : BView(_bounds, "Themes", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), - fThemeManager(NULL), - fScreenshotPaneHidden(false), - fHasScreenshot(false), - fPopupInvoker(NULL), - fBox(NULL) -{ -/* - BMessageFilter *filt = new BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE, refs_filter); - be_app->Lock(); - be_app->AddCommonFilter(filt); - be_app->Unlock(); -*/ -} - - -ThemeInterfaceView::~ThemeInterfaceView() -{ - delete fPopupInvoker; - delete fThemeManager; -} - - -void -ThemeInterfaceView::AllAttached() -{ - BView::AllAttached(); - - fPopupInvoker = new MyInvoker(new BMessage(kReallyCreateTheme), this); -#ifdef B_BEOS_VERSION_DANO - SetViewUIColor(B_UI_PANEL_BACKGROUND_COLOR); -#else - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); -#endif - - fThemeManager = new ThemeManager; - - BRect frame = Bounds(); - frame.InsetBy(10.0, 10.0); - - // add the theme listview - BRect list_frame = frame; - list_frame.right = 130; - fThemeList = new BListView(list_frame.InsetByCopy(3.0, 3.0), "themelist"); - fThemeListSV = new BScrollView("themelistsv", fThemeList, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true); - AddChild(fThemeListSV); - fThemeList->SetSelectionMessage(new BMessage(kThemeSelected)); - fThemeList->SetInvocationMessage(new BMessage(kApplyThemeBtn)); - fThemeList->SetTarget(this); - - // buttons... - fNewBtn = new BButton(BRect(), "create", _T("New"), new BMessage(kCreateThemeBtn)); - AddChild(fNewBtn); - fNewBtn->SetTarget(this); - fNewBtn->ResizeToPreferred(); - fNewBtn->MoveTo(fThemeListSV->Frame().right + 15.0, frame.bottom - fNewBtn->Bounds().Height()); - BPoint lt = fNewBtn->Frame().LeftTop(); - lt.x = fNewBtn->Frame().right + 10.0; - - lt.x = fNewBtn->Frame().right + 10.0; - fSaveBtn = new BButton(BRect(), "save", _T("Save"), new BMessage(kSaveThemeBtn)); - AddChild(fSaveBtn); - fSaveBtn->SetTarget(this); - fSaveBtn->ResizeToPreferred(); - fSaveBtn->MoveTo(lt); - - lt.x = fSaveBtn->Frame().right + 10.0; - fDeleteBtn = new BButton(BRect(), "delete", _T("Delete"), new BMessage(kDeleteThemeBtn)); - AddChild(fDeleteBtn); - fDeleteBtn->SetTarget(this); - fDeleteBtn->ResizeToPreferred(); - fDeleteBtn->MoveTo(lt); - - // buttons... - fSetShotBtn = new BButton(BRect(), "makeshot", _T("Add Screenshot"), new BMessage(kMakeScreenshot), B_FOLLOW_RIGHT | B_FOLLOW_TOP); - AddChild(fSetShotBtn); - fSetShotBtn->SetTarget(this); - fSetShotBtn->ResizeToPreferred(); - - fShowSSPaneBtn = new BButton(BRect(), "hidess", _T("Show Options"), new BMessage(kHidePreviewBtn), B_FOLLOW_RIGHT | B_FOLLOW_TOP); - AddChild(fShowSSPaneBtn); - fShowSSPaneBtn->SetTarget(this); - fShowSSPaneBtn->ResizeToPreferred(); - - fApplyBtn = new BButton(BRect(), "apply", _T("Apply"), new BMessage(kApplyThemeBtn), B_FOLLOW_RIGHT | B_FOLLOW_TOP); - AddChild(fApplyBtn); - fApplyBtn->ResizeToPreferred(); - fApplyBtn->SetTarget(this); - - float widest = max_c(fSetShotBtn->Bounds().Width(), fShowSSPaneBtn->Bounds().Width()); - widest = max_c(widest, fApplyBtn->Bounds().Width()); - float height = fSetShotBtn->Bounds().Height(); - fSetShotBtn->ResizeTo(widest, height); - fShowSSPaneBtn->ResizeTo(widest, height); - fApplyBtn->ResizeTo(widest, height); - - fSetShotBtn->MoveTo(frame.right - widest, frame.top + 5.0); - fShowSSPaneBtn->MoveTo(frame.right - widest, fSetShotBtn->Frame().bottom + 10.0); - fApplyBtn->MoveTo(frame.right - widest, fNewBtn->Frame().top - fApplyBtn->Bounds().Height() - 10); - - // add the preview screen - BRect preview_frame(fNewBtn->Frame().left, fThemeListSV->Frame().top, frame.right - widest - 10, fNewBtn->Frame().top - 10); - - fBox = new BBox(preview_frame, "preview", B_FOLLOW_ALL); - AddChild(fBox); - fBox->SetLabel(_T("Preview")); - - preview_frame.InsetBy(10.0, 15.0); - 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"), B_FOLLOW_ALL); - fScreenshotNone->SetFontSize(20.0); - fScreenshotNone->SetAlignment(B_ALIGN_CENTER); - fBox->AddChild(fScreenshotNone); - fScreenshotNone->ResizeToPreferred(); - fScreenshotNone->ResizeTo(fBox->Bounds().Width() - 10.0, fScreenshotNone->Bounds().Height()); - fScreenshotNone->MoveTo(fBox->Bounds().left + 5.0, - ((fBox->Frame().Height() - fScreenshotNone->Frame().Height()) / 2.0)); - - // Theme hyperlink - /* - BStringView* hlink = new BStringView(BRect(), "theme_hyperlink", _T("More themes online"), new BMessage(skOnlineThemes), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); - AddChild(hlink); - hlink->SetClickText(hlink->GetText(), *this); - hlink->ResizeToPreferred(); - hlink->MoveTo(frame.right - hlink->Bounds().Width(), fNewBtn->Frame().top + 5); - */ - - // the addons list view - preview_frame = fBox->Frame(); - preview_frame.InsetBy(3.0, 3.0); - preview_frame.right -= B_V_SCROLL_BAR_WIDTH; - fAddonList = new BListView(preview_frame, "addonlist"); - fAddonListSV = new BScrollView("addonlistsv", fAddonList, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true); - AddChild(fAddonListSV); - fAddonList->SetSelectionMessage(new BMessage(kThemeSelected)); - fAddonList->SetInvocationMessage(new BMessage(kApplyThemeBtn)); - fAddonList->SetTarget(this); - fAddonListSV->Hide(); - - PopulateAddonList(); - PopulateThemeList(); -} - - -void -ThemeInterfaceView::MessageReceived(BMessage *_msg) -{ - ThemeManager *tman; - int32 value; - int32 id; - - switch(_msg->what) - { - case B_REFS_RECEIVED: - _msg->PrintToStream(); - break; - - case kMakeScreenshot: - AddScreenshot(); - break; - - case kThemeSelected: - ThemeSelected(); - break; - - case kHidePreviewBtn: - HideScreenshotPane(!IsScreenshotPaneHidden()); - break; - - case kApplyThemeBtn: - ApplySelected(); - break; - - case kCreateThemeBtn: - { - TextInputAlert *alert = new TextInputAlert("New name", "New Theme Name", "My Theme", "Ok"); - fPopupInvoker->SetOwner(alert); - alert->Go(fPopupInvoker); - break; - } - - case kReallyCreateTheme: - { - const char *name; - if (_msg->FindString("text", &name) < B_OK) - break; - CreateNew(name); - break; - } - - case kSaveThemeBtn: - SaveSelected(); - break; - - case kDeleteThemeBtn: - DeleteSelected(); - break; -#if 0 - case kColorsChanged: - case kGeneralChanged: - case kFontsChanged: - { - BMessenger msgr (Parent()); - msgr.SendMessage(B_PREF_APP_ENABLE_REVERT); - BMessage changes; - if (_msg->FindMessage("changes", &changes) == B_OK) - { - update_ui_settings(changes); - } - break; - } -#endif - case B_PREF_APP_SET_DEFAULTS: - { - ApplyDefaults(); - break; - } - - case B_PREF_APP_REVERT: - { - Revert(); - break; - } - - case B_PREF_APP_ADDON_REF: - { - break; - } - - case kThemeChanged: - { -/* BMessage data; - BMessage names; - get_ui_settings(&data, &names); - fColorSelector->Update(data); - fFontSelector->Refresh(); - fGeneralSelector->Refresh(data); -*/ - break; - } - - case CB_APPLY: - tman = GetThemeManager(); - _msg->PrintToStream(); - if (_msg->FindInt32("be:value", &value) < B_OK) - value = false; - if (_msg->FindInt32("addon", &id) < B_OK) - break; - //tman->SetAddonFlags(id, (tman->AddonFlags(id) & ~Z_THEME_ADDON_DO_SET_ALL)); - tman->SetAddonFlags(id, (tman->AddonFlags(id) & ~Z_THEME_ADDON_DO_SET_ALL) | (value?Z_THEME_ADDON_DO_SET_ALL:0)); - break; - - case CB_SAVE: - tman = GetThemeManager(); - _msg->PrintToStream(); - if (_msg->FindInt32("be:value", &value) < B_OK) - value = false; - if (_msg->FindInt32("addon", &id) < B_OK) - break; - tman->SetAddonFlags(id, (tman->AddonFlags(id) & ~Z_THEME_ADDON_DO_RETRIEVE) | (value?Z_THEME_ADDON_DO_RETRIEVE:0)); - break; - - case BTN_PREFS: - tman = GetThemeManager(); - if (_msg->FindInt32("addon", &id) < B_OK) - break; - tman->RunPreferencesPanel(id); - break; - - case kHideSSPulse: - break; - - case kShowSSPulse: - break; - - case skOnlineThemes: - be_roster->Launch( "application/x-vnd.Mozilla-Firefox", 1, (char **)&skThemeURL); - break; - - default: - { - BView::MessageReceived(_msg); - break; - } - } -} - - -ThemeManager* -ThemeInterfaceView::GetThemeManager() -{ - return fThemeManager; -} - - -void -ThemeInterfaceView::HideScreenshotPane(bool hide) -{ - BString lbl; - if (IsScreenshotPaneHidden() && hide) - return; - if (!IsScreenshotPaneHidden() && !hide) - return; - fScreenshotPaneHidden = hide; - - if (hide) - { - if (!fScreenshotPane->IsHidden()) - { - fBox->Hide(); - fAddonListSV->Show(); - } - fShowSSPaneBtn->SetLabel(_T("Show Preview")); - } - else - { - fShowSSPaneBtn->SetLabel(_T("Show Options")); - if (fScreenshotPane->IsHidden()) - { - fBox->Show(); - fAddonListSV->Hide(); - } - } - // TODO -} - - - -bool -ThemeInterfaceView::IsScreenshotPaneHidden() -{ - return fScreenshotPaneHidden; -} - - -void -ThemeInterfaceView::PopulateThemeList() -{ - int i; - BControl *c; - for (i = 0; ChildAt(i); i++) { - c = dynamic_cast(ChildAt(i)); - if (c) - c->SetEnabled(false); - } - thread_id tid = spawn_thread(_ThemeListPopulatorTh, "ThemeListPopulator", - B_LOW_PRIORITY, this); - resume_thread(tid); -} - - -int32 -ThemeInterfaceView::_ThemeListPopulatorTh(void *arg) -{ - ThemeInterfaceView *_this = (ThemeInterfaceView *)arg; - _this->_ThemeListPopulator(); - return 0; -} - - -void -ThemeInterfaceView::_ThemeListPopulator() -{ - status_t err; - int32 i, count; - int32 importer; - BString name; - ThemeItem *ti; - bool isro; - - ThemeManager* tman = GetThemeManager(); - tman->LoadThemes(); - - count = tman->CountThemes(); - - LockLooper(); - fThemeList->MakeEmpty(); - UnlockLooper(); - - // native themes - for (i = 0; i < count; i++) { - err = tman->ThemeName(i, name); - isro = tman->ThemeIsReadOnly(i); - if (err) - continue; - ti = new ThemeItem(i, name.String(), isro); - LockLooper(); - fThemeList->AddItem(ti); - UnlockLooper(); - } - - // for each importer - for (importer = 0; importer < tman->CountThemeImporters(); importer++) { - err = tman->ImportThemesFor(importer); - if (err < 0) - continue; - PRINT(("Imports for %s: %d\n", tman->ThemeImporterAt(importer), (tman->CountThemes() - count))); - if (tman->CountThemes() == count) - continue; // nothing found - // separator item - name = "Imported ("; - name << tman->ThemeImporterAt(importer) << ")"; - BStringItem *si = new BStringItem(name.String()); - si->SetEnabled(false); - LockLooper(); - fThemeList->AddItem(si); - UnlockLooper(); - // add new themes - count = tman->CountThemes(); - for (; i < count; i++) { - err = tman->ThemeName(i, name); - isro = true;//tman->ThemeIsReadOnly(i); - if (err) - continue; - ti = new ThemeItem(i, name.String(), isro); - LockLooper(); - fThemeList->AddItem(ti); - UnlockLooper(); - // rest a bit - snooze(1000); - } - } - // enable controls again - BControl *c; - LockLooper(); - for (i = 0; ChildAt(i); i++) { - c = dynamic_cast(ChildAt(i)); - if (c) - c->SetEnabled(true); - } - UnlockLooper(); -} - - -void -ThemeInterfaceView::PopulateAddonList() -{ - int32 i, count; - ViewItem *vi; - ThemeManager* tman = GetThemeManager(); - count = tman->CountAddons(); - fAddonList->MakeEmpty(); - for (i = 0; i < count; i++) { - vi = new ThemeAddonItem(BRect(0,0,200,52), this, i); - fAddonList->AddItem(vi); - } -} - - -status_t -ThemeInterfaceView::Revert() -{ - status_t err = B_OK; - ThemeManager* tman = GetThemeManager(); - - if (tman->CanRevert()) - err = tman->RestoreCurrent(); - if (err) - return err; - - return B_OK; -} - - -status_t -ThemeInterfaceView::ApplyDefaults() -{ - status_t err = B_OK; - ThemeManager* tman = GetThemeManager(); - - SetIsRevertable(); - - err = tman->ApplyDefaultTheme(); - return err; -} - - -status_t -ThemeInterfaceView::ApplySelected() -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *item; - // find selected theme - id = fThemeList->CurrentSelection(0); - if (id < 0) - return ENOENT; - item = dynamic_cast(fThemeList->ItemAt(id)); - if (!item) - return ENOENT; - id = item->ThemeId(); - if (id < 0) - return ENOENT; - SetIsRevertable(); - err = tman->ApplyTheme(id); - return err; -} - - -status_t -ThemeInterfaceView::CreateNew(const char *name) -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *ti; - BString n(name); - - id = tman->MakeTheme(); - if (id < 0) - return B_ERROR; - err = tman->SetThemeName(id, name); - if (err) - return err; - err = tman->ThemeName(id, n); - if (err) - return err; - err = tman->SaveTheme(id, true); - if (err) - return err; - ti = new ThemeItem(id, n.String(), false); - fThemeList->AddItem(ti); - return B_OK; -} - - -status_t -ThemeInterfaceView::SaveSelected() -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *item; - BMessage theme; - // find selected theme - id = fThemeList->CurrentSelection(0); - if (id < 0) - return B_OK; - item = dynamic_cast(fThemeList->ItemAt(id)); - if (!item) - return AError(__FUNCTION__, ENOENT); - if (item->IsReadOnly()) - return AError(__FUNCTION__, B_READ_ONLY_DEVICE); - id = item->ThemeId(); - if (id < 0) - return AError(__FUNCTION__, ENOENT); - - err = tman->UpdateTheme(id); - if (err) - return AError(__FUNCTION__, err); - err = tman->SaveTheme(id); - if (err) - return AError(__FUNCTION__, err); - //err = tman->ApplyTheme(theme); - return err; -} - - -status_t -ThemeInterfaceView::DeleteSelected() -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *item; - BMessage theme; - // find selected theme - id = fThemeList->CurrentSelection(0); - if (id < 0) - return B_OK; - item = dynamic_cast(fThemeList->ItemAt(id)); - if (!item) - return AError(__FUNCTION__, ENOENT); - if (item->IsReadOnly()) - return AError(__FUNCTION__, B_READ_ONLY_DEVICE); - id = item->ThemeId(); - if (id < 0) - return AError(__FUNCTION__, ENOENT); - // then apply - err = tman->DeleteTheme(id); - if (err) - return AError(__FUNCTION__, err); - fThemeList->RemoveItem(item); - delete item; - //err = tman->ApplyTheme(theme); - return err; -} - - -status_t -ThemeInterfaceView::AddScreenshot() -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *item; - BMessage theme; - // find selected theme - id = fThemeList->CurrentSelection(0); - if (id < 0) - return B_OK; - item = dynamic_cast(fThemeList->ItemAt(id)); - if (!item) - return AError(__FUNCTION__, ENOENT); - id = item->ThemeId(); - if (id < 0) - return AError(__FUNCTION__, ENOENT); - // then apply - err = tman->MakeThemeScreenShot(id); - if (err) - return AError(__FUNCTION__, err); - err = tman->SaveTheme(id); - if (err) - return AError(__FUNCTION__, err); - ThemeSelected(); // force reload of description for selected theme. - return err; -} - - -status_t -ThemeInterfaceView::ThemeSelected() -{ - status_t err; - ThemeManager* tman = GetThemeManager(); - int32 id; - ThemeItem *item; - BString desc; - BBitmap *sshot = NULL; - // find selected theme - id = fThemeList->CurrentSelection(0); - if (id < 0) - { - fScreenshotPane->ClearViewBitmap(); - fScreenshotPane->Invalidate(fScreenshotPane->Bounds()); - - HideScreenshotPane(false); - while(true == fScreenshotNone->IsHidden()) - fScreenshotNone->Show(); - - fScreenshotNone->SetText(_T("No Theme selected")); - return ENOENT; - } - - item = dynamic_cast(fThemeList->ItemAt(id)); - if (!item) - return ENOENT; - id = item->ThemeId(); - if (id < 0) - return ENOENT; - // then apply - - err = tman->ThemeScreenShot(id, &sshot); - if (err) - sshot = NULL; - if (sshot == NULL) - { - SetScreenshot(NULL); - fprintf(stderr, "ThemeManager: no screenshot; error 0x%08lx\n", err); - - HideScreenshotPane(false); - while(true == fScreenshotNone->IsHidden()) - fScreenshotNone->Show(); - - fScreenshotNone->SetText(_T("No Screenshot")); - return err; - } - - SetScreenshot(sshot); - while(false == fScreenshotNone->IsHidden()) - fScreenshotNone->Hide(); - - //err = tman->ApplyTheme(theme); - return err; -} - - -void -ThemeInterfaceView::SetIsRevertable() -{ - BMessenger msgr(Parent()); - msgr.SendMessage(B_PREF_APP_ENABLE_REVERT); -} - - -// PRIVATE: in libzeta for now. -extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); - - -void -ThemeInterfaceView::SetScreenshot(BBitmap *shot) -{ - // no screenshotpanel - if(NULL == fScreenshotPane) - return; - - fScreenshotPane->ClearViewBitmap(); - if (shot) - { -#ifdef __HAIKU__ - fScreenshotPane->SetViewBitmap(shot, shot->Bounds(), - fScreenshotPane->Bounds(), B_FOLLOW_ALL, B_FILTER_BITMAP_BILINEAR); - -#else - BBitmap scaled(fScreenshotPane->Bounds(), B_RGB32); - status_t err = ENOSYS; -#ifdef B_ZETA_VERSION - err = ScaleBitmap(*shot, scaled); -#endif - if( err == B_OK ) - { - fScreenshotPane->SetViewBitmap(&scaled); - } - else - { - fScreenshotPane->SetViewBitmap(shot, shot->Bounds(), - fScreenshotPane->Bounds()); - } -#endif - } - - fScreenshotPane->Invalidate(fScreenshotPane->Bounds()); - fHasScreenshot = (shot != NULL); - - if (shot) - delete shot; -} - - -status_t -ThemeInterfaceView::AError(const char *func, status_t err) -{ - BAlert *alert; - BString msg; - char *str = strerror(err); - msg << "Error in " << func << "() : " << str; - alert = new BAlert("error", msg.String(), _T("Ok")); - alert->Go(); - return err; /* pass thru */ -} - diff --git a/3rdparty/mmu_man/themes/ThemeInterfaceView.h b/3rdparty/mmu_man/themes/ThemeInterfaceView.h deleted file mode 100644 index 47663735c6..0000000000 --- a/3rdparty/mmu_man/themes/ThemeInterfaceView.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#include - -namespace Z { -namespace ThemeManager { - class ThemeManager; -} // ns ThemeManager -} // ns Z -using Z::ThemeManager::ThemeManager; - -class BBitmap; -class BSeparator; -class BBox; -class BListView; -class BButton; -class BScrollView; -class BTextView; -class BMessage; -class BStringView; -class MyInvoker; - -class ThemeInterfaceView : public BView -{ -public: - ThemeInterfaceView(BRect _bounds); - virtual ~ThemeInterfaceView(); - - virtual void AllAttached(); - virtual void MessageReceived(BMessage* _msg); - ThemeManager* GetThemeManager(); - - void HideScreenshotPane(bool hide); - bool IsScreenshotPaneHidden(); - - void PopulateThemeList(); - void PopulateAddonList(); - - status_t Revert(); - status_t ApplyDefaults(); - status_t ApplySelected(); - status_t CreateNew(const char *name); - status_t SaveSelected(); - status_t DeleteSelected(); - status_t AddScreenshot(); - - status_t ThemeSelected(); - - void SetIsRevertable(); - void SetScreenshot(BBitmap *shot); - status_t AError(const char *func, status_t err); - -private: - static int32 _ThemeListPopulatorTh(void *arg); - void _ThemeListPopulator(); - - ThemeManager* fThemeManager; - bool fScreenshotPaneHidden; - bool fHasScreenshot; - - MyInvoker* fPopupInvoker; - BScrollView* fThemeListSV; - BListView* fThemeList; - BButton* fApplyBtn; - BButton* fNewBtn; - BButton* fSaveBtn; - BButton* fDeleteBtn; - BButton* fSetShotBtn; - BButton* fShowSSPaneBtn; - BView* fScreenshotPane; - BStringView* fScreenshotNone; - BBox* fBox; - BScrollView* fAddonListSV; - BListView* fAddonList; -}; - -extern "C" BView *themes_pref(const BRect& Bounds); - -#define SSPANE_WIDTH 320 -#define SSPANE_HEIGHT 240 - - diff --git a/3rdparty/mmu_man/themes/ThemeItem.cpp b/3rdparty/mmu_man/themes/ThemeItem.cpp deleted file mode 100644 index f30997580f..0000000000 --- a/3rdparty/mmu_man/themes/ThemeItem.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include "ThemeItem.h" -#include -#include -#include - - -// #pragma mark - - - -ThemeItem::ThemeItem(int32 id, const char *name, bool ro) - : BStringItem(name) -{ - fCurrent = false; - fId = id; - fRo = ro; -} - - -ThemeItem::~ThemeItem() -{ -} - - -void -ThemeItem::DrawItem(BView *owner, BRect frame, bool complete) -{ - rgb_color col; - if (fCurrent || fRo) - owner->PushState(); - if (fCurrent) { - BFont f; - owner->GetFont(&f); - f.SetFace(B_BOLD_FACE); - owner->SetFont(&f); - } - if (fRo) { - col = owner->LowColor(); - if (col.red < 220) - col.red += 15; - else { - if (col.green > 20) - col.green -= 10; - if (col.blue > 20) - col.blue -= 10; - } - owner->SetLowColor(col); - owner->FillRect(frame, B_SOLID_LOW); - } - BStringItem::DrawItem(owner, frame, complete); - if (fCurrent || fRo) - owner->PopState(); -} - - -int32 -ThemeItem::ThemeId() -{ - return fId; -} - - -bool -ThemeItem::IsCurrent() -{ - return fCurrent; -} - - -void -ThemeItem::SetCurrent(bool set) -{ - fCurrent = set; -} - - -bool -ThemeItem::IsReadOnly() -{ - return fRo; -} - - -void -ThemeItem::SetReadOnly(bool set) -{ - fRo = set; -} - diff --git a/3rdparty/mmu_man/themes/ThemeItem.h b/3rdparty/mmu_man/themes/ThemeItem.h deleted file mode 100644 index 60381fbaaa..0000000000 --- a/3rdparty/mmu_man/themes/ThemeItem.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _THEME_ITEM_H_ -#define _THEME_ITEM_H_ - -#include - - -class ThemeItem : public BStringItem -{ -public: - ThemeItem(int32 id, const char *name, bool ro = false); - ~ThemeItem(); - void DrawItem(BView *owner, BRect frame, bool complete = false); - bool IsCurrent(); - void SetCurrent(bool set); - bool IsReadOnly(); - void SetReadOnly(bool set); - int32 ThemeId(); -private: - int32 fId; - bool fRo; - bool fCurrent; -}; - -#endif // _THEME_ITEM_H_ diff --git a/3rdparty/mmu_man/themes/ThemeManager.cpp b/3rdparty/mmu_man/themes/ThemeManager.cpp deleted file mode 100644 index 2dc50fffca..0000000000 --- a/3rdparty/mmu_man/themes/ThemeManager.cpp +++ /dev/null @@ -1,1489 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * ThemeManager class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "UITheme.h" -#include "ThemeManager.h" -#include "ThemesAddon.h" -#include "ThemeImporter.h" -#include "BeThemeImporter.h" -#include "MSThemeImporter.h" - -#include "ParseMessage.h" -#include "DumpMessage.h" - -extern status_t MakeScreenshot(BBitmap **here); - -// addons used in the prefs in Zeta (some were disabled) -//#define ZETA_ADDONS - -//#define DEBUG_TM -#ifdef DEBUG_TM -#define FENTRY PRINT(("ThemeManager::%s()\n", __FUNCTION__)) -#else -#define FENTRY -#endif - - -ThemeManager::ThemeManager() - : fAddonCount(0) -{ - FENTRY; - fSettings.MakeEmpty(); - fBackupTheme.MakeEmpty(); - fBackupTheme.what = 'null';//Z_THEME_MESSAGE_WHAT; - fSelectedTheme = -1; - fAddonList.MakeEmpty(); - fNames.MakeEmpty(); - LoadAddons(); - AddNames(fNames); - LoadSettings(); - - // XXX: add more - fThemeImporters.AddItem(new BeThemeImporter()); - fThemeImporters.AddItem(new MSThemeImporter()); - - // XXX test -/* - BMessage test('plop'); - BMessage *to; - test.AddString("plop-plip", "this is a test...\"line cont'd."); - test.PrintToStream(); - BFile tfile("/tmp/testmsg", B_READ_WRITE|B_CREATE_FILE); - DumpMessageToStream(&test, tfile, 0, NULL); - tfile.Seek(0LL, SEEK_SET); - ParseMessageFromStream(&to, tfile); - if (to) - to->PrintToStream(); - else - PRINT(("no to\n")); -*/ -} - - -ThemeManager::~ThemeManager() -{ - FENTRY; - SaveSettings(); - if (CountThemes()) - UnloadThemes(); - if (CountAddons()) - UnloadAddons(); -} - - -status_t -ThemeManager::LoadAddons() -{ - FENTRY; - ThemesAddon *ta; - BPath path; - BDirectory dir; - entry_ref ref; -#ifndef SINGLE_BINARY - uint32 addonFlags; - int dirwhich; - int32 i; - status_t err; - image_id img; - ThemesAddon *(*instantiate_func)(); -#endif - -#ifndef SINGLE_BINARY - for (dirwhich = 0; dirwhich < 2; dirwhich++) { - if (!dirwhich) /* find system settings dir */ - err = find_directory(B_BEOS_ADDONS_DIRECTORY, &path); - else /* find user settings dir */ - err = find_directory(B_USER_ADDONS_DIRECTORY, &path); - if (err) return err; - - path.Append(Z_THEMES_ADDON_FOLDER); - - err = dir.SetTo(path.Path()); - if (err) continue; - - err = dir.Rewind(); - if (err) continue; - - while ((err = dir.GetNextRef(&ref)) == B_OK) { - bool screwed = false; - BPath imgpath(&ref); - BString p(Z_THEMES_ADDON_FOLDER); - p << "/" << ref.name; - PRINT(("ThemeManager: trying to load_add_on(%s)\n", p.String())); - img = load_add_on(imgpath.Path()); - if (img < B_OK) - fprintf(stderr, "ThemeManager: load_add_on 0x%08lx\n", img); - if (img < B_OK) - continue; - err = get_image_symbol(img, "instantiate_themes_addon", - B_SYMBOL_TYPE_TEXT, (void **)&instantiate_func); - if (err) - fprintf(stderr, "ThemeManager: get_image_symbol 0x%08lx\n", err); - if (err) continue; - ta = instantiate_func(); - if (!ta) - fprintf(stderr, "ThemeManager: instantiate_themes_addon returned NULL\n"); - if (!ta) - continue; - ta->SetImageId(img); - /* check for existing names */ - for (i = 0; i < fAddonList.CountItems(); i++) { - ThemesAddon *a = AddonAt(i); - if (!a) - fprintf(stderr, "ThemeManager: screwed! addon@%ld null\n", i); - if (a->MessageName() && ta->MessageName() && - !strcmp(a->MessageName(), ta->MessageName())) { - fprintf(stderr, "ThemeManager: screwed! addon@%ld has same msgname\n", i); - screwed = true; - break; - } - if (a->Name() && ta->Name() && - !strcmp(a->Name(), ta->Name())) { - fprintf(stderr, "ThemeManager: screwed! addon@%ld has same name\n", i); - screwed = true; - break; - } - } - if (screwed) - continue; - /* add it to the list */ - fAddonList.AddItem((void *)ta); - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); - } - //if (err) return err; - } -#else - -#define ADDA(a) \ - if (ta) { \ - fAddonList.AddItem((void *)ta); \ - PRINT(("ThemeManager: Added addon %ld '%s', msgname '%s'\n", ta->ImageId(), ta->Name(), ta->MessageName())); \ - } - - - ta = instantiate_themes_addon_backgrounds(); - ADDA(ta); - ta = instantiate_themes_addon_beide(); - ADDA(ta); - ta = instantiate_themes_addon_deskbar(); - ADDA(ta); -#ifndef ZETA_ADDONS - ta = instantiate_themes_addon_eddie(); - ADDA(ta); -#endif - ta = instantiate_themes_addon_pe(); - ADDA(ta); - ta = instantiate_themes_addon_screensaver(); - ADDA(ta); -#ifndef ZETA_ADDONS - ta = instantiate_themes_addon_soundplay(); - ADDA(ta); -#endif - ta = instantiate_themes_addon_sounds(); - ADDA(ta); - ta = instantiate_themes_addon_terminal(); - ADDA(ta); -#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO) - ta = instantiate_themes_addon_ui_settings(); - ADDA(ta); -#endif -#ifndef ZETA_ADDONS - ta = instantiate_themes_addon_winamp_skin(); - ADDA(ta); -#endif - ta = instantiate_themes_addon_window_decor(); - ADDA(ta); -#endif - //if (err) return err; - fAddonCount = fAddonList.CountItems(); - PRINT(("ThemeManager: %ld addons loaded\n", fAddonCount)); - return B_OK; -} - - -status_t -ThemeManager::UnloadAddons() -{ - FENTRY; - int32 i; - ThemesAddon *ta; - image_id img; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - img = ta->ImageId(); - delete ta; -#ifndef SINGLE_BINARY - unload_add_on(img); -#endif - } - fAddonList.MakeEmpty(); - fAddonCount = 0; - return B_OK; -} - - -int32 -ThemeManager::FindAddon(const char *name) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!strcmp(ta->Name(), name)) - return i; - } - return -1; -} - - -int32 -ThemeManager::CountAddons() -{ - FENTRY; - return fAddonCount; -} - - -ThemesAddon * -ThemeManager::AddonAt(int32 addon) -{ - FENTRY; - if (addon < 0) - return NULL; - return (ThemesAddon *)fAddonList.ItemAt(addon); -} - - -const char * -ThemeManager::AddonName(int32 addon) -{ - FENTRY; - if (addon < 0) - return NULL; - return ((ThemesAddon *)fAddonList.ItemAt(addon))->Name(); -} - - -const char * -ThemeManager::AddonDescription(int32 addon) -{ - FENTRY; - if (addon < 0) - return NULL; - return ((ThemesAddon *)fAddonList.ItemAt(addon))->Description(); -} - - -const char *AddonName(int32 addon); - - -BView * -ThemeManager::OptionsView(int32 addon) -{ - FENTRY; - ThemesAddon *ta; - ta = AddonAt(addon); - if (ta) - return ta->OptionsView(); - return NULL; -} - - -status_t -ThemeManager::RunPreferencesPanel(int32 addon) -{ - FENTRY; - ThemesAddon *ta; - ta = AddonAt(addon); - if (ta) - return ta->RunPreferencesPanel(); - return B_OK; -} - - -status_t -ThemeManager::LoadSettings() -{ - FENTRY; - BMessage addonSettings; - int32 i; - ThemesAddon *ta; - uint32 addonFlags; - BPath path; - BFile sFile; - status_t err; - - /* load prefs */ - err = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (!err) { - path.Append(Z_THEME_MANAGER_SETTINGS_FILE); - err = sFile.SetTo(path.Path(), B_READ_ONLY); - if (!err) { - err = fSettings.Unflatten(&sFile); - } - } - - /* tell addons */ - for (i = 0; i < fAddonCount; i++) { - ta = AddonAt(i); - if (!ta || !ta->Name()) - continue; - if (fSettings.FindMessage(ta->Name(), &addonSettings) < B_OK) { - addonSettings.MakeEmpty(); - } - fSettings.RemoveName(ta->Name()); - if (addonSettings.FindInt32("ta:flags", (int32 *)&addonFlags) < B_OK) { - addonFlags = Z_THEME_ADDON_DO_SET_ALL | Z_THEME_ADDON_DO_RETRIEVE; - addonSettings.AddInt32("ta:flags", addonFlags); - } - ta->LoadSettings(addonSettings); - } - return B_OK; -} - - -status_t -ThemeManager::SaveSettings() -{ - FENTRY; - BMessage addonSettings; - int32 i; - ThemesAddon *ta; - BPath path; - BFile sFile; - status_t err; - - /* ask addons for their prefs */ - for (i = 0; i < fAddonCount; i++) { - ta = AddonAt(i); - if (!ta) - continue; - addonSettings.MakeEmpty(); - if (ta->SaveSettings(addonSettings) == B_OK) - fSettings.AddMessage(ta->Name(), &addonSettings); - } - - /* save the prefs */ - err = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (err) return err; - - path.Append(Z_THEME_MANAGER_SETTINGS_FILE); - err = sFile.SetTo(path.Path(), B_WRITE_ONLY|B_CREATE_FILE); - if (err) return err; - - err = fSettings.Flatten(&sFile); - if (err) return err; - - return B_OK; -} - - -void -ThemeManager::SetAddonFlags(int32 addon, uint32 flags) -{ - FENTRY; - ThemesAddon *ta; - ta = AddonAt(addon); - if (ta) - ta->SetAddonFlags(flags); -} - - -uint32 -ThemeManager::AddonFlags(int32 addon) -{ - FENTRY; - ThemesAddon *ta; - ta = AddonAt(addon); - if (ta) - return ta->AddonFlags(); - return 0L; -} - - -status_t -ThemeManager::AddNames(BMessage &names) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - err = ta->AddNames(names); - if (err) - gerr = err; - } - return gerr; -} - - -status_t -ThemeManager::GetNames(BMessage &names) -{ - FENTRY; - names = fNames; - return B_OK; -} - - -status_t -ThemeManager::LoadThemes() -{ - FENTRY; - int dirwhich; - BPath path; - BDirectory dir; - entry_ref ref; - status_t err; - - for (dirwhich = 0; dirwhich < 2; dirwhich++) { - if (!dirwhich) /* find system settings dir */ - err = find_directory(B_BEOS_ETC_DIRECTORY, &path); - else /* find user settings dir */ - err = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (err) return err; - - err = dir.SetTo(path.Path()); - if (err) return err; - BEntry ent; - if (dir.FindEntry(Z_THEMES_FOLDER_NAME, &ent) < B_OK) { - dir.CreateDirectory(Z_THEMES_FOLDER_NAME, NULL); - } - - path.Append(Z_THEMES_FOLDER_NAME); - - err = dir.SetTo(path.Path()); - if (err) return err; - - err = dir.Rewind(); - if (err) return err; - - while ((err = dir.GetNextRef(&ref)) == B_OK) { - BPath themepath(&ref); - BDirectory tdir(themepath.Path()); - err = tdir.InitCheck(); - if (err) /* not a dir */ - continue; - err = LoadTheme(themepath.Path()); - } - } - return B_OK; -} - - -status_t -ThemeManager::AddTheme(BMessage *theme) -{ - FENTRY; - BString name; - - if (!theme) - return EINVAL; -/* err = ThemeName(*theme, name); - if (err) - return err;*/ - if (FindTheme(name.String()) >= 0) - return B_FILE_EXISTS; - fThemeList.AddItem(theme); - return B_OK; -} - - -status_t -ThemeManager::UnloadThemes() -{ - FENTRY; - int32 i; - BMessage *theme; - - for (i = 0; i < CountThemes(); i++) { - theme = (BMessage *)fThemeList.ItemAt(i); - delete theme; - } - fThemeList.MakeEmpty(); - return B_OK; -} - - -int32 -ThemeManager::CountThemes() -{ - FENTRY; - - return fThemeList.CountItems(); -} - - -BMessage * -ThemeManager::ThemeAt(int32 id, bool allowbackup) -{ - FENTRY; - BMessage *theme; - - if (id < 0) { - if (allowbackup && (id == THEME_ID_BACKUP) && (!fBackupTheme.IsEmpty())) - return &fBackupTheme; - return NULL; - } - theme = (BMessage *)fThemeList.ItemAt(id); - return theme; -} - - -status_t -ThemeManager::SetThemeAt(int32 id, BMessage ©from) -{ - FENTRY; - BMessage *theme; - BMessage finfos; - BMessage tinfos; - BString s, s2; - int32 i; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return ENOENT; - copyfrom.FindMessage(Z_THEME_INFO_MESSAGE, &finfos); - copyfrom.RemoveName(Z_THEME_INFO_MESSAGE); - copyfrom.RemoveName(Z_THEME_LOCATION); - theme->FindMessage(Z_THEME_INFO_MESSAGE, &tinfos); - tinfos.RemoveName(Z_THEME_MODULE_TAG); - for (i = 0; finfos.FindString(Z_THEME_MODULE_TAG, i, &s); i++) - tinfos.AddString(Z_THEME_MODULE_TAG, s); - *theme = copyfrom; - return B_OK; -} - - -int32 -ThemeManager::FindTheme(const char *name) -{ - FENTRY; - int32 i; - BMessage *theme; - BString tname; - - for (i = 0; i < CountThemes(); i++) { - theme = (BMessage *)fThemeList.ItemAt(i); - if (!theme) - continue; - if (ThemeName(i, tname) < B_OK) - return -1L; - if (!strcmp(tname.String(), name)) - return i; - } - return -1L; -} - - -status_t -ThemeManager::CurrentTheme(BMessage ©to) -{ - FENTRY; - - if (!strlen(fCurrentThemeName.String())) - return B_NAME_NOT_FOUND; - if (!fBackupTheme.IsEmpty()) { - copyto = fBackupTheme; - return B_OK; - } -/* i = FindTheme(fCurrentThemeName.String()); - if (i < 0) - return B_NAME_NOT_FOUND; - err = ThemeAt(i, fBackupTheme); - if (err) - return err; - copyto = fBackupTheme;*/ - // FIXME - return B_OK; -} - - -status_t -ThemeManager::ApplyTheme(int32 id, uint32 flags) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - BMessage *theme = ThemeAt(id); - if (!theme) - return EINVAL; - err = BackupCurrent(); - /*if (err) - return err;*/ - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - PRINT(("ThemeManager: addon[%s]->Flags = 0x%08lx\n", ta->Name(), ta->AddonFlags())); - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - continue; - err = ta->ApplyTheme(*theme, flags); - if (err) - gerr = err; - } - return gerr; -} - - -int32 -ThemeManager::MakeTheme(uint32 flags) -{ - FENTRY; - int32 i, id; - ThemesAddon *ta; - status_t err, gerr = B_OK; - BMessage *theme; - theme = new BMessage(Z_THEME_MESSAGE_WHAT); - fThemeList.AddItem(theme); - id = fThemeList.IndexOf(theme); - if (id < 0) { - delete theme; - return -1; - } - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_RETRIEVE)) - continue; - err = ta->MakeTheme(*theme, flags); - if (err) - gerr = err; - } - return id; -} - - -status_t -ThemeManager::UpdateTheme(int32 id, uint32 flags) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - BMessage *theme; - BMessage infos; - BString loc; - if ((id < 0) || (id >= fThemeList.CountItems())) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return -1; - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &infos); - err = theme->FindString(Z_THEME_LOCATION, &loc); - if (err) - loc = ""; - theme->MakeEmpty(); - err = theme->AddMessage(Z_THEME_INFO_MESSAGE, &infos); - err = theme->AddString(Z_THEME_LOCATION, loc.String()); - if (err) - return err; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_RETRIEVE)) - continue; - err = ta->MakeTheme(*theme, flags); - if (err) - gerr = err; - } - return B_OK;//gerr; -} - - -status_t -ThemeManager::DeleteTheme(int32 id) -{ - status_t err; - BMessage *theme; - BString loc; - if ((id < 0) || (id >= fThemeList.CountItems())) - return EINVAL; - theme = (BMessage *)fThemeList.RemoveItem(id); - fThemeList.AddItem(NULL, id); /* keep the place occupied */ - if (!theme) - return -1; - - err = theme->FindString(Z_THEME_LOCATION, &loc); - if (!err) { - // move the files to trash... - BEntry ent(loc.String()); - if (ent.InitCheck() == B_OK) { - BPath trash; - err = find_directory(B_TRASH_DIRECTORY, &trash); - if (!err) { - BDirectory trashDir(trash.Path()); - if (trashDir.InitCheck() == B_OK) { - BNode nod(&ent); - if (nod.InitCheck() == B_OK) { - BPath path; - err = ent.GetPath(&path); - if (!err) { - nod.WriteAttr("_trk/original_path", B_STRING_TYPE, 0LL, path.Path(), strlen(path.Path())+1); - } - } - err = ent.MoveTo(&trashDir, NULL); // don't clober - if (err) { - BString newname("Theme-renamed-"); - newname << system_time(); - err = ent.MoveTo(&trashDir, newname.String(), true); - } - } - } - } - } - - if (id == fSelectedTheme) - fSelectedTheme = -1; - delete theme; - return B_OK; -} - - -int32 -ThemeManager::SelectedTheme() -{ - BMessage *theme; - theme = ThemeAt(fSelectedTheme); - if (!theme) - return -1; - // XXX: should really check the diff with current. - return fSelectedTheme; -} - - -status_t -ThemeManager::ApplyDefaultTheme(uint32 flags) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - err = BackupCurrent(); - if (err) - return err; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - continue; - err = ta->ApplyDefaultTheme(flags); - if (err) - gerr = err; - } - return gerr; -} - - -status_t -ThemeManager::BackupCurrent() -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - fBackupTheme.MakeEmpty(); - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_RETRIEVE)) - continue; - err = ta->BackupCurrent(fBackupTheme); - if (err) - gerr = err; - } - return gerr; -} - - -status_t -ThemeManager::RestoreCurrent() -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - if (fBackupTheme.IsEmpty()) - return ENOENT; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - continue; - err = ta->RestoreCurrent(fBackupTheme); - if (err) - gerr = err; - } - fBackupTheme.MakeEmpty(); - return gerr; -} - - -bool -ThemeManager::CanRevert() -{ - FENTRY; - return !fBackupTheme.IsEmpty(); -} - - -status_t -ThemeManager::CompareToCurrent(BMessage &theme) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err; - - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_RETRIEVE)) - continue; - err = ta->CompareToCurrent(theme); - if (err) - return err; - } - return B_OK; -} - - -status_t -ThemeManager::InstallFiles(BMessage &theme, BDirectory &folder) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - continue; - err = ta->InstallFiles(theme, folder); - if (err) - gerr = err; - } - return gerr; -} - - -status_t -ThemeManager::BackupFiles(BMessage &theme, BDirectory &folder) -{ - FENTRY; - int32 i; - ThemesAddon *ta; - status_t err, gerr = B_OK; - for (i = 0; i < fAddonCount; i++) { - ta = (ThemesAddon *)fAddonList.ItemAt(i); - if (!ta) - continue; - if (!(ta->AddonFlags() & Z_THEME_ADDON_DO_RETRIEVE)) - continue; - err = ta->BackupFiles(theme, folder); - if (err) - gerr = err; - } - return gerr; -} - - -status_t -ThemeManager::SaveTheme(int32 id, bool excl) -{ - FENTRY; - status_t err; - BString name, fname; - BPath path; - BDirectory dir; - BDirectory tdir; - BFile tfile; - BMessage names; - BString location; - BMessage *theme; - theme = ThemeAt(id); - if (!theme) - return EINVAL; - err = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if (err) return err; - path.Append(Z_THEMES_FOLDER_NAME); - err = dir.SetTo(path.Path()); - if (err) return err; - err = ThemeName(id, name); - if (err) return err; - fname = name; - NormalizeThemeFolderName(fname); - - err = ThemeLocation(id, location); - if (!err) { - if (location.FindFirst("/boot/beos") >= 0) { - PRINT(("trying to save theme '%s' to system dir!\n", name.String())); - return B_PERMISSION_DENIED; - } - } - path.Append(fname.String()); - err = theme->ReplaceString(Z_THEME_LOCATION, path.Path()); - if (err) - err = theme->AddString(Z_THEME_LOCATION, path.Path()); - - if (dir.CreateDirectory(fname.String(), NULL) < B_OK) { - if (excl) - return B_FILE_EXISTS; - } - err = tdir.SetTo(&dir, fname.String()); - if (err) return err; - err = tdir.CreateFile(Z_THEME_FILE_NAME, &tfile); - if (err) return err; - - BMessage tosave(*theme); - err = tosave.RemoveName(Z_THEME_LOCATION); - err = GetNames(names); - - err = DumpMessageToStream(&tosave, tfile, 0, &names); - if (err) return err; - return B_OK; -} - - -status_t -ThemeManager::PackageTheme(BMessage &theme) -{ - PRINT(("UNIMPLEMENTED %s()\n", __FUNCTION__)); - - (void)theme; - return B_OK; -} - - -status_t -ThemeManager::LoadTheme(const char *path, BMessage **to) -{ - status_t err; - BDirectory dir; - BFile f; - BMessage *theme; -#ifdef DEBUG_TM - PRINT(("ThemeManager::%s(%s)\n", __FUNCTION__, path)); -#endif - - err = dir.SetTo(path); - if (err) - fprintf(stderr, "ThemeManager:: BDirectory::SetTo 0x%08lx\n", err); - if (err) { /* not a dir, check for a zip */ - // TODO - // unzip + recursive call - return err; - } - err = f.SetTo(&dir, Z_THEME_FILE_NAME, B_READ_ONLY); - if (err) - fprintf(stderr, "ThemeManager:: BFile::SetTo 0x%08lx\n", err); - if (err) - return err; - err = ParseMessageFromStream(&theme, f); - if (err) - fprintf(stderr, "ThemeManager:: ParseMessageFromStream 0x%08lx\n", err); - if (err) - return err; - err = theme->RemoveName(Z_THEME_LOCATION); - err = theme->AddString(Z_THEME_LOCATION, path); - //theme->PrintToStream(); - err = AddTheme(theme); - if (err) - fprintf(stderr, "ThemeManager:: AddTheme 0x%08lx\n", err); - if (err) - delete theme; - if (!err && to) - *to = theme; - return err; -} - - -int32 -ThemeManager::CountThemeImporters() -{ - FENTRY; - return fThemeImporters.CountItems(); -} - - -const char * -ThemeManager::ThemeImporterAt(int32 index) -{ - FENTRY; - ThemeImporter *importer; - importer = static_cast(fThemeImporters.ItemAt(index)); - if (!importer) - return NULL; - return importer->Name(); -} - - -status_t -ThemeManager::ImportThemesFor(int32 index, const char *path) -{ - FENTRY; - status_t err; - BString m; - ThemeImporter *importer; - BMessage msg; - BMessage *theme; - - importer = static_cast(fThemeImporters.ItemAt(index)); - if (!importer) - return ENOENT; - - err = importer->FetchThemes(); - if (err < 0) - return err; - while ((err = importer->ImportNextTheme(&theme)) != ENOENT) { - if (err >= 0) - AddTheme(theme); - } - importer->EndImports(); - - return B_OK; -} - - -bool -ThemeManager::ThemeHasInfoFor(int32 id, BString &module) -{ - FENTRY; - status_t err; - BString m; - int32 i; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) - return false; - for (i = 0; msg.FindString(Z_THEME_MODULE_TAG, i, &m) == B_OK; i++) - if (m == module) - return true; - return false; -} - - -status_t -ThemeManager::ThemeName(int32 id, BString ©to) -{ - FENTRY; - status_t err; - BString s; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) - return err; - err = msg.FindString(Z_THEME_NAME, &s); - if (err) - return err; - copyto = s; - return B_OK; -} - - -status_t -ThemeManager::ThemeLocation(int32 id, BString ©to) -{ - FENTRY; - status_t err; - BString s; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindString(Z_THEME_LOCATION, &s); - if (err) - return err; - copyto = s; - return B_OK; -} - - -bool -ThemeManager::ThemeIsReadOnly(int32 id) -{ - FENTRY; - status_t err; - BString s; - BMessage *theme; - - if (id < 0) - return true; - - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return true; - // imported themes are always RO for now - if (theme->FindString(Z_THEME_IMPORTER, &s) >= B_OK) - return true; - - err = ThemeLocation(id, s); - if (err) - return true; - if (s.FindFirst("/boot/beos") >= 0) - return true; - return false; -} - - -status_t -ThemeManager::ThemeDescription(int32 id, BString ©to) -{ - FENTRY; - status_t err; - BString s; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) - return err; - err = msg.FindString(Z_THEME_DESCRIPTION, &s); - if (err) - return err; - copyto = s; - return B_OK; -} - - -status_t -ThemeManager::ThemeKeywords(int32 id, BString ©to) -{ - FENTRY; - status_t err; - BString s; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) - return err; - err = msg.FindString(Z_THEME_KEYWORDS, &s); - if (err) - return err; - copyto = s; - return B_OK; -} - - -status_t -ThemeManager::ThemeScreenShot(int32 id, BBitmap **copyto) -{ - FENTRY; - status_t err; - BString s, loc; - BMessage msg; - BEntry ent; - entry_ref ref; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - if (!copyto) - return EINVAL; - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) - return err; - err = msg.FindString(Z_THEME_SCREENSHOT_FILENAME, &s); - if (err) - return err; - // TODO - err = ThemeLocation(id, loc); - if (err) - return err; - loc << "/" << s; - err = ent.SetTo(loc.String()); - if (err) - return err; - err = ent.GetRef(&ref); - if (err) - return err; - *copyto = BTranslationUtils::GetBitmap(&ref); - if (!(*copyto)) - return ENOENT; - return B_OK; -} - - -status_t -ThemeManager::SetThemeHasInfoFor(int32 id, BString module) -{ - FENTRY; - status_t err; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) { - msg.MakeEmpty(); - theme->AddMessage(Z_THEME_INFO_MESSAGE, &msg); - } - err = theme->AddString(Z_THEME_MODULE_TAG, module); - if (err) - return err; - err = theme->ReplaceMessage(Z_THEME_INFO_MESSAGE, &msg); - return err; -} - - -status_t -ThemeManager::SetThemeName(int32 id, BString name) -{ - FENTRY; - status_t err; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) { - msg.MakeEmpty(); - theme->AddMessage(Z_THEME_INFO_MESSAGE, &msg); - } - err = msg.ReplaceString(Z_THEME_NAME, name); - if (err) - err = msg.AddString(Z_THEME_NAME, name); - if (err) - return err; - err = theme->ReplaceMessage(Z_THEME_INFO_MESSAGE, &msg); - return err; -} - - -status_t -ThemeManager::SetThemeDescription(int32 id, BString description) -{ - FENTRY; - status_t err; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) { - msg.MakeEmpty(); - theme->AddMessage(Z_THEME_INFO_MESSAGE, &msg); - } - err = msg.ReplaceString(Z_THEME_DESCRIPTION, description); - if (err) - err = msg.AddString(Z_THEME_DESCRIPTION, description); - if (err) - return err; - err = theme->ReplaceMessage(Z_THEME_INFO_MESSAGE, &msg); - return err; -} - - -status_t -ThemeManager::SetThemeKeywords(int32 id, BString keywords) -{ - FENTRY; - status_t err; - BMessage msg; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) { - msg.MakeEmpty(); - theme->AddMessage(Z_THEME_INFO_MESSAGE, &msg); - } - err = msg.ReplaceString(Z_THEME_KEYWORDS, keywords); - if (err) - err = msg.AddString(Z_THEME_KEYWORDS, keywords); - if (err) - return err; - err = theme->ReplaceMessage(Z_THEME_INFO_MESSAGE, &msg); - return err; -} - - -status_t -ThemeManager::SetThemeScreenShot(int32 id, BBitmap *bitmap) -{ - FENTRY; - status_t err; - BMessage msg; - BString name; - BString themepath; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - // TODO - err = theme->FindMessage(Z_THEME_INFO_MESSAGE, &msg); - if (err) { - msg.MakeEmpty(); - theme->AddMessage(Z_THEME_INFO_MESSAGE, &msg); - } - err = ThemeLocation(id, themepath); - if (err) - return err; - err = msg.FindString(Z_THEME_SCREENSHOT_FILENAME, &name); - if (!err) { - BPath spath(themepath.String()); - spath.Append(name.String()); - BEntry ent(spath.Path()); - if (ent.InitCheck() == B_OK) - ent.Remove(); - } - - name = "screenshot.png"; - err = msg.ReplaceString(Z_THEME_SCREENSHOT_FILENAME, name); - if (err) - err = msg.AddString(Z_THEME_SCREENSHOT_FILENAME, name); - if (err) - return err; - - // save the BBitmap to a png - BPath spath(themepath.String()); - spath.Append(name.String()); - BFile shotfile(spath.Path(), B_WRITE_ONLY|B_CREATE_FILE); - if (shotfile.InitCheck() != B_OK) - return shotfile.InitCheck(); - BTranslatorRoster *troster = BTranslatorRoster::Default(); - BBitmapStream bmstream(bitmap); - err = troster->Translate(&bmstream, NULL, NULL, &shotfile, 'PNG '/* XXX: hack, should find by mime type */); - if (err) - return err; - - err = theme->ReplaceMessage(Z_THEME_INFO_MESSAGE, &msg); - msg.PrintToStream(); - return err; -} - - -status_t -ThemeManager::MakeThemeScreenShot(int32 id) -{ - FENTRY; - status_t err; - BBitmap *bmp = NULL; - BMessage *theme; - - if (id < 0) - return EINVAL; - theme = (BMessage *)fThemeList.ItemAt(id); - if (!theme) - return EINVAL; - - // TODO - err = MakeScreenshot(&bmp); - if (err) - return err; - err = SetThemeScreenShot(id, bmp); - - return err; -} - - -void -ThemeManager::NormalizeThemeFolderName(BString &name) -{ - FENTRY; - name.RemoveSet("\"\\'/&:*~#|`^"); -} - diff --git a/3rdparty/mmu_man/themes/ThemeManager.h b/3rdparty/mmu_man/themes/ThemeManager.h deleted file mode 100644 index 5093d15585..0000000000 --- a/3rdparty/mmu_man/themes/ThemeManager.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _THEMEMANAGER_H_ -#define _THEMEMANAGER_H_ - -/* - * ThemeManager class header - */ - -#include -#include -#include - -#include "UITheme.h" - -/* backup of current settings when applying a theme */ -#define THEME_ID_BACKUP -1 - -namespace Z { -namespace ThemeManager { - class ThemeManager; - class ThemesAddon; -} // ns ThemeManager -} // ns Z -using Z::ThemeManager::ThemeManager; -using Z::ThemeManager::ThemesAddon; - -class BDirectory; -class BBitmap; -class BView; - -namespace Z { -namespace ThemeManager { - -class ThemeManager { -public: - ThemeManager(); -virtual ~ThemeManager(); - - /* addon list */ -status_t LoadAddons(); -status_t UnloadAddons(); -int32 FindAddon(const char *name); -int32 CountAddons(); -ThemesAddon *AddonAt(int32 addon); - - /* addon presentation */ - -const char *AddonName(int32 addon); -const char *AddonDescription(int32 addon); -BView *OptionsView(int32 addon); -status_t RunPreferencesPanel(int32 addon); -status_t LoadSettings(); -status_t SaveSettings(); -void SetAddonFlags(int32 addon, uint32 flags); -uint32 AddonFlags(int32 addon); - /* add pretty names */ -status_t AddNames(BMessage &names); -status_t GetNames(BMessage &names); - - /* Theme enumeration - INTERNAL */ - -status_t LoadThemes(); -status_t AddTheme(BMessage *theme); -status_t UnloadThemes(); /* just for cleanup */ -int32 CountThemes(); -BMessage *ThemeAt(int32 id, bool allowbackup = false); -status_t SetThemeAt(int32 id, BMessage ©from); -int32 FindTheme(const char *name); -status_t CurrentTheme(BMessage ©to); - - /* Theme manipulation */ - -status_t ApplyTheme(int32 id, uint32 flags=UI_THEME_SETTINGS_SET_ALL); -int32 MakeTheme(uint32 flags=UI_THEME_SETTINGS_RETRIEVE); -status_t UpdateTheme(int32 id, uint32 flags=UI_THEME_SETTINGS_RETRIEVE); -status_t DeleteTheme(int32 id); -int32 SelectedTheme(); - -status_t ApplyDefaultTheme(uint32 flags=UI_THEME_SETTINGS_SET_ALL); - -status_t BackupCurrent(); -status_t RestoreCurrent(); -bool CanRevert(); -status_t CompareToCurrent(BMessage &theme); - - /* Theme installation */ - -status_t InstallFiles(BMessage &theme, BDirectory &folder); -status_t BackupFiles(BMessage &theme, BDirectory &folder); - - /* save to disk */ -status_t SaveTheme(int32 id, bool excl = false); - /* make a zip */ -status_t PackageTheme(BMessage &theme); - /* load from disk (zip / folder) */ -status_t LoadTheme(const char *path, BMessage **to=NULL); - - /* Theme importation */ -int32 CountThemeImporters(); -const char *ThemeImporterAt(int32 index); -status_t ImportThemesFor(int32 index, const char *path=NULL); - - /* Theme properties */ - -bool ThemeHasInfoFor(int32 id, BString &module); -status_t ThemeName(int32 id, BString ©to); -status_t ThemeLocation(int32 id, BString ©to); -bool ThemeIsReadOnly(int32 id); -status_t ThemeDescription(int32 id, BString ©to); -status_t ThemeKeywords(int32 id, BString ©to); -status_t ThemeScreenShot(int32 id, BBitmap **copyto); - -status_t SetThemeHasInfoFor(int32 id, BString module); -status_t SetThemeName(int32 id, BString name); -status_t SetThemeDescription(int32 id, BString description); -status_t SetThemeKeywords(int32 id, BString keywords); -status_t SetThemeScreenShot(int32 id, BBitmap *bitmap); - /* create the screenshot from current and add it */ -status_t MakeThemeScreenShot(int32 id); - - /* utilities */ - - /* remove all bad chars */ -void NormalizeThemeFolderName(BString &name); - -private: - BMessage fSettings; - BMessage fBackupTheme; /* as in last selected */ - BString fCurrentThemeName; - int32 fSelectedTheme; - BList fAddonList; - int32 fAddonCount; - BList fThemeList; - BMessage fNames; /* pretty names for fields */ - BList fThemeImporters; -}; - -} // ns ThemeManager -} // ns Z - -#define Z_THEME_MANAGER_SETTINGS_FILE "x-vnd.yT-ThemeManager" - -using namespace Z::ThemeManager; - - -#endif // _THEMEMANAGER_H_ diff --git a/3rdparty/mmu_man/themes/Themes.rdef b/3rdparty/mmu_man/themes/Themes.rdef deleted file mode 100644 index 70106ba91c..0000000000 --- a/3rdparty/mmu_man/themes/Themes.rdef +++ /dev/null @@ -1,98 +0,0 @@ - -resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.mmu_man-Themes"; - -resource app_version { - major = 0, - middle = 1, - minor = 0, - variety = B_APPV_ALPHA, - internal = 0, - short_info = "Themes", - long_info = "Themes ©2000-2008 François Revol." -}; - -resource app_flags B_SINGLE_LAUNCH; - -resource(1, "BEOS:FILE_TYPES") message; - -#ifdef HAIKU_TARGET_PLATFORM_HAIKU - -resource vector_icon { - $"6E636966050500020106023AB09C387275BA11FB3C46904852304A0DE300FFE7" - $"DCFFE29C7A020002043C233C3AF073BE44203F4BD14A79EB417FF50DF1F6FFCB" - $"7B8288AC67D4F2F7F9B1FFB4BDD79704016B05FF0C0609BF2E034C524C525052" - $"5850C86DC7735C4A60406044603C5E3A5C3CCB50BFBA5E3ECA9EC11F584A5054" - $"4EC819C490C74DC62806062F0F323A3A3C3C3A4034BF59354232423044423644" - $"32C040BC5A383E3E3E383E0607A22B3058363A5C405A445A445A485A46503A48" - $"0204B44B2FB5172DB37F31B3E53AB3E538B3E53CB99342B8C744BA5F40B99335" - $"BA5F37B8C7330204BEA73CBF733ABDDB3EBEA748BE26C1EDBF734CC4D450C408" - $"52C564C58FC4D442C5A044C408400204363EBD353E323E2C4C28483050BDDBC4" - $"3BBD0FC507BE2CC3EABD60C20FBD47C305BD86C096060BEEEC2E3046264A2646" - $"264C284E2652245028542C2C582856305A3456385C345C3C5C3C58445AC037CB" - $"3C48563C4A04032E24B87A3EB5BD3AB42542B755422E04032E4E425A3256345E" - $"305E3A0202263028302230263624362A360202413E433E3D3E40463E46444602" - $"024B494C4C4B4B484E4B4E4C4F070A0303000102000A00040304070810011784" - $"20040A02020304000A000106000A0001051001178400040A010105000A040309" - $"0A0B00" -}; - -#else // HAIKU_TARGET_PLATFORM_HAIKU - -resource large_icon -{ - $"FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF00F9F90000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF00F9FBF9F90000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF00F9FBFBF9F9F90000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF001717F9F9F9F9F9F90000FFFFFFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F3F1717F9F9F9F9F9F90000FFFFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B3F3F1717F9F9F9FBF9F900FFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B1C1B3F3F1717F9F9FBF900FFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F00001B1C1B3F3F1717F9F900FFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B1B00001B1B1B1B3F171700FFFFFFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B1B1B1B1B00001B1C3F3F170000FFFFFFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B1C1B00001C1C3F001C1B3F3F170000FFFFFFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B1C007B7B000F1B1C00001B1C3F3F170000FFFFFFFFFF" - $"FFFFFFFFFFFFFF003F1B0000DA7B7B001C1C1C1C00001C1B3F3F1700FFFFFFFF" - $"FFFFFFFFFFFFFF003F1B002B2BDA7B001C001B1C1C1C1B00001C1700FFFFFFFF" - $"FFFFFFFFFFFFFF003F1B002B2F2F00001B00001B1B1B1B1B1B1B1700FFFFFFFF" - $"FFFFFFFFFFFFFF003F002B2CEB2F001B1C1C1C1C00001B1B1B1B1700FFFFFFFF" - $"FFFFFFFFFFFFFF003F002B2F2F001B1B00001C1B1C1C1B1C1C1B1700FFFFFFFF" - $"FFFFFFFFFFFFFF00002B2CEB2F001B1C000000001B1C1C1C1B1C1700FFFFFFFF" - $"FFFF000000FFFF00002B2F2F001B1C1B001C1B0000001B1C1C1C1700FFFFFFFF" - $"FF007B7B7B00FF002B2CEB2F001B1B1C001B1C1C1B001C1C1B1C1800FFFFFFFF" - $"007B7B7BDA00FF002B2F2F001B1C1B1C00001B1C1C001C1B1C1C1800FFFFFFFF" - $"002B2CDA7B7B002B2CEB2F001B1C1C1C1C1C00001B001C1B1C1B1700FFFFFFFF" - $"FF002B2CDA7B2B2CEB2F000017171C1C1B1C1C1C00001B1C1C1B1700FFFFFFFF" - $"FF002B2CDA7B2B2CEB2F00FF000017171A1B1C1C1B1B1C1B1C1B1800FFFFFFFF" - $"FFFF002B2C2B2B2F2F00FFFFFFFF000017171A1B1B1C1C1C1B1C1700FFFFFFFF" - $"FFFF002B2C2B2B2F2F00FFFFFFFFFFFF000017171C1C1C1C1B1B1800FFFFFFFF" - $"FFFFFF002B2CEB2F00FFFFFFFFFFFFFFFFFF000017171C1C1B1C1700FFFFFFFF" - $"FFFFFF002B2CEB2F00FFFFFFFFFFFFFFFFFFFFFF000017171C1C1700FFFFFFFF" - $"FFFFFFFF002B2F000E0F0F0F0F0F0F0F0E0FFFFFFFFF0000171718000F0EFFFF" - $"FFFFFFFF0000000E0F0F0F0F0F0F0F0E0F0FFFFFFFFFFFFF000017000F0F0F0E" - $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000E0F0F0F" -}; - -resource mini_icon -{ - $"FFFFFF000000FFFFFFFFFFFFFFFFFFFF" - $"FFFFFF00E5F90000FFFFFFFFFFFFFFFF" - $"FFFFFF001B63F9F90000FFFFFFFFFFFF" - $"FFFFFF001D1D1B63F9F900FFFFFFFFFF" - $"FFFFFF00160D141D1A6300FFFFFFFFFF" - $"FFFFFF001D1B0D0E151D150000FFFFFF" - $"FFFFFF003F1B001C1B0E0D1D1500FFFF" - $"FFFFFF003F007B001B141B141400FFFF" - $"FFFFFF003F002F001B1B0E1B1B00FFFF" - $"FFFFFF00002F001B1C060D1B1B00FFFF" - $"FF00FF00002F001B1C1B0D1B1B00FFFF" - $"002B00002F0017171C0E061B1B00FFFF" - $"002B7B2CEB000000171B1B1B1B00FFFF" - $"FF002B2F00FFFFFF0000191C1B00FFFF" - $"FF002B2F00FFFFFFFFFF00001900FFFF" - $"FFFF00000E0F0F0F0FFFFFFF00000E0E" -}; - -#endif // HAIKU_TARGET_PLATFORM_HAIKU - diff --git a/3rdparty/mmu_man/themes/ThemesAddon.cpp b/3rdparty/mmu_man/themes/ThemesAddon.cpp deleted file mode 100644 index f6b6b59a7b..0000000000 --- a/3rdparty/mmu_man/themes/ThemesAddon.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * ThemesAddon class - */ - -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemesAddon.h" - - -#define DEBUG_TA -#ifdef DEBUG_TA -#define FENTRY PRINT(("ThemesAddon[%s]::%s()\n", Name(), __FUNCTION__)) -#else -#define FENTRY -#endif - - -extern bool CompareMessages(BMessage &a, BMessage &b); - - -// #pragma mark - - - -ThemesAddon::ThemesAddon(const char *name, const char *message_name) - : fImageId(-1), - fName(NULL), - fMsgName(NULL), - fFlags(0L) -{ - fName = strdup(name); - FENTRY; - if (message_name) - fMsgName = strdup(message_name); - fSettings.MakeEmpty(); -} - - -ThemesAddon::~ThemesAddon() -{ - FENTRY; - free(fMsgName); - free(fName); -} - - -const char * -ThemesAddon::Name() -{ - return (const char *)fName; -} - - -const char * -ThemesAddon::Description() -{ - FENTRY; - return "No description yet."; -} - - -BView * -ThemesAddon::OptionsView() -{ - FENTRY; - return NULL; -} - - -status_t -ThemesAddon::RunPreferencesPanel() -{ - FENTRY; - return B_OK; -} - - -status_t -ThemesAddon::LoadSettings(BMessage &settings) -{ - FENTRY; - uint32 flags; - fSettings = settings; - if (fSettings.FindInt32("ta:flags", (int32 *)&flags) >= B_OK) - fFlags = flags; - return B_OK; -} - - -status_t -ThemesAddon::SaveSettings(BMessage &settings) -{ - FENTRY; - status_t err; - err = fSettings.ReplaceInt32("ta:flags", fFlags); - settings = fSettings; - return err; -} - - -void -ThemesAddon::SetAddonFlags(uint32 flags) -{ - fFlags = flags; -} - - -uint32 -ThemesAddon::AddonFlags() -{ - return fFlags; -} - - -status_t -ThemesAddon::AddNames(BMessage &names) -{ - FENTRY; - BString str; - if (MessageName()) - str = Name(); - str << " settings"; - names.AddString(MessageName(), str.String()); - return B_OK; -} - - -status_t -ThemesAddon::MyMessage(BMessage &theme, BMessage &mine) -{ - FENTRY; - BMessage msg; - status_t err = B_NAME_NOT_FOUND; - if (!MessageName()) - goto error; - err = theme.FindMessage(MessageName(), &msg); - if (err) - goto error; - mine = msg; - - return B_OK; -error: - return err; -} - - -status_t -ThemesAddon::SetMyMessage(BMessage &theme, BMessage &mine) -{ - FENTRY; - status_t err; - BMessage msg; - if (!MessageName()) - return B_NAME_NOT_FOUND; - err = theme.FindMessage(MessageName(), &msg); - if (err) - err = theme.AddMessage(MessageName(), &mine); - else - err = theme.ReplaceMessage(MessageName(), &mine); - return err; -} - - -const char * -ThemesAddon::MessageName() -{ - return (const char *)fMsgName; -} - - -status_t -ThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - FENTRY; - (void)theme; (void) flags; - return B_OK; -} - - -status_t -ThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - FENTRY; - (void)theme; (void) flags; - return B_OK; -} - - -status_t -ThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - FENTRY; - (void) flags; - return B_OK; -} - - -status_t -ThemesAddon::BackupCurrent(BMessage &theme) -{ - FENTRY; - return MakeTheme(theme); -} - - -status_t -ThemesAddon::RestoreCurrent(BMessage &theme) -{ - FENTRY; - return ApplyTheme(theme); -} - - -/* by default, try to find the addon's specific message - * and compare them. Some addons don't add any message, - * they'll have to do comparison by hand. - */ -status_t -ThemesAddon::CompareToCurrent(BMessage &theme) -{ - FENTRY; - BMessage current, a, b; - BackupCurrent(current); - status_t err; - - if (!MessageName()) - return B_OK; - - err = theme.FindMessage(MessageName(), &a); - if (err) - return err; - err = current.FindMessage(MessageName(), &b); - if (err) - return err; - if (!CompareMessages(a, b)) - return 1; - - return B_OK; -} - - -status_t -ThemesAddon::InstallFiles(BMessage &theme, BDirectory &folder) -{ - FENTRY; - (void)theme; (void)folder; - return B_OK; -} - -status_t -ThemesAddon::BackupFiles(BMessage &theme, BDirectory &folder) -{ - FENTRY; - (void)theme; (void)folder; - return B_OK; -} - - - /* private */ - - -void -ThemesAddon::SetImageId(image_id id) -{ - fImageId = id; -} - - -image_id -ThemesAddon::ImageId() -{ - return fImageId; -} - diff --git a/3rdparty/mmu_man/themes/ThemesAddon.h b/3rdparty/mmu_man/themes/ThemesAddon.h deleted file mode 100644 index 5491919f96..0000000000 --- a/3rdparty/mmu_man/themes/ThemesAddon.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _THEMES_ADDON_H -#define _THEMES_ADDON_H -/* - * ThemesAddon class header - */ - -#include -class BView; -class BMessage; -class BDirectory; - -namespace Z { -namespace ThemeManager { - -class ThemeManager; - -class ThemesAddon { -public: - ThemesAddon(const char *name, const char *message_name); -virtual ~ThemesAddon(); - - /* presentation */ - -virtual const char *Name(); /* pretty name */ -virtual const char *Description(); /* tooltip... */ - -virtual BView *OptionsView(); -virtual status_t RunPreferencesPanel(); - // if you override, call it first -virtual status_t LoadSettings(BMessage &settings); - // if you override, call it last -virtual status_t SaveSettings(BMessage &settings); -void SetAddonFlags(uint32 flags); -uint32 AddonFlags(); -virtual status_t AddNames(BMessage &names); - - /* Theme manipulation */ - - // name of the submessage in the theme, if any -virtual const char *MessageName(); - // retrieve the addons specific message if any -virtual status_t MyMessage(BMessage &theme, BMessage &mine); -virtual status_t SetMyMessage(BMessage &theme, BMessage &mine); - -virtual status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -virtual status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -virtual status_t ApplyDefaultTheme(uint32 flags=0L); - -virtual status_t BackupCurrent(BMessage &theme); -virtual status_t RestoreCurrent(BMessage &theme); - -virtual status_t CompareToCurrent(BMessage &theme); - - /* Theme installation */ - -virtual status_t InstallFiles(BMessage &theme, BDirectory &folder); -virtual status_t BackupFiles(BMessage &theme, BDirectory &folder); - - /* */ - -private: - -friend class Z::ThemeManager::ThemeManager; - void SetImageId(image_id id); - image_id ImageId(); - - image_id fImageId; - char *fName; - char *fMsgName; - uint32 fFlags; - BMessage fSettings; -}; - -} // ns ThemeManager -} // ns Z - -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon(); - -#ifdef SINGLE_BINARY -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_backgrounds(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_beide(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_deskbar(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_eddie(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_pe(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_screensaver(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_soundplay(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_sounds(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_terminal(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_ui_settings(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_winamp_skin(); -extern "C" Z::ThemeManager::ThemesAddon *instantiate_themes_addon_window_decor(); -#endif - -/* in B_*_ADDONS_DIRECTORY */ -#define Z_THEMES_ADDON_FOLDER "ThemeManager" - -using namespace Z::ThemeManager; - -#endif /* _THEMES_ADDON_H */ diff --git a/3rdparty/mmu_man/themes/ThemesApp.cpp b/3rdparty/mmu_man/themes/ThemesApp.cpp deleted file mode 100644 index 31e82a9049..0000000000 --- a/3rdparty/mmu_man/themes/ThemesApp.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include -#include - -#include -#include - -#include "ThemesApp.h" -#include "ThemeInterfaceView.h" - -const char *kThemesAppSig = "application/x-vnd.mmu_man-Themes"; - - -ThemesApp::ThemesApp() - : BApplication(kThemesAppSig) -{ -} - - -ThemesApp::~ThemesApp() -{ -} - - -void -ThemesApp::ReadyToRun() -{ - BScreen s; - BRect frame(0, 0, 550, 300); - frame.OffsetBySelf(s.Frame().Width()/2 - frame.Width()/2, - s.Frame().Height()/2 - frame.Height()/2); - BWindow *w = new BWindow(frame, "Themes", B_TITLED_WINDOW, B_NOT_RESIZABLE | B_QUIT_ON_WINDOW_CLOSE); - ThemeInterfaceView *v = new ThemeInterfaceView(w->Bounds()); - w->AddChild(v); - w->Show(); -} - - -void -ThemesApp::MessageReceived(BMessage *message) -{ - switch (message->what) { - default: - BApplication::MessageReceived(message); - } -} - - -int main(int argc, char **argv) -{ - ThemesApp app; - app.Run(); -} diff --git a/3rdparty/mmu_man/themes/ThemesApp.h b/3rdparty/mmu_man/themes/ThemesApp.h deleted file mode 100644 index 426769ef58..0000000000 --- a/3rdparty/mmu_man/themes/ThemesApp.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _THEMESAPP_H_ -#define _THEMESAPP_H_ - -#include - -class ThemesApp : public BApplication { -public: - ThemesApp(); - virtual ~ThemesApp(); - void ReadyToRun(); - void MessageReceived(BMessage *message); - -private: -}; - -#endif // _THEMESAPP_H_ diff --git a/3rdparty/mmu_man/themes/UITheme.h b/3rdparty/mmu_man/themes/UITheme.h deleted file mode 100644 index 86d1b50c99..0000000000 --- a/3rdparty/mmu_man/themes/UITheme.h +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _Z_UI_THEME_H -#define _Z_UI_THEME_H - -// the global message what code -#define Z_THEME_MESSAGE_WHAT 'ZThm' - -// reserved field names at top level -#define Z_THEME_NAME "z:theme:name" -#define Z_THEME_DESCRIPTION "z:theme:description" -#define Z_THEME_SCREENSHOT_FILENAME "z:theme:screenshot" -#define Z_THEME_KEYWORDS "z:theme:keywords" - // path of the theme folder/zip -#define Z_THEME_LOCATION "z:theme:location" - // identifies a module this theme has info for. -#define Z_THEME_MODULE_TAG "z:theme:moduletag" - // if the theme is imported, where from -#define Z_THEME_IMPORTER "z:theme:importer" - -// the names of the global BMessages -#define Z_THEME_INFO_MESSAGE "z:theme:infos" -#define Z_THEME_UI_SETTINGS "ui_settings" -#define Z_THEME_WINDOW_DECORATIONS "window_decorations" -#define Z_THEME_BACKGROUND_SETTINGS B_BACKGROUND_INFO -#define Z_THEME_DESKBAR_SETTINGS "deskbar_settings" -#define Z_THEME_TERMINAL_SETTINGS "terminal_prefs" -#define Z_THEME_DIRCOLOURS_SETTINGS "dircolours_settings" -#define Z_THEME_BEIDE_SETTINGS "BeIDE_settings" -#define Z_THEME_EDDIE_SETTINGS "Eddie_settings" -#define Z_THEME_PE_SETTINGS "Pe_settings" -#define Z_THEME_SCREENSAVER_SETTINGS "screensaver_settings" -#define Z_THEME_SOUNDS_SETTINGS "sounds_settings" -#define Z_THEME_WINAMP_SKIN_SETTINGS "winamp_skin_settings" - -// Addon Flags - // allow this addon to apply themes -#define Z_THEME_ADDON_DO_APPLY 0x00000001 -#define Z_THEME_ADDON_DO_SAVE 0x00000002 /* not sure about the semantics */ -#define Z_THEME_ADDON_DO_SET_ALL (Z_THEME_ADDON_DO_APPLY|Z_THEME_ADDON_DO_SAVE) - // allow this addon to save things to themes -#define Z_THEME_ADDON_DO_RETRIEVE 0x00000004 - -// Theme Manager flags - // try to apply settings to running applications -#define UI_THEME_SETTINGS_APPLY 0x00000001 - // save settings to native storage -#define UI_THEME_SETTINGS_SAVE 0x00000002 - // attempt to do both -#define UI_THEME_SETTINGS_SET_ALL (UI_THEME_SETTINGS_APPLY|UI_THEME_SETTINGS_SAVE) - // do read settings from native storage -#define UI_THEME_SETTINGS_RETRIEVE 0x00000004 - -#define Z_THEMES_FOLDER_NAME "UIThemes" -#define Z_THEME_FILE_NAME "Theme" - -/* compatibility stuff ahead */ - -/* some field names not always defined */ -// ui_colors -#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" -// fonts -// other -#define B_UI_MENU_ZSNAKE "be:MenZSnake" -// broadcasted on update -#define B_UI_SETTINGS_CHANGED '_UIC' -#endif - -#define R5_DECOR_BEOS 0 -#define R5_DECOR_WIN95 1 -#define R5_DECOR_AMIGA 2 -#define R5_DECOR_MAC 3 - -#ifndef __HAIKU__ -#ifndef B_BEOS_VERSION_DANO -// R5 compatibility -#define B_PANEL_TEXT_COLOR B_MENU_ITEM_TEXT_COLOR -inline rgb_color make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha=255) -{ - rgb_color c; - c.red = red; - c.green = green; - c.blue = blue; - c.alpha = alpha; - return c; -} -#endif -#endif - -#ifdef __HAIKU__ -#define B_TOOLTIP_BACKGROUND_COLOR B_TOOL_TIP_BACKGROUND_COLOR -#define B_TOOLTIP_TEXT_COLOR B_TOOL_TIP_TEXT_COLOR -#endif - -#endif /* _Z_UI_THEME_H */ diff --git a/3rdparty/mmu_man/themes/Utils.cpp b/3rdparty/mmu_man/themes/Utils.cpp deleted file mode 100644 index cd556a6465..0000000000 --- a/3rdparty/mmu_man/themes/Utils.cpp +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include "Utils.h" -#include -#include -#include -#include - -#include -#include - - -// some private font information structs -namespace BPrivate { - -typedef struct font_folder_info { - //char name[256]; - char *name; - uint32 flags; -} font_folder_info; - -typedef struct font_file_info { - char *name; - uint32 flags; - font_family family; - font_style style; - uint32 dummy; -} font_file_info; - -}; - -using namespace BPrivate; - -// this is PRIVATE to libbe and NOT in R5!!! -extern long _count_font_folders_(void); -extern long _count_font_files_(long); -extern status_t _get_nth_font_file_(long, font_file_info **); -extern status_t _get_nth_font_folder_(long, font_folder_info **); - -status_t -find_font_file(entry_ref *to, font_family family, font_style style, float size) -{ -#ifdef B_BEOS_VERSION_DANO - status_t err = ENOENT; - long i, fontcount, foldercount; - font_file_info *ffi; - font_folder_info *fdi; - bool found = false; - (void)size; - - fontcount = _count_font_files_(0); - for (i = 0; i < fontcount; i++) { - err = _get_nth_font_file_(i, &ffi); - if (err) - continue; - if (strcmp(ffi->family, family) || strcmp(ffi->style, style)) - continue; - found = true; - break; - } - if (!found) - return ENOENT; - foldercount = _count_font_folders_(); - for (i = 0; i < fontcount; i++) { - err = _get_nth_font_folder_(i, &fdi); - if (err) - continue; - BPath ffile(fdi->name); - ffile.Append(ffi->name); - printf("find_font_file: looking for '%s' in '%s'\n", ffi->name, fdi->name); - BEntry ent(ffile.Path()); - if (ent.InitCheck()) - continue; - printf("find_font_file: found\n."); - return ent.GetRef(to); - } -#endif - return ENOENT; -} - - -#define _BORK(_t) \ - err = find_directory(_t, &path); \ - if (!err && (s = dir->FindFirst(path.Path())) >= 0) { \ - printf("found %s\n", #_t); \ - dir->Remove(s, strlen(path.Path()) - s); \ - BString tok(#_t); \ - tok.Prepend("${"); \ - tok.Append("}"); \ - dir->Insert(tok, s); \ - return B_OK; \ - } \ - -status_t -escape_find_directory(BString *dir) -{ - status_t err; - BPath path; - int32 s; - - _BORK(B_DESKTOP_DIRECTORY); - _BORK(B_TRASH_DIRECTORY); - //_BORK(B_ROOT_DIRECTORY); - - //_BORK(B_BEOS_BOOT_DIRECTORY); - _BORK(B_BEOS_FONTS_DIRECTORY); - _BORK(B_BEOS_LIB_DIRECTORY); - _BORK(B_BEOS_SERVERS_DIRECTORY); - _BORK(B_BEOS_APPS_DIRECTORY); - _BORK(B_BEOS_BIN_DIRECTORY); - _BORK(B_BEOS_ETC_DIRECTORY); - _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); - _BORK(B_BEOS_PREFERENCES_DIRECTORY); - _BORK(B_BEOS_TRANSLATORS_DIRECTORY); - _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); - _BORK(B_BEOS_SOUNDS_DIRECTORY); - // not in the declared order, so others are picked first - _BORK(B_BEOS_ADDONS_DIRECTORY); - _BORK(B_BEOS_SYSTEM_DIRECTORY); - _BORK(B_BEOS_DIRECTORY); - - _BORK(B_USER_BOOT_DIRECTORY); - _BORK(B_USER_FONTS_DIRECTORY); - _BORK(B_USER_LIB_DIRECTORY); - _BORK(B_USER_SETTINGS_DIRECTORY); - _BORK(B_USER_DESKBAR_DIRECTORY); - _BORK(B_USER_PRINTERS_DIRECTORY); - _BORK(B_USER_TRANSLATORS_DIRECTORY); - _BORK(B_USER_MEDIA_NODES_DIRECTORY); - _BORK(B_USER_SOUNDS_DIRECTORY); - // - _BORK(B_USER_ADDONS_DIRECTORY); - _BORK(B_USER_CONFIG_DIRECTORY); - _BORK(B_USER_DIRECTORY); - - // same for the whole block, prefer user over common - _BORK(B_COMMON_BOOT_DIRECTORY); - _BORK(B_COMMON_FONTS_DIRECTORY); - _BORK(B_COMMON_LIB_DIRECTORY); - _BORK(B_COMMON_SERVERS_DIRECTORY); - _BORK(B_COMMON_BIN_DIRECTORY); - _BORK(B_COMMON_ETC_DIRECTORY); - _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); - _BORK(B_COMMON_SETTINGS_DIRECTORY); - _BORK(B_COMMON_DEVELOP_DIRECTORY); - _BORK(B_COMMON_LOG_DIRECTORY); - _BORK(B_COMMON_SPOOL_DIRECTORY); - _BORK(B_COMMON_TEMP_DIRECTORY); - _BORK(B_COMMON_VAR_DIRECTORY); - _BORK(B_COMMON_TRANSLATORS_DIRECTORY); - _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); - _BORK(B_COMMON_SOUNDS_DIRECTORY); - // - _BORK(B_COMMON_ADDONS_DIRECTORY); - _BORK(B_COMMON_SYSTEM_DIRECTORY); - _BORK(B_COMMON_DIRECTORY); - - _BORK(B_APPS_DIRECTORY); - _BORK(B_PREFERENCES_DIRECTORY); - _BORK(B_UTILITIES_DIRECTORY); - - return B_OK; -} -#undef _BORK - - -#define _BORK(_t) \ - if (tok == #_t) { \ - err = find_directory(_t, &path); \ - if (err) return err; \ - dir->Remove(s, e - s + 1); \ - dir->Insert(path.Path(), s); \ - return B_OK; \ - } \ - - -status_t -unescape_find_directory(BString *dir) -{ - status_t err = B_ERROR; - int32 s, e; - BString tok; - BPath path; - s = dir->FindFirst("${"); - if (s < 0) - return B_OK; - e = dir->FindFirst("}", s); - if (e < 0) - return B_OK; - dir->CopyInto(tok, s + 2, e - s - 2); - //printf("tok '%s'\n", tok.String()); - - _BORK(B_DESKTOP_DIRECTORY); - _BORK(B_TRASH_DIRECTORY); -#ifdef B_BEOS_VERSION_DANO - _BORK(B_ROOT_DIRECTORY); -#endif - - _BORK(B_BEOS_DIRECTORY); - _BORK(B_BEOS_SYSTEM_DIRECTORY); - _BORK(B_BEOS_ADDONS_DIRECTORY); - _BORK(B_BEOS_BOOT_DIRECTORY); - _BORK(B_BEOS_FONTS_DIRECTORY); - _BORK(B_BEOS_LIB_DIRECTORY); - _BORK(B_BEOS_SERVERS_DIRECTORY); - _BORK(B_BEOS_APPS_DIRECTORY); - _BORK(B_BEOS_BIN_DIRECTORY); - _BORK(B_BEOS_ETC_DIRECTORY); - _BORK(B_BEOS_DOCUMENTATION_DIRECTORY); - _BORK(B_BEOS_PREFERENCES_DIRECTORY); - _BORK(B_BEOS_TRANSLATORS_DIRECTORY); - _BORK(B_BEOS_MEDIA_NODES_DIRECTORY); - _BORK(B_BEOS_SOUNDS_DIRECTORY); - - _BORK(B_COMMON_DIRECTORY); - _BORK(B_COMMON_SYSTEM_DIRECTORY); - _BORK(B_COMMON_ADDONS_DIRECTORY); - _BORK(B_COMMON_BOOT_DIRECTORY); - _BORK(B_COMMON_FONTS_DIRECTORY); - _BORK(B_COMMON_LIB_DIRECTORY); - _BORK(B_COMMON_SERVERS_DIRECTORY); - _BORK(B_COMMON_BIN_DIRECTORY); - _BORK(B_COMMON_ETC_DIRECTORY); - _BORK(B_COMMON_DOCUMENTATION_DIRECTORY); - _BORK(B_COMMON_SETTINGS_DIRECTORY); - _BORK(B_COMMON_DEVELOP_DIRECTORY); - _BORK(B_COMMON_LOG_DIRECTORY); - _BORK(B_COMMON_SPOOL_DIRECTORY); - _BORK(B_COMMON_TEMP_DIRECTORY); - _BORK(B_COMMON_VAR_DIRECTORY); - _BORK(B_COMMON_TRANSLATORS_DIRECTORY); - _BORK(B_COMMON_MEDIA_NODES_DIRECTORY); - _BORK(B_COMMON_SOUNDS_DIRECTORY); - - _BORK(B_USER_DIRECTORY); - _BORK(B_USER_CONFIG_DIRECTORY); - _BORK(B_USER_ADDONS_DIRECTORY); - _BORK(B_USER_BOOT_DIRECTORY); - _BORK(B_USER_FONTS_DIRECTORY); - _BORK(B_USER_LIB_DIRECTORY); - _BORK(B_USER_SETTINGS_DIRECTORY); - _BORK(B_USER_DESKBAR_DIRECTORY); - _BORK(B_USER_PRINTERS_DIRECTORY); - _BORK(B_USER_TRANSLATORS_DIRECTORY); - _BORK(B_USER_MEDIA_NODES_DIRECTORY); - _BORK(B_USER_SOUNDS_DIRECTORY); - - _BORK(B_APPS_DIRECTORY); - _BORK(B_PREFERENCES_DIRECTORY); - _BORK(B_UTILITIES_DIRECTORY); - - return B_OK; -} -#undef _BORK - - -// copy a file including its attributes -#define BUFF_SZ 1024*1024 -status_t -copy_file(entry_ref *ref, const char *to) -{ - char *buff; - status_t err = B_OK; - //off_t off; - //size_t got; - (void)ref; (void)to; - - buff = (char *)malloc(BUFF_SZ); - // XXX: TODO - - - free(buff); - return err; -} - - -int -testhook() -{ - status_t err; - BString str("/boot/home/config/fonts/ttfonts/toto.ttf"); - err = escape_find_directory(&str); - printf("error 0x%08lx %s\n", err, str.String()); - err = unescape_find_directory(&str); - printf("error 0x%08lx %s\n", err, str.String()); - return 0; -} - -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, B_RGB_COLOR_TYPE, 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, 'FONt', index, &data, &len); -#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } - 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) -{ -#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 deleted file mode 100644 index a2cc1ea14d..0000000000 --- a/3rdparty/mmu_man/themes/Utils.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#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/ViewItem.cpp b/3rdparty/mmu_man/themes/ViewItem.cpp deleted file mode 100644 index 2d3d3f12a4..0000000000 --- a/3rdparty/mmu_man/themes/ViewItem.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -#include "ViewItem.h" -#include -#include -#include -#include - - -ViewItem::ViewItem(BRect bounds, const char *name, - uint32 resizeMask, uint32 flags, uint32 level, bool expanded) - : BView(bounds, name, resizeMask, flags), BListItem(level, expanded) -{ - fOwner = NULL; - SetWidth(bounds.Width()); - SetHeight(bounds.Height()); -} - - -ViewItem::~ViewItem() -{ - if (fOwner) - fOwner->RemoveChild(this); -} - - -void -ViewItem::DrawItem(BView *ownerview, BRect frame, bool complete) -{ - (void)frame; (void)complete; - if (!fOwner) { - fOwner = dynamic_cast(ownerview); - if (!ownerview) - return; - ownerview->AddChild(this); - } -#if 0 - const BListItem **list = fOwner->Items(); - for (long i = 0; i < fOwner->CountItems(); i++) { - if (list[i] == this) { - BRect frame(fOwner->ItemFrame(i)); - //ResizeTo(frame.Width(), frame.Height()); - //MoveTo(frame.left, frame.top); - } - } -#endif - //BListItem::DrawItem(ownerview, frame, complete); -} - - -void -ViewItem::Update(BView *ownerview, const BFont *font) -{ - PRINT(("ViewItem::Update()\n")); - (void)font; - if (!fOwner) { - fOwner = dynamic_cast(ownerview); - if (!ownerview) - return; - PRINT(("ViewItem::Update(), fOwner=%p\n", fOwner)); - fOwner->AddChild(this); - } - //BListItem::Update(ownerview, font); - const BListItem **list = fOwner->Items(); - for (long i = 0; i < fOwner->CountItems(); i++) { - if (list[i] == this) { - BRect frame(fOwner->ItemFrame(i)); - ResizeTo(frame.Width(), Bounds().Height()); - MoveTo(frame.left, frame.top); - } - } - SetWidth(Bounds().Width()); - SetHeight(Bounds().Height()); -} - diff --git a/3rdparty/mmu_man/themes/ViewItem.h b/3rdparty/mmu_man/themes/ViewItem.h deleted file mode 100644 index 56439d7388..0000000000 --- a/3rdparty/mmu_man/themes/ViewItem.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ -#ifndef _VIEW_ITEM_H_ -#define _VIEW_ITEM_H_ - -#include -#include -#include - -class ViewItem : public BView, public BListItem -{ -public: - ViewItem(BRect bounds, const char *name, uint32 resizeMask, uint32 flags, uint32 level = 0, bool expanded = true); - virtual ~ViewItem(); - virtual void DrawItem(BView *ownerview, BRect frame, bool complete = false); - virtual void Update(BView *ownerview, const BFont *font); -private: - BListView* fOwner; -}; - -#endif // _VIEW_ITEM_H_ diff --git a/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp b/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp deleted file mode 100644 index 7a8bca68d1..0000000000 --- a/3rdparty/mmu_man/themes/addons/BackgroundsAddon.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * backgrounds ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_backgrounds -#endif - -#define A_NAME "Backgrounds" -#define A_MSGNAME Z_THEME_BACKGROUND_SETTINGS -#define A_DESCRIPTION "Desktop backdrops" - -#define B__DESKTOP_COLOR "be:desktop_color" - - -class BackgroundThemesAddon : public ThemesAddon { -public: - BackgroundThemesAddon(); - ~BackgroundThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); - -//status_t CompareToCurrent(BMessage &theme); - - /* Theme installation */ - -status_t InstallFiles(BMessage &theme, BDirectory &folder); -status_t BackupFiles(BMessage &theme, BDirectory &folder); - -}; - - -BackgroundThemesAddon::BackgroundThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -BackgroundThemesAddon::~BackgroundThemesAddon() -{ -} - - -const char * -BackgroundThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -BackgroundThemesAddon::RunPreferencesPanel() -{ -/* if (be_roster->Launch("application/x-vnd.obos-Backgrounds") < B_OK) - if (be_roster->Launch("application/x-vnd.Be-Backgrounds") < B_OK) - return B_ERROR;*/ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/preferences/Backgrounds"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Backgrounds"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - - -status_t -BackgroundThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_BACKGROUND_SETTINGS, "Desktop backgrounds and color; please respect count and ordering of all fields!"); - names.AddString(B_BACKGROUND_WORKSPACES, "Workspaces each backdrop apply to"); - names.AddString(B_BACKGROUND_IMAGE, "Actual backdrop image file"); - names.AddString(B_BACKGROUND_MODE, "image mode: 0=use_origin, 1=centered, 2=scaled, 3=tiled"); - names.AddString(B_BACKGROUND_ORIGIN, "Origin point for mode 0"); - names.AddString(B_BACKGROUND_ERASE_TEXT, "If true, use desktop color as icon text background"); - names.AddString(B__DESKTOP_COLOR, "one per workspace, up to the last changing one"); - return B_OK; -} - - -status_t -BackgroundThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage backgrounds; - status_t err = B_OK; - BPath pDesktop; - ssize_t flatSize; - char *pAttr; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, backgrounds); - if (err) - return err; - - // set desktop colors - BScreen bs; - rgb_color col; - //const rgb_color *c; - col = bs.DesktopColor(0); // by - // should work as the rest of the fields (grouping) - for (int i = 0; i < count_workspaces(); i++) { - //ssize_t sz = 4; - 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); - } - // make sure we don't leave our garbage in the message - // as it would offset the next call by adding rgb_colors on existing ones - backgrounds.RemoveName(B__DESKTOP_COLOR); - - BMessenger tracker("application/x-vnd.Be-TRAK"); - BMessage m(B_RESTORE_BACKGROUND_IMAGE); - - if (find_directory(B_DESKTOP_DIRECTORY, &pDesktop) < B_OK) - return EINVAL; - BNode nDesktop(pDesktop.Path()); - if (nDesktop.InitCheck() < B_OK) - return nDesktop.InitCheck(); - flatSize = backgrounds.FlattenedSize(); - pAttr = new char[flatSize]; - if (pAttr == NULL) - return ENOMEM; - err = backgrounds.Flatten(pAttr, flatSize); - if (err < B_OK) - goto getout; - err = nDesktop.WriteAttr(B_BACKGROUND_INFO, B_MESSAGE_TYPE, 0LL, pAttr, flatSize); - if (err < B_OK) - goto getout; - - //m.AddSpecifier("Window", "Desktop"); - tracker.SendMessage(&m); - - return B_OK; - -getout: - delete [] pAttr; - return err; -} - - -status_t -BackgroundThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage backgrounds; - status_t err = B_OK; - BPath pDesktop; - struct attr_info ai; - char *pAttr; - BScreen bs; - rgb_color last_color = {0, 0, 0, 254}; - rgb_color col; - int last_change = 0; - int i; - - (void)flags; - err = MyMessage(theme, backgrounds); - if (err) - backgrounds.MakeEmpty(); - - if (find_directory(B_DESKTOP_DIRECTORY, &pDesktop) < B_OK) - return EINVAL; - BNode nDesktop(pDesktop.Path()); - if (nDesktop.InitCheck() < B_OK) - return nDesktop.InitCheck(); - if (nDesktop.GetAttrInfo(B_BACKGROUND_INFO, &ai) < B_OK) - return EIO; - pAttr = new char[ai.size]; - if (pAttr == NULL) - return ENOMEM; - err = nDesktop.ReadAttr(B_BACKGROUND_INFO, ai.type, 0LL, pAttr, ai.size); - if (err < B_OK) - goto getout; - err = backgrounds.Unflatten(pAttr); - if (err < B_OK) - goto getout; - - // make sure other colors are removed - backgrounds.RemoveName(B__DESKTOP_COLOR); - - // get desktop color... XXX: move it in ui_settings ? - // should work as the rest of the fields (grouping) - for (i = 0; i < count_workspaces(); i++) { - col = bs.DesktopColor(i); - if (memcmp(&last_color, &col, sizeof(rgb_color))) { - last_change = i; - last_color = col; - } - } - //printf("ws col cnt %d\n", last_change); - for (i = 0; i <= last_change; i++) { - col = bs.DesktopColor(i); - AddRGBColor(backgrounds, B__DESKTOP_COLOR, col); - //backgrounds->AddData(B__DESKTOP_COLOR, (type_code)'RGBC', &col, 4); - } - - err = SetMyMessage(theme, backgrounds); - return err; - -getout: - delete [] pAttr; - return err; -} - - -status_t -BackgroundThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage backgrounds; - rgb_color col = {51,102,152,255}; // Be Blues... ;) - backgrounds.AddBool(B_BACKGROUND_ERASE_TEXT, true); - AddRGBColor(backgrounds, B__DESKTOP_COLOR, col); - theme.AddMessage(A_MSGNAME, &backgrounds); - return ApplyTheme(theme, flags); -} - - -status_t -BackgroundThemesAddon::InstallFiles(BMessage &theme, BDirectory &folder) -{ - (void)theme; (void)folder; - return B_OK; -} - - -status_t -BackgroundThemesAddon::BackupFiles(BMessage &theme, BDirectory &folder) -{ - (void)theme; (void)folder; - return B_OK; -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new BackgroundThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp b/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp deleted file mode 100644 index ce60354f6a..0000000000 --- a/3rdparty/mmu_man/themes/addons/BeIDEAddon.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * BeIDE Color ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_beide -#endif - -#define A_NAME "BeIDE Colors" -#define A_MSGNAME NULL //Z_THEME_BEIDE_SETTINGS -#define A_DESCRIPTION "Make BeIDE use system colors" - -#define BEIDE_SETTINGS_NAME "Metrowerks/BeIDE_Prefs" - - -// __PACKED -struct beide_editor_pref { - uint32 dummy; /* BIG ENDIAN */ - rgb_color bg; - rgb_color selbg; - uint32 flashing_delay; /* BIG ENDIAN */ - uint8 balance_while_typing; - uint8 relaxed_c_popup; - uint8 sort_func_popup; - uint8 dummy2; - uint8 remember_sel_pos; - uint8 dummy3; - uint8 dummy4; - uint8 dummy5; -}; - - -class BeIDEThemesAddon : public ThemesAddon { -public: - BeIDEThemesAddon(); - ~BeIDEThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -BeIDEThemesAddon::BeIDEThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -BeIDEThemesAddon::~BeIDEThemesAddon() -{ -} - - -const char * -BeIDEThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -BeIDEThemesAddon::RunPreferencesPanel() -{ - return B_OK; -} - - -status_t -BeIDEThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_BEIDE_SETTINGS, "BeIDE Settings"); - return B_OK; -} - - -status_t -BeIDEThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - status_t err; - struct beide_editor_pref bp; - BPath beideSPath; - rgb_color col; - - err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings); - if (err) - return err; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &beideSPath) < B_OK) - return B_ERROR; - beideSPath.Append(BEIDE_SETTINGS_NAME); - BFile beideSettings(beideSPath.Path(), B_READ_WRITE); - if (beideSettings.InitCheck() < B_OK) - return beideSettings.InitCheck(); - if (beideSettings.ReadAttr("AppEditorPrefs", 'rPWM', 0LL, &bp, - sizeof(struct beide_editor_pref)) < B_OK) - return B_ERROR; - if (FindRGBColor(uisettings, B_UI_DOCUMENT_BACKGROUND_COLOR, 0, &col) >= B_OK) - bp.bg = col; - if (FindRGBColor(uisettings, B_UI_MENU_SELECTED_BACKGROUND_COLOR, 0, &col) >= B_OK) - bp.selbg = col; - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - err = beideSettings.WriteAttr("AppEditorPrefs", 'rPWM', 0LL, &bp, - sizeof(struct beide_editor_pref)); - } - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - BList teamList; - app_info ainfo; - int32 count, i; - be_roster->GetAppList(&teamList); - count = teamList.CountItems(); - for (i = 0; i < count; i++) { - if (be_roster->GetRunningAppInfo((team_id)(teamList.ItemAt(i)), &ainfo) == B_OK) { - if (!strcmp(ainfo.signature, "application/x-mw-BeIDE")) { - BMessenger msgr(NULL, ainfo.team); - BMessage msg(B_PASTE); - BMessage click(B_MOUSE_DOWN); - /* first get the prefs window to map the correct view */ - /* hey BeIDE '_MDN' of View listview of Window 0 with 'be:view_where=BPoint(58.0, 103.0)' */ - click.AddSpecifier("View", "listview"); - click.AddSpecifier("Window", "Environment Preferences"); - click.AddPoint("be:view_where", BPoint(58.0,103.0)); - 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); - - msg.MakeEmpty(); - msg.AddSpecifier("View", "Hilite"); - msg.AddSpecifier("View", "colorsview"); - 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); - - msg.MakeEmpty(); - msg.what = 'SSav'; - msg.AddSpecifier("Window", "Environment Preferences"); - err = msgr.SendMessage(&msg); - } - } - } - } - return B_OK; -} - - -status_t -BeIDEThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - (void)theme; (void)flags; - return B_OK; -} - - -status_t -BeIDEThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - rgb_color bg = {255, 255, 255, 255}; - rgb_color selbg = {216, 216, 216, 255}; - 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); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new BeIDEThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/BeOSWindowDecorAddon.cpp b/3rdparty/mmu_man/themes/addons/BeOSWindowDecorAddon.cpp deleted file mode 100644 index 0273da1b9d..0000000000 --- a/3rdparty/mmu_man/themes/addons/BeOSWindowDecorAddon.cpp +++ /dev/null @@ -1,329 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * window_decor ThemesAddon class - */ - -#include -#if defined(B_BEOS_VERSION) && !defined(__HAIKU__) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -// for reference: -// -// available decors in Dano: -// (Default R5) Baqua BlueSteel Graphite Origin OriginSimple -// -// available decors in Zeta: -// (Default R5) Cupertino MenloTab Redmond Smoke ZetaDecor Menlo -// R5 Seattle TV_ ZLight blueBeOS yellowTAB -// -// mine: -// Win2k TextMode TextModeBlue - - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_window_decor -#endif - -#define A_NAME "Window Decor" -#define A_MSGNAME Z_THEME_WINDOW_DECORATIONS -#define A_DESCRIPTION "Window decorations and scrollbars" - - -#ifdef B_BEOS_VERSION_DANO -status_t -set_window_decor_safe(const char *name, BMessage *globals) -{ - // make sure the decor exists (set_window_decor() always returns B_OK) - //PRINT(("set_window_decor_safe(%s, %p)\n", name, globals)); - BPath p("/etc/decors/"); - p.Append(name); - BNode n(p.Path()); - if (n.InitCheck() < B_OK || !n.IsFile()) - return ENOENT; - //PRINT(("set_window_decor_safe: found\n")); - set_window_decor(name, globals); - return B_OK; -} -#endif - - -class DecorThemesAddon : public ThemesAddon { -public: - DecorThemesAddon(); - ~DecorThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -DecorThemesAddon::DecorThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -DecorThemesAddon::~DecorThemesAddon() -{ -} - - -const char * -DecorThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -DecorThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/system/add-ons/Preferences/Appearance"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - - -status_t -DecorThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_WINDOW_DECORATIONS, "Window decorations and scrollbars"); - names.AddString("window:decor", "Window decor"); - names.AddString("window:decor_globals", "Window decor parameters"); - return B_OK; -} - - -status_t -DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage window_decor; - BMessage globals; - BString decorName; - int32 decorId = R5_DECOR_BEOS; - status_t err; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, window_decor); - if (err) - return err; - -#ifdef B_BEOS_VERSION_DANO - bool decorDone = false; - int i; - // try each name until one works - for (i = 0; window_decor.FindString("window:decor", i, &decorName) == B_OK; i++) { - err = set_window_decor_safe(decorName.String(), - (window_decor.FindMessage("window:decor_globals", &globals) == B_OK)?&globals:NULL); - if (err < B_OK) - continue; - decorDone = true; - break; - } - // none match but we did have one, force the default with the globals - if (!decorDone && i > 0) { - decorDone = true; - set_window_decor("Default", - (window_decor.FindMessage("window:decor_globals", &globals) == B_OK)?&globals:NULL); - } - // none... maybe R5 number ? - if (!decorDone && - window_decor.FindInt32("window:R5:decor", &decorId) == B_OK) { - switch (decorId) { - case R5_DECOR_BEOS: - default: - err = set_window_decor_safe("R5", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("BeOS", NULL); - if (err >= B_OK) - break; - set_window_decor("R5", NULL); - break; - case R5_DECOR_WIN95: - err = set_window_decor_safe("Win2k", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("Redmond", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("Seattle", NULL); - if (err >= B_OK) - break; - set_window_decor("R5", NULL); - break; - case R5_DECOR_AMIGA: - err = set_window_decor_safe("Amiga", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("AmigaOS", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("AmigaOS4", NULL); - if (err >= B_OK) - break; - set_window_decor("R5", NULL); - break; - case R5_DECOR_MAC: - err = set_window_decor_safe("Mac", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("MacOS", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("Baqua", NULL); - if (err >= B_OK) - break; - err = set_window_decor_safe("Cupertino", NULL); - if (err >= B_OK) - break; - set_window_decor("R5", NULL); - break; - } - decorDone = true; - } - // it might be intentionally there is none... - //if (!decorDone) - // set_window_decor("Default", NULL); -#else - // best effort with what we have -extern void __set_window_decor(int32 theme); - if (window_decor.FindInt32("window:R5:decor", &decorId) == B_OK) - __set_window_decor(decorId); - else { - BString name; - for (int i = 0; window_decor.FindString("window:decor", i, &decorName) == B_OK; i++) { - if (decorName.IFindFirst("R5") > -1 || - decorName.IFindFirst("BeOS") > -1 || - decorName.IFindFirst("Be") > -1 || - decorName.IFindFirst("yellow") > -1 || - decorName.IFindFirst("Menlo") > -1 || - decorName.IFindFirst("Default") > -1 || - decorName.IFindFirst("Origin") > -1) { - __set_window_decor(R5_DECOR_BEOS); - break; - } - if (decorName.IFindFirst("Microsoft") > -1 || - decorName.IFindFirst("2k") > -1 || - decorName.IFindFirst("XP") > -1 || - decorName.IFindFirst("Redmond") > -1 || - decorName.IFindFirst("Seattle") > -1 || - decorName.IFindFirst("Win") > -1) { - __set_window_decor(R5_DECOR_WIN95); - break; - } - if (decorName.IFindFirst("Amiga") > -1 || - decorName.IFindFirst("OS4") > -1) { - __set_window_decor(R5_DECOR_AMIGA); - break; - } - if (decorName.IFindFirst("Mac") > -1 || - decorName.IFindFirst("Apple") > -1 || - decorName.IFindFirst("Aqua") > -1 || - decorName.IFindFirst("Cupertino") > -1 || - decorName.IFindFirst("OSX") > -1) { - __set_window_decor(R5_DECOR_MAC); - break; - } - } - } -#endif - // XXX: add colors à la WindowShade ? - - return B_OK; -} - - -status_t -DecorThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage window_decor; - BMessage globals; - BString decorName; - status_t err; - - (void)flags; - err = MyMessage(theme, window_decor); - if (err) - window_decor.MakeEmpty(); - -#ifdef B_BEOS_VERSION_DANO - err = get_window_decor(&decorName, &globals); - if (err == B_OK) { - window_decor.AddString("window:decor", decorName.String()); - window_decor.AddMessage("window:decor_globals", &globals); - } -#else - window_decor.AddInt32("window:R5:decor", 0); -#endif - - err = SetMyMessage(theme, window_decor); - return err; -} - - -status_t -DecorThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage window_decor; - window_decor.AddString("window:decor", "R5"); - window_decor.AddInt32("window:R5:decor", 0L); - theme.AddMessage(A_MSGNAME, &window_decor); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new DecorThemesAddon; -} - - -#endif /* B_BEOS_VERSION && !__HAIKU__ */ diff --git a/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp b/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp deleted file mode 100644 index 2c9e3826e6..0000000000 --- a/3rdparty/mmu_man/themes/addons/DanoUISettingsAddon.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * ui_settings ThemesAddon class - */ - -#include -#ifdef B_BEOS_VERSION_DANO - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_ui_settings -#endif - -//#define A_NAME "UI Settings" -#define A_NAME "System Colors and Fonts" -#define A_MSGNAME Z_THEME_UI_SETTINGS -#define A_DESCRIPTION "System colors, fonts and other goodies" - - -class UISettingsThemesAddon : public ThemesAddon { -public: - UISettingsThemesAddon(); - ~UISettingsThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -UISettingsThemesAddon::UISettingsThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -UISettingsThemesAddon::~UISettingsThemesAddon() -{ -} - - -const char * -UISettingsThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -UISettingsThemesAddon::RunPreferencesPanel() -{ - status_t err = B_OK; - entry_ref ref; - BEntry ent; - /* - err = ent.SetTo("/boot/beos/preferences/Colors"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - */ - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Appearance"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - - -status_t -UISettingsThemesAddon::AddNames(BMessage &names) -{ - BMessage uisettings; - BMessage uinames; - status_t err; - const char *str, *value; - type_code code; - int32 i; - - err = get_ui_settings(&uisettings, &uinames); - if (err) - return err; - names.AddString(Z_THEME_UI_SETTINGS, "UI Settings"); - // hack for legacy fonts - names.AddString("be:f:be_plain_font", "System Plain"); - names.AddString("be:f:be_bold_font", "System Bold"); - names.AddString("be:f:be_fixed_font", "System Fixed"); - for (i = 0; uinames.GetInfo(B_STRING_TYPE, i, &str, &code) == B_OK;i++) - if (uinames.FindString(str, &value) == B_OK) - names.AddString(str, value); - return B_OK; -} - - -status_t -UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - BFont fnt; - status_t err; - uint32 uiflags = 0; - - (void)flags; - err = MyMessage(theme, uisettings); - if (err) - return err; - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) - uiflags |= B_SAVE_UI_SETTINGS; - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) - uiflags |= B_APPLY_UI_SETTINGS; - if (!uiflags) - return B_OK; - - // hack for legacy fonts - err = uisettings.FindFlat("be:f:be_plain_font", &fnt); - uisettings.RemoveName("be:f:be_plain_font"); - if (err == B_OK) - BFont::SetStandardFont(B_PLAIN_FONT, &fnt); - - err = uisettings.FindFlat("be:f:be_bold_font", &fnt); - uisettings.RemoveName("be:f:be_bold_font"); - if (err == B_OK) - BFont::SetStandardFont(B_BOLD_FONT, &fnt); - - err = uisettings.FindFlat("be:f:be_fixed_font", &fnt); - uisettings.RemoveName("be:f:be_fixed_font"); - if (err == B_OK) - BFont::SetStandardFont(B_FIXED_FONT, &fnt); - - update_ui_settings(uisettings, uiflags); - - return B_OK; -} - - -status_t -UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - BMessage names; - BFont fnt; - status_t err; - - (void)flags; - err = MyMessage(theme, uisettings); - if (err) - uisettings.MakeEmpty(); - - err = get_ui_settings(&uisettings, &names); - if (err) - return err; - - // hack for legacy fonts - err = BFont::GetStandardFont(B_PLAIN_FONT, &fnt); - uisettings.AddFlat("be:f:be_plain_font", &fnt); - err = BFont::GetStandardFont(B_BOLD_FONT, &fnt); - uisettings.AddFlat("be:f:be_bold_font", &fnt); - err = BFont::GetStandardFont(B_FIXED_FONT, &fnt); - uisettings.AddFlat("be:f:be_fixed_font", &fnt); - - err = SetMyMessage(theme, uisettings); - return err; -} - - -status_t -UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - BFont fnt; - status_t err; - - err = get_default_settings(&uisettings); - if (err) - return err; - - // hack for legacy fonts - err = BFont::GetStandardFont((font_which)(B_PLAIN_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_plain_font", &fnt); - err = BFont::GetStandardFont((font_which)(B_BOLD_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_bold_font", &fnt); - err = BFont::GetStandardFont((font_which)(B_FIXED_FONT-100), &fnt); - uisettings.AddFlat("be:f:be_fixed_font", &fnt); - - theme.AddMessage(A_MSGNAME, &uisettings); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new UISettingsThemesAddon; -} - - -#endif /* B_BEOS_VERSION_DANO */ diff --git a/3rdparty/mmu_man/themes/addons/DeskbarAddon.cpp b/3rdparty/mmu_man/themes/addons/DeskbarAddon.cpp deleted file mode 100644 index 1ceb1115b0..0000000000 --- a/3rdparty/mmu_man/themes/addons/DeskbarAddon.cpp +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * deskbar ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_deskbar -#endif - -#define A_NAME "Deskbar" -#define A_MSGNAME Z_THEME_DESKBAR_SETTINGS -#define A_DESCRIPTION "Deskbar on-screen position" - - -class DeskbarThemesAddon : public ThemesAddon { -public: - DeskbarThemesAddon(); - ~DeskbarThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -DeskbarThemesAddon::DeskbarThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -DeskbarThemesAddon::~DeskbarThemesAddon() -{ -} - - -const char * -DeskbarThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -DeskbarThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/preferences/Deskbar"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Deskbar"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - - -status_t -DeskbarThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_DESKBAR_SETTINGS, "Deskbar position"); - names.AddString("db:location", "Deskbar on-screen position"); - names.AddString("db:expanded", "Deskbar is expanded"); - return B_OK; -} - - -status_t -DeskbarThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage deskbar; - status_t err; - int32 loc = 5; - bool expanded = true; - BDeskbar db; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, deskbar); - if (err) - return err; - - if (deskbar.FindInt32("db:location", &loc) != B_OK) - return ENOENT; - deskbar.FindBool("db:expanded", &expanded); - return db.SetLocation((deskbar_location)loc, expanded); -} - - -status_t -DeskbarThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage deskbar; - status_t err; - - (void)flags; - err = MyMessage(theme, deskbar); - if (err) - deskbar.MakeEmpty(); - - deskbar_location loc; - bool expanded; - BDeskbar db; - - deskbar.RemoveName("db:location"); - deskbar.RemoveName("db:expanded"); - - loc = db.Location(&expanded); - deskbar.AddInt32("db:location", (int32)loc); - deskbar.AddBool("db:expanded", expanded); - - err = SetMyMessage(theme, deskbar); - return err; -} - - -status_t -DeskbarThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage deskbar; - deskbar_location loc = B_DESKBAR_RIGHT_TOP; - bool expanded = true; - deskbar.AddInt32("db:location", (int32)loc); - deskbar.AddBool("db:expanded", expanded); - theme.AddMessage(A_MSGNAME, &deskbar); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new DeskbarThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/EddieAddon.cpp b/3rdparty/mmu_man/themes/addons/EddieAddon.cpp deleted file mode 100644 index ef8b9226b4..0000000000 --- a/3rdparty/mmu_man/themes/addons/EddieAddon.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * Eddie Color ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_eddie -#endif - -#define A_NAME "Eddie Colors" -#define A_MSGNAME NULL //Z_THEME_Eddie_SETTINGS -#define A_DESCRIPTION "Make Eddie use system colors" - -#define EDDIE_SETTINGS_NAME "Eddie/settings" - - -class EddieThemesAddon : public ThemesAddon { -public: - EddieThemesAddon(); - ~EddieThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -EddieThemesAddon::EddieThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -EddieThemesAddon::~EddieThemesAddon() -{ -} - - -const char * -EddieThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -EddieThemesAddon::RunPreferencesPanel() -{ - return B_OK; -} - - -status_t -EddieThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_EDDIE_SETTINGS, "Eddie Settings"); - return B_OK; -} - - -status_t -EddieThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - status_t err; - BPath EddieSPath; - rgb_color col; - BString text; - char buffer[10]; - - (void)flags; - err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings); - if (err) - return err; - - 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 (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 (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 (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"; - } - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &EddieSPath) < B_OK) - return B_ERROR; - EddieSPath.Append(EDDIE_SETTINGS_NAME); - BFile EddieSettings(EddieSPath.Path(), B_WRITE_ONLY|B_OPEN_AT_END); - if (EddieSettings.InitCheck() < B_OK) - return EddieSettings.InitCheck(); - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - if (EddieSettings.Write(text.String(), strlen(text.String())) < B_OK) - return B_ERROR; - } - - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - - } - return B_OK; -} - - -status_t -EddieThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - (void)theme; (void)flags; - return B_OK; -} - - -status_t -EddieThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - rgb_color bg = {255, 255, 255, 255}; - rgb_color fg = {0, 0, 0, 255}; - rgb_color selbg = {180, 200, 240, 255}; - 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); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new EddieThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp b/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp deleted file mode 100644 index 1aeeb84baf..0000000000 --- a/3rdparty/mmu_man/themes/addons/HaikuUISettingsAddon.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * ui_settings ThemesAddon class - */ - -#include -#ifdef B_HAIKU_VERSION_1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_ui_settings -#endif - -#define DEBUG_TA -#ifdef DEBUG_TA -#define FENTRY PRINT(("*ThemesAddon[%s]::%s()\n", Name(), __FUNCTION__)) -#else -#define FENTRY -#endif - -#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } - -// private font API -extern void _set_system_font_(const char *which, font_family family, - font_style style, float size); -extern status_t _get_system_default_font_(const char* which, - font_family family, font_style style, float* _size); - - -#define A_NAME "System Colors and Fonts" -#define A_MSGNAME Z_THEME_UI_SETTINGS -#define A_DESCRIPTION "System colors, fonts and other goodies" - - -class UISettingsThemesAddon : public ThemesAddon { -public: - UISettingsThemesAddon(); - ~UISettingsThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -struct ui_color_map { - const char *name; - color_which id; -} gUIColorMap[] = { - { B_UI_PANEL_BACKGROUND_COLOR, B_PANEL_BACKGROUND_COLOR }, - { B_UI_PANEL_TEXT_COLOR, B_PANEL_TEXT_COLOR }, -// { B_UI_PANEL_LINK_COLOR, B_PANEL_LINK_COLOR }, - { B_UI_DOCUMENT_BACKGROUND_COLOR, B_DOCUMENT_BACKGROUND_COLOR }, - { B_UI_DOCUMENT_TEXT_COLOR, B_DOCUMENT_TEXT_COLOR }, -// { B_UI_DOCUMENT_LINK_COLOR, B_DOCUMENT_LINK_COLOR }, - { B_UI_CONTROL_BACKGROUND_COLOR, B_CONTROL_BACKGROUND_COLOR }, - { B_UI_CONTROL_TEXT_COLOR, B_CONTROL_TEXT_COLOR }, - { B_UI_CONTROL_BORDER_COLOR, B_CONTROL_BORDER_COLOR }, - { B_UI_CONTROL_HIGHLIGHT_COLOR, B_CONTROL_HIGHLIGHT_COLOR }, - { B_UI_NAVIGATION_BASE_COLOR, B_NAVIGATION_BASE_COLOR }, - { B_UI_NAVIGATION_PULSE_COLOR, B_NAVIGATION_PULSE_COLOR }, - { B_UI_SHINE_COLOR, B_SHINE_COLOR }, - { B_UI_SHADOW_COLOR, B_SHADOW_COLOR }, - { B_UI_TOOLTIP_BACKGROUND_COLOR, B_TOOLTIP_BACKGROUND_COLOR }, - { B_UI_TOOLTIP_TEXT_COLOR, B_TOOLTIP_TEXT_COLOR }, - { B_UI_MENU_BACKGROUND_COLOR, B_MENU_BACKGROUND_COLOR }, - { B_UI_MENU_SELECTED_BACKGROUND_COLOR, B_MENU_SELECTED_BACKGROUND_COLOR }, - { B_UI_MENU_ITEM_TEXT_COLOR, B_MENU_ITEM_TEXT_COLOR }, - { B_UI_MENU_SELECTED_ITEM_TEXT_COLOR, B_MENU_SELECTED_ITEM_TEXT_COLOR }, - { B_UI_MENU_SELECTED_BORDER_COLOR, B_MENU_SELECTED_BORDER_COLOR }, - { B_UI_SUCCESS_COLOR, B_SUCCESS_COLOR }, - { B_UI_FAILURE_COLOR, B_FAILURE_COLOR }, - { NULL, (color_which)-1 } -}; - - -UISettingsThemesAddon::UISettingsThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ - FENTRY; -} - - -UISettingsThemesAddon::~UISettingsThemesAddon() -{ - FENTRY; -} - - -const char * -UISettingsThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -UISettingsThemesAddon::RunPreferencesPanel() -{ - status_t err = B_OK; - entry_ref ref; - BEntry ent; - FENTRY; - /* - err = ent.SetTo("/boot/beos/preferences/Colors"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - */ - if (!err) - return B_OK; - err = ent.SetTo("/boot/beos/preferences/Appearance"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - return err; -} - - -status_t -UISettingsThemesAddon::AddNames(BMessage &names) -{ - FENTRY; - - names.AddString(Z_THEME_UI_SETTINGS, "UI Settings"); - // Haiku doesn't know about them, wo add them - //XXX: use symbolic names. - names.AddString("be:c:PanBg", "Panel Background"); - names.AddString("be:c:PanTx", "Panel Text"); - names.AddString("be:c:PanLn", "Panel Link"); - names.AddString("be:c:DocBg", "Document Background"); - names.AddString("be:c:DocTx", "Document Text"); - names.AddString("be:c:DocLn", "Document Link"); - names.AddString("be:c:CtlBg", "Control Background"); - names.AddString("be:c:CtlTx", "Control Text"); - names.AddString("be:c:CtlBr", "Control Border"); - names.AddString("be:c:CtlHg", "Control Highlight"); - names.AddString("be:c:NavBs", "Navigation Base"); - names.AddString("be:c:NavPl", "Navigation Pulse"); - names.AddString("be:c:Shine", "Shine"); - names.AddString("be:c:Shadow", "Shadow"); - names.AddString("be:c:TipBg", "ToolTip Background"); - names.AddString("be:c:TipTx", "ToolTip Text"); - names.AddString("be:c:MenBg", "Menu Background"); - names.AddString("be:c:MenSBg", "Menu Selected Background"); - names.AddString("be:c:MenTx", "Menu Item Text"); - names.AddString("be:c:MenSTx", "Menu Selected Item Text"); - names.AddString("be:c:MenSBr", "Menu Selected Border"); - names.AddString("be:c:Success", "Success"); - names.AddString("be:c:Failure", "Failure"); - names.AddString("be:f:MenTx", "Menu Item Text"); - names.AddString("be:MenSep", "Menu Separator"); - names.AddString("be:MenTrig", "Show Menu Triggers"); - names.AddString("be:MenZSnake", "Menu ZSnake"); - names.AddString("be:f:Tip", "ToolTip"); - names.AddString("be:f:be_plain_font", "System Plain"); - names.AddString("be:f:be_bold_font", "System Bold"); - names.AddString("be:f:be_fixed_font", "System Fixed"); - return B_OK; -} - - -status_t -UISettingsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - BFont fnt; - struct menu_info menuInfo; - status_t err; - status_t gmierr = ENOENT; - int i; - FENTRY; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, uisettings); - DERR(err); - if (err) - return err; - - font_family family; - font_style style; - - err = FindFont(uisettings, "be:f:be_plain_font", 0, &fnt); - //uisettings.RemoveName("be:f:be_plain_font"); - DERR(err); - if (err == B_OK) { - fnt.GetFamilyAndStyle(&family, &style); - _set_system_font_("plain", family, style, fnt.Size()); - } - - err = FindFont(uisettings, "be:f:be_bold_font", 0, &fnt); - DERR(err); - //uisettings.RemoveName("be:f:be_bold_font"); - if (err == B_OK) { - fnt.GetFamilyAndStyle(&family, &style); - _set_system_font_("bold", family, style, fnt.Size()); - } - - err = FindFont(uisettings, "be:f:be_fixed_font", 0, &fnt); - DERR(err); - //uisettings.RemoveName("be:f:be_fixed_font"); - if (err == B_OK) { - fnt.GetFamilyAndStyle(&family, &style); - _set_system_font_("fixed", family, style, fnt.Size()); - } - - err = FindFont(uisettings, "be:f:Tip", 0, &fnt); - DERR(err); - //uisettings.RemoveName("be:f:Tip"); - if (err == B_OK) { - fnt.GetFamilyAndStyle(&family, &style); - // not implemented yet in Haiku - //_set_system_font_("tip", family, style, fnt.Size()); - //_set_system_font_("tooltip", family, style, fnt.Size()); - } - - gmierr = get_menu_info(&menuInfo); - - for (i = 0; gUIColorMap[i].name; i++) { - rgb_color c; - if (FindRGBColor(uisettings, gUIColorMap[i].name, 0, &c) == B_OK) { - set_ui_color(gUIColorMap[i].id, c); - PRINT(("set_ui_color(%d, #%02x%02x%02x)\n", - gUIColorMap[i].id, c.red, c.green, c.blue)); - if (gUIColorMap[i].id == B_MENU_BACKGROUND_COLOR) - menuInfo.background_color = c; - } - } - - if (gmierr >= B_OK) { - bool bval; - int32 ival; - if (uisettings.FindBool("be:MenTrig", &bval) >= B_OK) - menuInfo.triggers_always_shown = bval; - if (uisettings.FindInt32("be:MenSep", &ival) >= B_OK) - menuInfo.separator = ival; - err = FindFont(uisettings, "be:f:MenTx", 0, &fnt); - DERR(err); - if (err == B_OK) { - fnt.GetFamilyAndStyle(&menuInfo.f_family, &menuInfo.f_style); - menuInfo.font_size = fnt.Size(); - } - set_menu_info(&menuInfo); - } - - return B_OK; -} - - -status_t -UISettingsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - BMessage names; - BFont fnt; - menu_info menuInfo; - status_t err; - int i; - FENTRY; - - (void)flags; - err = MyMessage(theme, uisettings); - if (err) - uisettings.MakeEmpty(); - - for (i = 0; gUIColorMap[i].name; i++) { - rgb_color c = ui_color(gUIColorMap[i].id); - AddRGBColor(uisettings, gUIColorMap[i].name, c); - } - - // hack for legacy fonts - AddFont(uisettings, "be:f:be_plain_font", (BFont *)be_plain_font); - AddFont(uisettings, "be:f:be_bold_font", (BFont *)be_bold_font); - AddFont(uisettings, "be:f:be_fixed_font", (BFont *)be_fixed_font); - // XXX: FIXME - //AddFont(uisettings, "be:f:Tip", (BFont *)be_tip_font); - - // menu stuff - err = get_menu_info(&menuInfo); - if (err >= B_OK) { - uisettings.AddBool("be:MenTrig", menuInfo.triggers_always_shown); - uisettings.AddInt32("be:MenSep", menuInfo.separator); - fnt.SetFamilyAndStyle(menuInfo.f_family, menuInfo.f_style); - fnt.SetSize(menuInfo.font_size); - AddFont(uisettings, "be:f:MenTx", &fnt); - } - - err = SetMyMessage(theme, uisettings); - return err; -} - - -status_t -UISettingsThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - rgb_color color; - FENTRY; - - /* - status_t err; - err = get_default_settings(&uisettings); - if (err) - return err; - */ - - font_family family; - font_style style; - float size; - BFont f; - if (_get_system_default_font_("plain", family, style, &size) != B_OK) - return B_ERROR; - f.SetFamilyAndStyle(family, style); - f.SetSize(size); - AddFont(uisettings, "be:f:be_plain_font", &f); - - if (_get_system_default_font_(Name(), family, style, &size) != B_OK) - return B_ERROR; - f.SetFamilyAndStyle(family, style); - f.SetSize(size); - AddFont(uisettings, "be:f:be_plain_font", &f); - - if (_get_system_default_font_(Name(), family, style, &size) != B_OK) - return B_ERROR; - f.SetFamilyAndStyle(family, style); - f.SetSize(size); - AddFont(uisettings, "be:f:be_plain_font", &f); - - // menu stuff - sprintf(family,"%s","Bitstream Vera Sans"); - sprintf(style,"%s","Roman"); - f.SetFamilyAndStyle(family, style); - f.SetSize(12.0); - AddFont(uisettings, "be:f:MenTx", &f); - color.red = 216; - color.blue = 216; - color.green = 216; - color.alpha = 255; - AddRGBColor(uisettings, "be:c:MenBg", color); - uisettings.AddBool("be:MenTrig", false); - uisettings.AddInt32("be:MenSep", 0); - - theme.AddMessage(A_MSGNAME, &uisettings); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new UISettingsThemesAddon; -} - - -#endif /* B_BEOS_VERSION_DANO */ diff --git a/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp b/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp deleted file mode 100644 index 531ce4e207..0000000000 --- a/3rdparty/mmu_man/themes/addons/HaikuWindowDecorAddon.cpp +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * window_decor ThemesAddon class - */ - -#include -#ifdef B_HAIKU_VERSION_1 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_window_decor -#endif - -#define DERR(e) { PRINT(("%s: err: %s\n", __FUNCTION__, strerror(e))); } - -namespace BPrivate { -int32 count_decorators(void); -int32 get_decorator(void); -status_t get_decorator_name(const int32 &index, BString &name); -status_t get_decorator_preview(const int32 &index, BBitmap *bitmap); -status_t set_decorator(const int32 &index); -} - -using namespace BPrivate; - - -status_t -set_decorator(const char *name) -{ - BString n; - status_t err; - int i = count_decorators() - 1; - for (; i > -1; i--) { - err = get_decorator_name(i, n); - DERR(err); - if (err < B_OK) - continue; - if (n == name) { - err = set_decorator(i); - DERR(err); - return err; - } - } - return ENOENT; -} - - -#define A_NAME "Window Decor" -#define A_MSGNAME Z_THEME_WINDOW_DECORATIONS -#define A_DESCRIPTION "Window decorations and scrollbars" - - -class DecorThemesAddon : public ThemesAddon { -public: - DecorThemesAddon(); - ~DecorThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -DecorThemesAddon::DecorThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -DecorThemesAddon::~DecorThemesAddon() -{ -} - - -const char * -DecorThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -DecorThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/references/Appearance"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - return err; -} - - -status_t -DecorThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_WINDOW_DECORATIONS, "Window decorations and scrollbars"); - names.AddString("window:decor", "Window decor"); - names.AddString("window:decor_globals", "Window decor parameters"); - return B_OK; -} - - -status_t -DecorThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage window_decor; - BMessage globals; - BString decorName; - int32 decorId; - bool decorDone = false; - status_t err; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, window_decor); - DERR(err); - if (err) - return err; - - // try each name until one works - for (int i = 0; window_decor.FindString("window:decor", i, &decorName) == B_OK; i++) { - if (set_decorator(decorName.String()) == B_OK) { - decorDone = true; - break; - } - } - // none... maybe R5 number ? - if (!decorDone && - window_decor.FindInt32("window:R5:decor", &decorId) == B_OK) { - int32 defaultDecor = 0; // XXX ? - switch (decorId) { - case R5_DECOR_BEOS: - default: - set_decorator(defaultDecor); - break; - case R5_DECOR_WIN95: - set_decorator("WinDecorator"); - break; - case R5_DECOR_AMIGA: - set_decorator("AmigaDecorator"); - break; - case R5_DECOR_MAC: - set_decorator("MacDecorator"); - break; - } - } -#if 0 -#ifdef B_BEOS_VERSION_DANO - if (window_decor.FindString("window:decor", &decorName) == B_OK) - set_window_decor(decorName.String(), - (window_decor.FindMessage("window:decor_globals", &globals) == B_OK)?&globals:NULL); -#else -extern void __set_window_decor(int32 theme); - int32 decorNr = 0; - if (window_decor.FindInt32("window:R5:decor", &decorNr) == B_OK) - __set_window_decor(decorNr); -#endif -#endif - // XXX: add colors à la WindowShade ? - - return B_OK; -} - - -status_t -DecorThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage window_decor; - BMessage globals; - BString decorName; - status_t err; - - (void)flags; - err = MyMessage(theme, window_decor); - DERR(err); - if (err) - window_decor.MakeEmpty(); - - err = get_decorator_name(get_decorator(), decorName); - DERR(err); - if (err == B_OK) { - window_decor.AddString("window:decor", decorName.String()); - window_decor.AddMessage("window:decor_globals", &globals); - } -#if 0 -#ifdef B_BEOS_VERSION_DANO - err = get_window_decor(&decorName, &globals); - DERR(err); - if (err == B_OK) { - window_decor.AddString("window:decor", decorName.String()); - window_decor.AddMessage("window:decor_globals", &globals); - } -#else - window_decor.AddInt32("window:R5:decor", 0); -#endif -#endif - - err = SetMyMessage(theme, window_decor); - DERR(err); - return err; -} - - -status_t -DecorThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage window_decor; - window_decor.AddString("window:decor", "R5"); - window_decor.AddInt32("window:R5:decor", 0L); - theme.AddMessage(A_MSGNAME, &window_decor); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new DecorThemesAddon; -} - - -#endif /* B_BEOS_VERSION_DANO */ diff --git a/3rdparty/mmu_man/themes/addons/PeAddon.cpp b/3rdparty/mmu_man/themes/addons/PeAddon.cpp deleted file mode 100644 index f183c41038..0000000000 --- a/3rdparty/mmu_man/themes/addons/PeAddon.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * Pe Color ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_pe -#endif - -#define A_NAME "Pe Colors" -#define A_MSGNAME NULL //Z_THEME_PE_SETTINGS -#define A_DESCRIPTION "Make Pe use system colors" - -#define PE_SETTINGS_NAME "pe/settings" - - -class PeThemesAddon : public ThemesAddon { -public: - PeThemesAddon(); - ~PeThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -PeThemesAddon::PeThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -PeThemesAddon::~PeThemesAddon() -{ -} - - -const char * -PeThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -PeThemesAddon::RunPreferencesPanel() -{ - return B_OK; -} - - -status_t -PeThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_PE_SETTINGS, "Pe Settings"); - return B_OK; -} - - -status_t -PeThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - status_t err; - BPath PeSPath; - rgb_color col; - BString text; - char buffer[10]; - - err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings); - if (err) - return err; - - 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 (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 (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 (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"; - } - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &PeSPath) < B_OK) - return B_ERROR; - PeSPath.Append(PE_SETTINGS_NAME); - BFile PeSettings(PeSPath.Path(), B_WRITE_ONLY|B_OPEN_AT_END); - if (PeSettings.InitCheck() < B_OK) - return PeSettings.InitCheck(); - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - if (PeSettings.Write(text.String(), strlen(text.String())) < B_OK) - return B_ERROR; - } - - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - - } - return B_OK; -} - - -status_t -PeThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - (void)theme; (void)flags; - return B_OK; -} - - -status_t -PeThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - rgb_color bg = {255, 255, 255, 255}; - rgb_color fg = {0, 0, 0, 255}; - rgb_color selbg = {180, 200, 240, 255}; - 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); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new PeThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/PulseAddon.cpp b/3rdparty/mmu_man/themes/addons/PulseAddon.cpp deleted file mode 100644 index c4af5f1191..0000000000 --- a/3rdparty/mmu_man/themes/addons/PulseAddon.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Pulse colors ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_pulse -#endif - -#define A_NAME "Pulse" -#define A_MSGNAME Z_THEME_PULSE_SETTINGS -#define A_DESCRIPTION "Pulse colors" - -class PulseThemesAddon : public ThemesAddon { -public: - PulseThemesAddon(); - ~PulseThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - -PulseThemesAddon::PulseThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - -PulseThemesAddon::~PulseThemesAddon() -{ -} - -const char *PulseThemesAddon::Description() -{ - return A_DESCRIPTION; -} - -status_t PulseThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/preferences/Pulse"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Pulse"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - -status_t PulseThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_PULSE_SETTINGS, "Pulse colors"); - //names.AddString("db:location", "Pulse on-screen position"); - //names.AddString("db:expanded", "Pulse is expanded"); - return B_OK; -} - -status_t PulseThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage deskbar; - status_t err; - int32 loc = 5; - bool expanded = true; - BPulse db; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, deskbar); - if (err) - return err; - - if (deskbar.FindInt32("db:location", &loc) != B_OK) - return ENOENT; - deskbar.FindBool("db:expanded", &expanded); - return db.SetLocation((deskbar_location)loc, expanded); -} - -status_t PulseThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage deskbar; - status_t err; - - (void)flags; - err = MyMessage(theme, deskbar); - if (err) - deskbar.MakeEmpty(); - - deskbar_location loc; - bool expanded; - BPulse db; - - loc = db.Location(&expanded); - deskbar.AddInt32("db:location", (int32)loc); - deskbar.AddBool("db:expanded", expanded); - - err = SetMyMessage(theme, deskbar); - return err; -} - -status_t PulseThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage deskbar; - deskbar_location loc = B_DESKBAR_RIGHT_TOP; - bool expanded = true; - deskbar.AddInt32("db:location", (int32)loc); - deskbar.AddBool("db:expanded", expanded); - theme.AddMessage(A_MSGNAME, &deskbar); - return ApplyTheme(theme, flags); -} - - -ThemesAddon *instantiate_themes_addon() -{ - return (ThemesAddon *) new PulseThemesAddon; -} diff --git a/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp b/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp deleted file mode 100644 index 2cfa6248a2..0000000000 --- a/3rdparty/mmu_man/themes/addons/ScreensaverAddon.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * screensaver ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_screensaver -#endif - -#define A_NAME "Screensaver" -#define A_MSGNAME Z_THEME_SCREENSAVER_SETTINGS -#define A_DESCRIPTION "Screensaver settings" - -#define Z_THEME_SS_MODULE "screensaver:modulename" -#define Z_THEME_SS_MODULE_SETTINGS "screensaver:modulesettings" - -#define MS_NAME "modulesettings_" - - -class ScreensaverThemesAddon : public ThemesAddon { -public: - ScreensaverThemesAddon(); - ~ScreensaverThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -ScreensaverThemesAddon::ScreensaverThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -ScreensaverThemesAddon::~ScreensaverThemesAddon() -{ -} - - -const char * -ScreensaverThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -ScreensaverThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/preferences/ScreenSaver"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/ScreenSaver"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - return err; -} - - -status_t -ScreensaverThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_SCREENSAVER_SETTINGS, "Screensaver settings"); - names.AddString(Z_THEME_SS_MODULE, "Screensaver active module"); - names.AddString(Z_THEME_SS_MODULE_SETTINGS, "Screensaver active module settings"); - return B_OK; -} - - -status_t -ScreensaverThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage screensaver; - status_t err; - BPath path; - BString str; - BMessage settings; - BMessage modsettings; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, screensaver); - if (err) - return err; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK) - return B_ERROR; - path.Append("ScreenSaver_settings"); - BFile f(path.Path(), B_READ_WRITE); - if (settings.Unflatten(&f) < B_OK) - return B_ERROR; - if (screensaver.FindString(Z_THEME_SS_MODULE, &str) >= B_OK) { - if (settings.ReplaceString("modulename", str.String()) < B_OK) - if (settings.AddString("modulename", str.String()) < B_OK) - return B_ERROR; - if (screensaver.FindMessage(Z_THEME_SS_MODULE_SETTINGS, &modsettings) >= B_OK) { - BString msname(MS_NAME); - msname += str.String(); - if (settings.ReplaceMessage(msname.String(), &modsettings) < B_OK) - settings.AddMessage(msname.String(), &modsettings); - } - f.Seek(0LL, SEEK_SET); - if (settings.Flatten(&f) < B_OK) - return B_ERROR; - } - - return err; -} - - -status_t -ScreensaverThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage screensaver; - status_t err; - BPath path; - BString str; - BMessage settings; - BMessage modsettings; - - (void)flags; - err = MyMessage(theme, screensaver); - if (err) - screensaver.MakeEmpty(); - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) < B_OK) - return B_ERROR; - path.Append("ScreenSaver_settings"); - BFile f(path.Path(), B_READ_ONLY); - if (settings.Unflatten(&f) < B_OK) - return B_ERROR; - if (settings.FindString("modulename", &str) >= B_OK) { - screensaver.AddString(Z_THEME_SS_MODULE, str.String()); - BString msname(MS_NAME); - msname += str.String(); - if (settings.FindMessage(msname.String(), &modsettings) >= B_OK) { - screensaver.AddMessage(Z_THEME_SS_MODULE_SETTINGS, &modsettings); - } - } - - err = SetMyMessage(theme, screensaver); - return err; -} - - -status_t -ScreensaverThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage screensaver; - screensaver.AddString("screensaver:modulename", "Blackness"); - theme.AddMessage(A_MSGNAME, &screensaver); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new ScreensaverThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp b/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp deleted file mode 100644 index 83a0e8136d..0000000000 --- a/3rdparty/mmu_man/themes/addons/SoundplayColorAddon.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * SoundPlay Color ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_soundplay -#endif - -#define A_NAME "SoundPlay Color" -#define A_MSGNAME NULL //Z_THEME_SOUNDPLAY_SETTINGS -#define A_DESCRIPTION "Make SoundPlay use system colors" - - -class SoundplayThemesAddon : public ThemesAddon { -public: - SoundplayThemesAddon(); - ~SoundplayThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -SoundplayThemesAddon::SoundplayThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -SoundplayThemesAddon::~SoundplayThemesAddon() -{ -} - - -const char * -SoundplayThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -SoundplayThemesAddon::RunPreferencesPanel() -{ - return B_OK; -} - - -status_t -SoundplayThemesAddon::AddNames(BMessage &names) -{ - //names.AddString(Z_THEME_BEIDE_SETTINGS, "BeIDE Settings"); - (void)names; - return B_OK; -} - - -status_t -SoundplayThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage uisettings; - status_t err; - rgb_color panelcol; - int32 wincnt = 1; - - err = theme.FindMessage(Z_THEME_UI_SETTINGS, &uisettings); - if (err) - return err; - - if (FindRGBColor(uisettings, B_UI_PANEL_BACKGROUND_COLOR, 0, &panelcol) < B_OK) - panelcol = make_color(216,216,216,255); - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - // WRITEME - } - - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - BMessenger msgr("application/x-vnd.marcone-soundplay"); - BMessage command(B_COUNT_PROPERTIES); - BMessage answer; - command.AddSpecifier("Window"); - err = msgr.SendMessage(&command, &answer,2000000LL,2000000LL); - if(B_OK == err) { - if (answer.FindInt32("result", &wincnt) != B_OK) - wincnt = 1; - } - BMessage msg(B_PASTE); - 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++) { - BMessage wmsg(msg); - wmsg.AddSpecifier("Window", i); - msgr.SendMessage(&wmsg, (BHandler *)NULL, 2000000LL); - } - } - - return B_OK; -} - - -status_t -SoundplayThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - (void)theme; (void)flags; - return B_OK; -} - - -status_t -SoundplayThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage uisettings; - rgb_color bg = {216, 216, 216, 255}; - AddRGBColor(uisettings, B_UI_PANEL_BACKGROUND_COLOR, bg); - theme.AddMessage(Z_THEME_UI_SETTINGS, &uisettings); - return ApplyTheme(theme, flags); -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new SoundplayThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp b/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp deleted file mode 100644 index bb71815d1e..0000000000 --- a/3rdparty/mmu_man/themes/addons/SoundsAddon.cpp +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * sounds ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_sounds -#endif - -#define A_NAME "Sounds" -#define A_MSGNAME Z_THEME_SOUNDS_SETTINGS -#define A_DESCRIPTION "System sound events" - - -class SoundsThemesAddon : public ThemesAddon { -public: - SoundsThemesAddon(); - ~SoundsThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); -}; - - -SoundsThemesAddon::SoundsThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -SoundsThemesAddon::~SoundsThemesAddon() -{ -} - - -const char * -SoundsThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -SoundsThemesAddon::RunPreferencesPanel() -{ - status_t err; - entry_ref ref; - BEntry ent; - err = ent.SetTo("/boot/beos/preferences/Sounds"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - } - } - if (!err) - return B_OK; - err = ent.SetTo("/system/add-ons/Preferences/Sounds"); - if (!err) { - err = ent.GetRef(&ref); - if (!err) { - err = be_roster->Launch(&ref); - if (err) { - BMessage msg(B_REFS_RECEIVED); - msg.AddRef("refs", &ref); - be_app_messenger.SendMessage(&msg); - } - } - } - return err; -} - - -status_t -SoundsThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_SOUNDS_SETTINGS, "Sounds Settings"); - names.AddString("sounds:file", "Filename for this sound event"); - names.AddString("sounds:volume", "Volume for this sound event"); - return B_OK; -} - - -status_t -SoundsThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage sounds; - status_t err; - BMediaFiles bmfs; - BString item; - entry_ref entry; - BEntry ent; - BPath path; - const char *p; - float gain; - int32 index; - char *field_name; - type_code field_code; - int32 field_count; - BMessage msg; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, sounds); - if (err) - return err; - - bmfs.RewindRefs(BMediaFiles::B_SOUNDS); - for (index = 0; sounds.GetInfo(B_ANY_TYPE, index, - GET_INFO_NAME_PTR(&field_name), - &field_code, - &field_count) == B_OK; index++) { - if (field_code != B_MESSAGE_TYPE) - continue; - if (sounds.FindMessage(field_name, &msg) < B_OK) - continue; - /* remove old ref if any */ - if ((bmfs.GetRefFor(BMediaFiles::B_SOUNDS, field_name, &entry) >= B_OK) - && (entry.device >= 0)) - bmfs.RemoveRefFor(BMediaFiles::B_SOUNDS, field_name, entry); - if (msg.FindString("sounds:file", &p) < B_OK) - continue; - path.SetTo(p); - if (ent.SetTo(path.Path()) < B_OK) - continue; - if (ent.GetRef(&entry) < B_OK) - continue; - if (bmfs.SetRefFor(BMediaFiles::B_SOUNDS, field_name, entry) < B_OK) - continue; - if (msg.FindFloat("sounds:volume", &gain) < B_OK) - continue; -#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO) - if (bmfs.SetAudioGainFor(BMediaFiles::B_SOUNDS, field_name, gain) < B_OK) - continue; -#endif - } - - return B_OK; -} - - -status_t -SoundsThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage sounds; - status_t err; - BMediaFiles bmfs; - BString item; - entry_ref entry; - BEntry ent; - BPath path; - float gain; - - (void)flags; - err = MyMessage(theme, sounds); - if (err) - sounds.MakeEmpty(); - - bmfs.RewindRefs(BMediaFiles::B_SOUNDS); - while (bmfs.GetNextRef(&item, &entry) == B_OK) { - BMessage msg('SndI'); - path.Unset(); - ent.SetTo(&entry); - ent.GetPath(&path); - //printf("\t%s: %s\n", item.String(), path.Path()); - if (path.Path()) { - msg.AddString("sounds:file", path.Path()); - gain = 1.0; -#if defined(__HAIKU__) || defined(B_BEOS_VERSION_DANO) - bmfs.GetAudioGainFor(BMediaFiles::B_SOUNDS, item.String(), &gain); -#endif - msg.AddFloat("sounds:volume", gain); - } - sounds.AddMessage(item.String(), &msg); - } - - err = SetMyMessage(theme, sounds); - return err; -} - - -status_t -SoundsThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage sounds; - (void)flags; - //theme.AddMessage(A_MSGNAME, &deskbar); - //return ApplyTheme(theme, flags); - // TODO - return B_OK; -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new SoundsThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp b/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp deleted file mode 100644 index fa1e220fc4..0000000000 --- a/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp +++ /dev/null @@ -1,721 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * BeIDE Color ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG 1 -#include - -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" -#include "Utils.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_terminal -#endif - -#define A_NAME "Terminal" -#define A_MSGNAME Z_THEME_TERMINAL_SETTINGS -#define A_DESCRIPTION "Terminal color, font and size" - -/* definitions for R5 Terminal settings file */ - -#define TP_MAGIC 0xf1f2f3f4 -#define TP_VERSION 0x02 -#define TP_FONT_NAME_SZ 128 - -// __PACKED - -struct tpref { - uint32 cols; - uint32 rows; - uint32 tab_width; - uint32 font_size; - char font[TP_FONT_NAME_SZ]; // "Family/Style" - uint32 cursor_blink_rate; // blinktime in µs = 1000000 - uint32 refresh_rate; // ??? = 0 - rgb_color bg; - rgb_color fg; - rgb_color curbg; - rgb_color curfg; - rgb_color selbg; - rgb_color selfg; - char encoding; // index in the menu (0 = UTF-8) - char unknown[3]; -}; /* this is what is sent to the Terminal window... actually not ! It's sent by Terminal to itself. */ - -struct termprefs { - uint32 magic; - uint32 version; - float x; - float y; - struct tpref p; -}; - -#define MSG_R5_SET_PREF 'pref' - -/* definitions for Haiku Terminal settings file */ -/* from TermConst.h */ - -#define PREF_HALF_FONT_FAMILY "Half Font Family" -#define PREF_HALF_FONT_STYLE "Half Font Style" -#define PREF_HALF_FONT_SIZE "Half Font Size" - -#define PREF_TEXT_FORE_COLOR "Text Foreground Color" -#define PREF_TEXT_BACK_COLOR "Text Background Color" -#define PREF_SELECT_FORE_COLOR "Selection Foreground Color" -#define PREF_SELECT_BACK_COLOR "Selection Background Color" -#define PREF_CURSOR_FORE_COLOR "Cursor Foreground Color" -#define PREF_CURSOR_BACK_COLOR "Cursor Background Color" - -#define PREF_IM_FORE_COLOR "IM Foreground Color" -#define PREF_IM_BACK_COLOR "IM Background Color" -#define PREF_IM_SELECT_COLOR "IM Selection Color" - -#define PREF_HISTORY_SIZE "History Size" -#define PREF_CURSOR_BLINKING "Cursor Blinking rate" - -#define PREF_IM_AWARE = "Input Method Aware" - -#define PREF_COLS "Cols" -#define PREF_ROWS "Rows" -#define PREF_SHELL "Shell" - -#define PREF_TEXT_ENCODING "Text encoding" -#define PREF_GUI_LANGUAGE "Language" - - -/* theme field names */ - -#define TP_COLS "term:cols" -#define TP_ROWS "term:rows" -#define TP_TABWIDTH "term:tab" -#define TP_FONT "term:font" -#define TP_BG "term:c:bg" -#define TP_FG "term:c:fg" -#define TP_CURBG "term:c:curbg" -#define TP_CURFG "term:c:curfg" -#define TP_SELBG "term:c:selbg" -#define TP_SELFG "term:c:selfg" -#define TP_ENCODING "term:encoding" - -static const char *kHaikuTerminalAppSig = "application/x-vnd.Haiku-Terminal"; -static const char *kBeOSTerminalAppSig = "application/x-vnd.Be-SHEL"; - - -class TerminalThemesAddon : public ThemesAddon { -public: - TerminalThemesAddon(); - ~TerminalThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); - - /* Theme installation */ -status_t InstallFiles(BMessage &theme, BDirectory &folder); -status_t BackupFiles(BMessage &theme, BDirectory &folder); - -private: -status_t ApplyThemeR5(BMessage &theme, uint32 flags); -status_t MakeThemeR5(BMessage &theme, uint32 flags); -status_t ApplyThemeHaiku(BMessage &theme, uint32 flags); -status_t MakeThemeHaiku(BMessage &theme, uint32 flags); -status_t LoadHaikuTerminalSettings(BMessage &into); -status_t SaveHaikuTerminalSettings(BMessage &from); -}; - - -TerminalThemesAddon::TerminalThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -TerminalThemesAddon::~TerminalThemesAddon() -{ -} - - -const char * -TerminalThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -TerminalThemesAddon::RunPreferencesPanel() -{ - BAlert *alert; - alert = new BAlert("info", "Please use the Settings menu in the Terminal application.", "Gotcha"); - alert->Go(); - return B_OK; -} - - -status_t -TerminalThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_TERMINAL_SETTINGS, "Terminal Preferences"); - names.AddString(TP_COLS, "Terminal column count"); - names.AddString(TP_ROWS, "Terminal row count"); - names.AddString(TP_TABWIDTH, "Terminal tab width"); - names.AddString(TP_FONT, "Terminal font"); - names.AddString(TP_BG, "Terminal background color"); - names.AddString(TP_FG, "Terminal foreground color"); - names.AddString(TP_CURBG, "Terminal cursor background color"); - names.AddString(TP_CURFG, "Terminal cursor foreground color"); - names.AddString(TP_SELBG, "Terminal selection background color"); - names.AddString(TP_SELFG, "Terminal selection foreground color"); - names.AddString(TP_ENCODING, "Terminal text encoding"); - return B_OK; -} - - -status_t -TerminalThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - status_t err; - -#ifndef __HAIKU__ - err = ApplyThemeR5(theme, flags); -#endif - // Some people use the Haiku terminal in BeOS. - err = ApplyThemeHaiku(theme, flags); - if (err) - return err; - return B_OK; -} - - -status_t -TerminalThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ -#ifdef __HAIKU__ - return MakeThemeHaiku(theme, flags); -#else - return MakeThemeR5(theme, flags); -#endif -} - - -status_t -TerminalThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage termpref; - // XXX: add font and stuff... - 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); -} - - -status_t -TerminalThemesAddon::InstallFiles(BMessage &theme, BDirectory &folder) -{ - BMessage termpref; - status_t err; - - (void)folder; - err = MyMessage(theme, termpref); - if (err) - termpref.MakeEmpty(); - - return B_OK; -} - - -status_t -TerminalThemesAddon::BackupFiles(BMessage &theme, BDirectory &folder) -{ - BMessage termpref; - status_t err; - - (void)folder; - err = MyMessage(theme, termpref); - if (err) - termpref.MakeEmpty(); - - entry_ref ref; - //find_font_file(&ref, ff, fs); - return B_OK; -} - - -status_t -TerminalThemesAddon::ApplyThemeR5(BMessage &theme, uint32 flags) -{ - BMessage termpref; - status_t err; - struct termprefs tp; - - err = MyMessage(theme, termpref); - if (err) - return err; - tp.magic = TP_MAGIC; - tp.version = TP_VERSION; - tp.x = 0; // don't open at specific coords - tp.y = 0; - if (termpref.FindInt32(TP_COLS, (int32 *)&tp.p.cols) != B_OK) - tp.p.cols = 80; - if (termpref.FindInt32(TP_ROWS, (int32 *)&tp.p.rows) != B_OK) - tp.p.rows = 25; - if (termpref.FindInt32(TP_TABWIDTH, (int32 *)&tp.p.tab_width) != B_OK) - tp.p.tab_width = 8; - BFont tFont; - tp.p.font_size = 12; - strcpy(tp.p.font, "Courier10 BT/Roman"); - if (FindFont(termpref, TP_FONT, 0, &tFont) == B_OK) { - font_family ff; - font_style fs; - tFont.GetFamilyAndStyle(&ff, &fs); - strcpy(tp.p.font, ff); - strcat(tp.p.font, "/"); - strcat(tp.p.font, fs); - tp.p.font_size = (uint32)tFont.Size(); - } - tp.p.cursor_blink_rate = 1000000; - tp.p.refresh_rate = 0; - - if (FindRGBColor(termpref, TP_BG, 0, &tp.p.bg) != B_OK) - tp.p.bg = make_color(255,255,255,255); - if (FindRGBColor(termpref, TP_FG, 0, &tp.p.fg) != B_OK) - tp.p.fg = make_color(0,0,0,255); - if (FindRGBColor(termpref, TP_CURBG, 0, &tp.p.curbg) != B_OK) - tp.p.curbg = make_color(255,255,255,255); - if (FindRGBColor(termpref, TP_CURFG, 0, &tp.p.curfg) != B_OK) - tp.p.curfg = make_color(0,0,0,255); - if (FindRGBColor(termpref, TP_SELBG, 0, &tp.p.selbg) != B_OK) - tp.p.selbg = make_color(0,0,0,255); - 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) - tp.p.encoding = 0; // UTF-8 - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - BPath pTermPref; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) - return EINVAL; - pTermPref.Append("Terminal"); - BFile fTermPref(pTermPref.Path(), B_WRITE_ONLY|B_CREATE_FILE|B_ERASE_FILE); - if (fTermPref.InitCheck() != B_OK) { - return fTermPref.InitCheck(); - } - fTermPref.Write(&tp, sizeof(struct termprefs)); - BNodeInfo ni(&fTermPref); - if (ni.InitCheck() == B_OK) - ni.SetType("application/x-vnd.Be-pref"); - } - - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - BList teamList; - app_info ainfo; - int32 count, i; - be_roster->GetAppList(&teamList); - count = teamList.CountItems(); - for (i = 0; i < count; i++) { - if (be_roster->GetRunningAppInfo((team_id)(teamList.ItemAt(i)), &ainfo) == B_OK) { - if (!strcmp(ainfo.signature, kBeOSTerminalAppSig)) { - err = B_OK; - BMessage msg(MSG_R5_SET_PREF); - BMessenger msgr(NULL, ainfo.team); - tp.x = 0; - tp.y = 0; - - //msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref)); - msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs)); - msg.AddSpecifier("Window", 0L); - err = msgr.SendMessage(&msg); - } - } - } - } - - return B_OK; -} - - -status_t -TerminalThemesAddon::MakeThemeR5(BMessage &theme, uint32 flags) -{ - BMessage termpref; - status_t err; - struct termprefs tp; - BPath pTermPref; - - (void)flags; - err = MyMessage(theme, termpref); - if (err) - termpref.MakeEmpty(); - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) - return EINVAL; - pTermPref.Append("Terminal"); - BFile fTermPref(pTermPref.Path(), B_READ_ONLY); - if (fTermPref.InitCheck() != B_OK) - return fTermPref.InitCheck(); - if (fTermPref.Read(&tp, sizeof(struct termprefs)) < (ssize_t)sizeof(struct termprefs)) - return EIO; - if ((tp.magic != TP_MAGIC) || (tp.version != TP_VERSION)) - return EINVAL; - termpref.AddInt32(TP_COLS, tp.p.cols); - termpref.AddInt32(TP_ROWS, tp.p.rows); - termpref.AddInt32(TP_TABWIDTH, tp.p.tab_width); - BFont tFont; - font_family ff; - font_style fs; - BString str(tp.p.font); - str.Truncate(str.FindFirst('/')); - strncpy(ff, str.String(), sizeof(ff)); - str.SetTo(tp.p.font); - str.Remove(0, str.FindFirst('/')+1); - strncpy(fs, str.String(), sizeof(fs)); - tFont.SetFamilyAndStyle(ff, fs); - tFont.SetSize(tp.p.font_size); - 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); - return B_OK; -} - - -status_t -TerminalThemesAddon::ApplyThemeHaiku(BMessage &theme, uint32 flags) -{ - BMessage termpref; - BMessage lines; - status_t err; - struct termprefs tp; - int32 ival; - rgb_color color; - BString s; - - err = MyMessage(theme, termpref); - if (err) - return err; - - if (termpref.FindInt32(TP_COLS, &ival) < B_OK) - ival = 80; - s = ""; - s << ival; - lines.AddString(PREF_COLS, s.String()); - - if (termpref.FindInt32(TP_ROWS, &ival) < B_OK) - ival = 25; - s = ""; - s << ival; - lines.AddString(PREF_ROWS, s.String()); - - if (termpref.FindInt32(TP_TABWIDTH, &ival) >= B_OK) { - //XXX: handle that ? - } - - BFont tFont; - tp.p.font_size = 12; - strcpy(tp.p.font, "Courier10 BT/Roman"); - if (FindFont(termpref, TP_FONT, 0, &tFont) == B_OK) { - font_family ff; - font_style fs; - tFont.GetFamilyAndStyle(&ff, &fs); - s = ""; - s << ff; - lines.AddString(PREF_HALF_FONT_FAMILY, s.String()); - s = ""; - s << fs; - lines.AddString(PREF_HALF_FONT_STYLE, s.String()); - s = ""; - s << tFont.Size(); - lines.AddString(PREF_HALF_FONT_SIZE, s.String()); - } - - if (FindRGBColor(termpref, TP_BG, 0, &color) != B_OK) - color = make_color(255,255,255,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_TEXT_BACK_COLOR, s.String()); - - if (FindRGBColor(termpref, TP_FG, 0, &color) != B_OK) - color = make_color(0,0,0,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_TEXT_FORE_COLOR, s.String()); - - if (FindRGBColor(termpref, TP_CURBG, 0, &color) != B_OK) - color = make_color(255,255,255,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_CURSOR_BACK_COLOR, s.String()); - - if (FindRGBColor(termpref, TP_CURFG, 0, &color) != B_OK) - color = make_color(0,0,0,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_CURSOR_FORE_COLOR, s.String()); - - if (FindRGBColor(termpref, TP_SELBG, 0, &color) != B_OK) - color = make_color(0,0,0,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_SELECT_BACK_COLOR, s.String()); - - if (FindRGBColor(termpref, TP_SELFG, 0, &color) != B_OK) - color = make_color(255,255,255,255); - s = ""; - s << color.red << ", " << color.green << ", " << color.blue; - lines.AddString(PREF_SELECT_FORE_COLOR, s.String()); - - /* XXX: handle PREF_IM_FORE_COLOR PREF_IM_BACK_COLOR PREF_IM_SELECT_COLOR */ - - - if (termpref.FindInt32(TP_ENCODING, &ival) != B_OK) - ival = 0; // UTF-8 - s = ""; - s << ival; - //XXX: shouldn't really be touched... - //lines.AddString(, s.String()); - - if (flags & UI_THEME_SETTINGS_SAVE && AddonFlags() & Z_THEME_ADDON_DO_SAVE) { - SaveHaikuTerminalSettings(lines); - } - - if (flags & UI_THEME_SETTINGS_APPLY && AddonFlags() & Z_THEME_ADDON_DO_APPLY) { - BList teamList; - app_info ainfo; - int32 count, i; - be_roster->GetAppList(&teamList); - count = teamList.CountItems(); - for (i = 0; i < count; i++) { - if (be_roster->GetRunningAppInfo((team_id)(teamList.ItemAt(i)), &ainfo) == B_OK) { - if (!strcmp(ainfo.signature, kHaikuTerminalAppSig)) { - err = B_OK; - //XXX: WRITEME -/* BMessage msg(MSG_R5_SET_PREF); - BMessenger msgr(NULL, ainfo.team); - tp.x = 0; - tp.y = 0; - - //msg.AddData("", 'UBYT', &(tp.p), sizeof(struct tpref)); - msg.AddData("", 'UBYT', &(tp), sizeof(struct termprefs)); - msg.AddSpecifier("Window", 0L); - err = msgr.SendMessage(&msg); -*/ - } - } - } - } - - return B_OK; -} - - -status_t -TerminalThemesAddon::MakeThemeHaiku(BMessage &theme, uint32 flags) -{ - BMessage termpref; - BMessage lines; - status_t err; - BPath pTermPref; - - (void)flags; - err = MyMessage(theme, termpref); - if (err) - termpref.MakeEmpty(); - - err = LoadHaikuTerminalSettings(lines); - - //XXX: WRITEME - -/* - char buffer[1024]; - char key[B_FIELD_NAME_LENGTH], data[512]; - int n; - FILE *file; - while (fgets(buffer, sizeof(buffer), file) != NULL) { - if (*buffer == '#') - continue; - - n = sscanf(buffer, "%*[\"]%[^\"]%*[\"]%*[^\"]%*[\"]%[^\"]", key, data); - if (n == 2) { - if (strstr(key, " Color")) { - rgb_color color; - int r, g, b; - n = sscanf(data, "%3d, %3d, %3d", &r, &g, &b); - color.red = r; - color.green = g; - color.blue = b; - color.alpha = 255; - - } else - lines.AddString(key, data); - } - } -*/ -/* - BFile fTermPref(pTermPref.Path(), B_READ_ONLY); - if (fTermPref.InitCheck() != B_OK) - return fTermPref.InitCheck(); - if (fTermPref.Read(&tp, sizeof(struct termprefs)) < (ssize_t)sizeof(struct termprefs)) - return EIO; - if ((tp.magic != TP_MAGIC) || (tp.version != TP_VERSION)) - return EINVAL; - termpref.AddInt32(TP_COLS, tp.p.cols); - termpref.AddInt32(TP_ROWS, tp.p.rows); - termpref.AddInt32(TP_TABWIDTH, tp.p.tab_width); - BFont tFont; - font_family ff; - font_style fs; - BString str(tp.p.font); - str.Truncate(str.FindFirst('/')); - strncpy(ff, str.String(), sizeof(ff)); - str.SetTo(tp.p.font); - str.Remove(0, str.FindFirst('/')+1); - strncpy(fs, str.String(), sizeof(fs)); - tFont.SetFamilyAndStyle(ff, fs); - tFont.SetSize(tp.p.font_size); - 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); - return B_OK; -} - - -status_t -TerminalThemesAddon::LoadHaikuTerminalSettings(BMessage &into) -{ - BPath pTermPref; - char buffer[1024]; - char key[B_FIELD_NAME_LENGTH], data[512]; - int n; - FILE *file; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) - return EINVAL; -#ifdef __HAIKU__ - pTermPref.Append("Terminal_settings"); -#else - pTermPref.Append("HaikuTerminal_settings"); -#endif - // cf PrefHandler.cpp - file = fopen(pTermPref.Path(), "r"); - if (file == NULL) - return B_ENTRY_NOT_FOUND; - - while (fgets(buffer, sizeof(buffer), file) != NULL) { - if (*buffer == '#') - continue; - - n = sscanf(buffer, "%*[\"]%[^\"]%*[\"]%*[^\"]%*[\"]%[^\"]", key, data); - if (n == 2) { - into.AddString(key, data); - } - } - fclose(file); - return B_OK; -} - - -status_t -TerminalThemesAddon::SaveHaikuTerminalSettings(BMessage &from) -{ - BMessage settings; - status_t err; - BPath pTermPref; - - // load existing - err = LoadHaikuTerminalSettings(settings); - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &pTermPref) < B_OK) - return EINVAL; -#ifdef __HAIKU__ - pTermPref.Append("Terminal_settings"); -#else - pTermPref.Append("HaikuTerminal_settings"); -#endif - - BFile file(pTermPref.Path(), B_WRITE_ONLY | B_CREATE_FILE | B_ERASE_FILE); - char buffer[512]; - type_code type; - char *key; - err = file.InitCheck(); - if (err < B_OK) - return err; - - // merge new values - for (int32 i = 0; - from.GetInfo(B_STRING_TYPE, i, GET_INFO_NAME_PTR(&key), &type) == B_OK; - i++) { - BString s; - if (from.FindString(key, &s) < B_OK) - continue; - settings.RemoveName(key); - settings.AddString(key, s.String()); - } - - for (int32 i = 0; - settings.GetInfo(B_STRING_TYPE, i, GET_INFO_NAME_PTR(&key), &type) == B_OK; - i++) { - BString s; - if (settings.FindString(key, &s) < B_OK) - continue; - int len = snprintf(buffer, sizeof(buffer), "\"%s\" , \"%s\"\n", key, s.String()); - file.Write(buffer, len); - } - return B_OK; -} - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new TerminalThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/addons/WinampSkinAddon.cpp b/3rdparty/mmu_man/themes/addons/WinampSkinAddon.cpp deleted file mode 100644 index c0891f345b..0000000000 --- a/3rdparty/mmu_man/themes/addons/WinampSkinAddon.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2000-2008, François Revol, . All rights reserved. - * Distributed under the terms of the MIT License. - */ - -/* - * WinampSkin ThemesAddon class - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "ThemesAddon.h" -#include "UITheme.h" - -#ifdef SINGLE_BINARY -#define instantiate_themes_addon instantiate_themes_addon_winamp_skin -#endif - -#define A_NAME "Winamp Skin" -#define A_MSGNAME Z_THEME_WINAMP_SKIN_SETTINGS -#define A_DESCRIPTION "Handle CL-Amp and SoundPlay (not yet) Skins - requires SkinSelector plugin to be activated in CL-Amp and SoundPlay." - -#define CL_SETTINGS_NAME "CL-Amp/CL-Amp.preferences" -#define CL_APP_SIG "application/x-vnd.ClaesL-CLAmp" -#define SP_SETTINGS_NAME "PrefServer/pref0:$USER:application:x-vnd.marcone-soundplay" -//BMessage('save') { -//skinpath = string("/wincrash/Program Files/Winamp/Skins", 37 bytes) -//skinname = string("/wincrash/Program Files/Winamp/Skins/XP_Amp_2.wsz", 50 bytes) } -#define SP_APP_SIG "application/x-vnd.marcone-soundplay" -#define USE_CL 1 -#define USE_SP 2 - - -class WinampSkinThemesAddon : public ThemesAddon { -public: - WinampSkinThemesAddon(); - ~WinampSkinThemesAddon(); - -const char *Description(); - -status_t RunPreferencesPanel(); - -status_t AddNames(BMessage &names); - -status_t ApplyTheme(BMessage &theme, uint32 flags=0L); -status_t MakeTheme(BMessage &theme, uint32 flags=0L); - -status_t ApplyDefaultTheme(uint32 flags=0L); - -int32 WhichApp(); /* which app should I use to repport current skin? */ -status_t CLSkin(BString *to, bool preffile = false); -status_t SPSkin(BString *to, bool preffile = false); -status_t CLSkinPath(BPath *to); -status_t SPSkinPath(BPath *to); -status_t SetCLSkin(BString *from); -status_t SetSPSkin(BString *from); -status_t StripPath(BString *path); -}; - - -WinampSkinThemesAddon::WinampSkinThemesAddon() - : ThemesAddon(A_NAME, A_MSGNAME) -{ -} - - -WinampSkinThemesAddon::~WinampSkinThemesAddon() -{ -} - - -const char * -WinampSkinThemesAddon::Description() -{ - return A_DESCRIPTION; -} - - -status_t -WinampSkinThemesAddon::RunPreferencesPanel() -{ - return B_OK; -} - - -status_t -WinampSkinThemesAddon::AddNames(BMessage &names) -{ - names.AddString(Z_THEME_WINAMP_SKIN_SETTINGS, "CLAmp/SoundPlay Skin Settings"); - return B_OK; -} - - -status_t -WinampSkinThemesAddon::ApplyTheme(BMessage &theme, uint32 flags) -{ - BMessage skin; - BString name; - status_t err; - - if (!(flags & UI_THEME_SETTINGS_SET_ALL) || !(AddonFlags() & Z_THEME_ADDON_DO_SET_ALL)) - return B_OK; - - err = MyMessage(theme, skin); - if (err) - return err; - - err = skin.FindString("winamp:skin", &name); - if (err) - return err; - SetCLSkin(&name); - SetSPSkin(&name); - return B_OK; -} - - -status_t -WinampSkinThemesAddon::MakeTheme(BMessage &theme, uint32 flags) -{ - BMessage skin; - BString name; - status_t err = B_ERROR; - - (void)flags; - err = MyMessage(theme, skin); - if (err) - skin.MakeEmpty(); - - if (WhichApp() == USE_CL) - err = CLSkin(&name); - else - err = SPSkin(&name); - /* try the other way round */ - if (err) { - if (WhichApp() == USE_CL) - err = CLSkin(&name, true); - else - err = SPSkin(&name, true); - } - if (!err) - skin.AddString("winamp:skin", name); - err = SetMyMessage(theme, skin); - return err; -} - - -status_t -WinampSkinThemesAddon::ApplyDefaultTheme(uint32 flags) -{ - BMessage theme; - BMessage skin; - skin.AddString("skin", "none"); - theme.AddMessage(Z_THEME_WINAMP_SKIN_SETTINGS, &skin); - return ApplyTheme(theme, flags); -} - - -int32 -WinampSkinThemesAddon::WhichApp() -{ - // XXX -/* - BMessenger spmsgr(SP_APP_SIG); - if (spmsgr.IsValid()) { - PRINT(("WinampSkinThemesAddon: SoundPlay BMessenger valid\n")); - return USE_SP; - }*/ - BMessenger clmsgr(CL_APP_SIG); - if (clmsgr.IsValid()) { - PRINT(("WinampSkinThemesAddon: CL-Amp BMessenger valid\n")); - return USE_CL; - } - return USE_SP; -} - - -status_t -WinampSkinThemesAddon::CLSkin(BString *to, bool preffile) -{ - if (preffile) { - BPath CLSPath; - char buffer[B_FILE_NAME_LENGTH+1]; - - if (!to) - return EINVAL; - buffer[B_FILE_NAME_LENGTH] = '\0'; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &CLSPath) < B_OK) - return B_ERROR; - CLSPath.Append(CL_SETTINGS_NAME); - BFile CLSettings(CLSPath.Path(), B_READ_ONLY); - if (CLSettings.InitCheck() < B_OK) - return CLSettings.InitCheck(); - ssize_t got = CLSettings.ReadAt(0x8LL, buffer, B_FILE_NAME_LENGTH); - if (got < B_FILE_NAME_LENGTH) - return EIO; - *to = buffer; - StripPath(to); - return B_ERROR; - } - BMessenger msgr(CL_APP_SIG); - BMessage msg('skin'); - BMessage reply; - msgr.SendMessage(&msg, &reply, 500000, 500000); - if (reply.FindString("result", to) >= B_OK) { - StripPath(to); - return B_OK; - } - return B_ERROR; -} - - -status_t -WinampSkinThemesAddon::SPSkin(BString *to, bool preffile) -{ - if (preffile) { - status_t err; - BMessage settings; - BPath SPSPath; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK) - return B_ERROR; - BString leaf(SP_SETTINGS_NAME); - BString user(getenv("USER")); - user.RemoveFirst("USER="); - leaf.IReplaceFirst("$USER", user.String()); - SPSPath.Append(leaf.String()); - PRINT(("SPP %s\n", SPSPath.Path())); - BFile SPSettings(SPSPath.Path(), B_READ_ONLY); - if (SPSettings.InitCheck() < B_OK) - return SPSettings.InitCheck(); - if (settings.Unflatten(&SPSettings) < B_OK) - return EIO; - err = settings.FindString("skinname", to); - StripPath(to); - return err; - } - BMessenger msgr(SP_APP_SIG); - BMessage msg('skin'); - BMessage reply; - msgr.SendMessage(&msg, (BHandler *)NULL, 500000); - if (reply.FindString("result", to) >= B_OK) { - StripPath(to); - return B_OK; - } - return B_ERROR; -} - - -status_t -WinampSkinThemesAddon::CLSkinPath(BPath *to) -{ - char buffer[B_FILE_NAME_LENGTH+1]; - BPath CLSPath; - - buffer[B_FILE_NAME_LENGTH] = '\0'; - if (find_directory(B_USER_SETTINGS_DIRECTORY, &CLSPath) < B_OK) - return B_ERROR; - CLSPath.Append(CL_SETTINGS_NAME); - BFile CLSettings(CLSPath.Path(), B_READ_ONLY); - if (CLSettings.InitCheck() < B_OK) - return CLSettings.InitCheck(); - ssize_t got = CLSettings.ReadAt(0x150LL, buffer, B_FILE_NAME_LENGTH); - if (got < B_FILE_NAME_LENGTH) - return EIO; - to->SetTo(buffer); - return B_OK; -} - - -status_t -WinampSkinThemesAddon::SPSkinPath(BPath *to) -{ - status_t err; - BMessage settings; - BPath SPSPath; - BString str; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK) - return B_ERROR; - BString leaf(SP_SETTINGS_NAME); - BString user(getenv("USER")); - user.RemoveFirst("USER="); - leaf.IReplaceFirst("$USER", user.String()); - SPSPath.Append(leaf.String()); - BFile SPSettings(SPSPath.Path(), B_READ_ONLY); - if (SPSettings.InitCheck() < B_OK) - return SPSettings.InitCheck(); - if (settings.Unflatten(&SPSettings) < B_OK) - return EIO; - err = settings.FindString("skinpath", &str); - PRINT(("SPSP %s\n", str.String())); - to->SetTo(str.String()); - return err; -} - - -status_t -WinampSkinThemesAddon::SetCLSkin(BString *from) -{ - status_t err; - BPath p; - err = CLSkinPath(&p); - if (err < B_OK) - return err; - p.Append(from->String()); - /* update the prefs file */ - BPath CLSPath; - - if (!from) - return EINVAL; - /* CL-Amp doesn't grok long names */ - if (strlen(p.Path()) >= B_FILE_NAME_LENGTH) - return B_NAME_TOO_LONG; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &CLSPath) < B_OK) - return B_ERROR; - CLSPath.Append(CL_SETTINGS_NAME); - BFile CLSettings(CLSPath.Path(), B_WRITE_ONLY); - if (CLSettings.InitCheck() < B_OK) - return CLSettings.InitCheck(); - CLSettings.WriteAt(0x8LL, p.Path(), strlen(p.Path())+1); - - /* then tell the app */ - BMessenger msgr(CL_APP_SIG); - BMessage msg('skin'); - msg.AddString("name", p.Path()); - msg.PrintToStream(); - msgr.SendMessage(&msg, (BHandler *)NULL, 500000); - return B_OK; -} - - -status_t -WinampSkinThemesAddon::SetSPSkin(BString *from) -{ - status_t err; - BPath p; - err = SPSkinPath(&p); - if (err < B_OK) - return err; - p.Append(from->String()); - err = p.InitCheck(); - if (err < B_OK) - return err; - - /* update the prefs file */ - BPath SPSPath; - BMessage settings; - - if (!from) - return EINVAL; - if (from->Length() >= B_PATH_NAME_LENGTH) - return B_NAME_TOO_LONG; - - if (find_directory(B_USER_SETTINGS_DIRECTORY, &SPSPath) < B_OK) - return B_ERROR; - BString leaf(SP_SETTINGS_NAME); - BString user(getenv("USER")); - user.RemoveFirst("USER="); - leaf.IReplaceFirst("$USER", user.String()); - SPSPath.Append(leaf.String()); - PRINT(("SPP %s\n", SPSPath.Path())); - BFile SPSettings(SPSPath.Path(), B_READ_WRITE); - PRINT(("SP:BFile\n")); - if (SPSettings.InitCheck() < B_OK) - return SPSettings.InitCheck(); - PRINT(("SP:BFile::InitCheck\n")); - //SPSettings.WriteAt(0x8LL, from->String(), from->Length()+1); - if (settings.Unflatten(&SPSettings) < B_OK) - return EIO; - PRINT(("SP:Unflatten\n")); - settings.ReplaceString("skinname", p.Path()); - PRINT(("SP:Replace\n")); - SPSettings.Seek(0LL, SEEK_SET); - if (settings.Flatten(&SPSettings) < B_OK) - return EIO; - PRINT(("SP:Flatten\n")); - - /* then tell the app */ - /* first make sure the native BeOS is shown (the 'sk!n' message toggles, wonder Why TF...) */ - bool beosIfaceHidden; - BMessenger msgr(SP_APP_SIG); - - BMessage command(B_GET_PROPERTY); - BMessage answer; - command.AddSpecifier("Hidden"); - command.AddSpecifier("Window", 0L); // TitleSpectrumAnalyzer does change the title from "SoundPlay"! - err = msgr.SendMessage(&command, &answer,(bigtime_t)2E6,(bigtime_t)2E6); - if(B_OK == err) { - if (answer.FindBool("result", &beosIfaceHidden) != B_OK) - beosIfaceHidden = false; - } else { - PRINT(("WinampSkinThemesAddon: couldn't talk to SoundPlay: error 0x%08lx\n", err)); - return EIO; - } - - BMessage msg('sk!n'); - msg.AddString("path", p.Path()); - msg.PrintToStream(); - if (!beosIfaceHidden) { // native GUI is active - // -> sending the message to the App will make ituse the skin for all tracks - PRINT(("SP:Sending to app\n")); - msgr.SendMessage(&msg, (BHandler *)NULL, 500000); - } else { // native GUI is hidden (= winamp GUI used) - int32 wincnt; - command.MakeEmpty(); - command.what = B_COUNT_PROPERTIES; - answer.MakeEmpty(); - command.AddSpecifier("Window"); - err = msgr.SendMessage(&command, &answer,(bigtime_t)2E6,(bigtime_t)2E6); - if(B_OK == err) { - if (answer.FindInt32("result", &wincnt) != B_OK) - wincnt = 1; - } else { - PRINT(("WinampSkinThemesAddon: couldn't talk to SoundPlay: (2) error 0x%08lx\n", err)); - return EIO; - } - // send to all windows but first one. - for (int32 i = 1; i < wincnt; i++) { - BMessage wmsg(msg); - PRINT(("SP:Sending to window %ld\n", i)); - wmsg.AddSpecifier("Window", i); - wmsg.PrintToStream(); - msgr.SendMessage(&wmsg, (BHandler *)NULL, 500000); - } - } - return B_OK; -} - - -status_t -WinampSkinThemesAddon::StripPath(BString *path) -{ - if (!path) - return EINVAL; - BPath p(path->String()); - *path = p.Leaf(); - return B_OK; -} - - - -ThemesAddon * -instantiate_themes_addon() -{ - return (ThemesAddon *) new WinampSkinThemesAddon; -} - diff --git a/3rdparty/mmu_man/themes/doc/README.html b/3rdparty/mmu_man/themes/doc/README.html deleted file mode 100644 index deeb09945e..0000000000 --- a/3rdparty/mmu_man/themes/doc/README.html +++ /dev/null @@ -1,104 +0,0 @@ - - - -Theme Manager for BeOS and Haiku - - - -

Theme Manager for BeOS and Haiku

-© 2000-2008, François Revol. - -

About

-

-Theme Manager allows you to change the appearance of BeOS (R5, Dano0 and Zeta) and Haiku. -It packages various interface settings in a single file and allows applying them on the fly. -

- -

Licence

-

-Theme Manager is distributed under the MIT licence.
-Sources are available in the Haiku subversion repository, and documented here and there. -

-

Features

-

There are a many settings that are saved and restored by Theme Manager, depending on the platform. For example BeOS R5 doesn't support changing system colors. Each feature can be selectively disabled for applying and saving. -

-
-
Backgrounds
-
Wallpapers and background color
-
BeIDE Colors
-
Applies the system document colors to BeIDE.
-
Deskbar
-
Saves and restores Deskbar location.
-
Eddie Colors
-
Applies the system document colors to the Eddie editor.
-
Pe Colors
-
Applies the system document colors to the Pe editor.
-
Screensaver
-
Saves and restores the screensaver and its settings.
-
SoundPlay Color
-
Applies the system colors to running instances of SoundPlay by simulating a color drop on the window.
-
Sounds
-
Saves and restores system sounds.
-
Terminal
-
Saves and restores the Terminal fonts, colors and size.
-
System Colors and Fonts
-
Saves and restores system colors and fonts.
-
Winamp Skin
-
Saves and restores the selected Winamp skin of both CL-Amp and SoundPlay.
-
Window Decor
-
Saves and restores the window decor.
-
-

Changing icons isn't yet supported.

-

BeTheme Import

-BeTheme themes are searched for on BFS partitions and imported. Icons aren't supported yet, but backgrounds, deskbar position and window decor are supported. -

MSTheme Import

-MS .theme files are searched for on NTFS partitions and imported. Icons aren't supported yet, but colors and sounds are applied, window decor and deskbar position are forced to mimic Windows. -

Feature Grid

- - - - - - - - - - - - - - - -
FeatureR5Dano/ZetaHaikuBeTheme (import)MSTheme (import)
BackgroundsXXXXX
BeIDE ColorsXXX
DeskbarXXXX(forced)
Eddie ColorsXXX
Pe ColorsXXX
ScreensaverXXXX
SoundPlay ColorXXX
SoundsXXXX
TerminalXXX
System ColorsXXX
System FontsXXX
Winamp SkinXXX
Window DecorXXXXX
- -

Installation

-

Application

-Just unzip the version of the Themes binary you need. -

Themes

-Themes are stored in folders containing a plain text "Theme" descriptor file, optionally a screenshot file for the preview, and eventually other files (bitmaps, sounds...). -Themes folders go to ~/config/settings/UIThemes/. - -

Usage

-The interface should be self-describing. -
-On the left themes are listed, native first, then imported ones. Read-only theme items (from /etc/UIThemes and imported) have a different item background color. -
-The "New" button creates a new empty theme. -
-The "Save" button saves the current settings to the selected theme. -
-The "Delete" button moves the selected theme (its folder and files) to the Trash, from where it can eventually be recovered. -
-The "Add Screenshot" hides Themes window, takes a screenshot and attaches it to the selected theme. -
-The "Apply" button changes settings to match the selected theme. -
- -
-The "Show Options" button brings a list of checkboxes to enable or disable selectively each feature on theme change. Click "Show Preview" to go back to the preview display. -
- -
- - - diff --git a/3rdparty/mmu_man/themes/doc/images/shot_themes_001.png b/3rdparty/mmu_man/themes/doc/images/shot_themes_001.png deleted file mode 100644 index 4be485ffe4..0000000000 Binary files a/3rdparty/mmu_man/themes/doc/images/shot_themes_001.png and /dev/null differ diff --git a/3rdparty/mmu_man/themes/doc/images/shot_themes_002.png b/3rdparty/mmu_man/themes/doc/images/shot_themes_002.png deleted file mode 100644 index 57972688de..0000000000 Binary files a/3rdparty/mmu_man/themes/doc/images/shot_themes_002.png and /dev/null differ