void compatibleReadStyle() { char styleFile[MAX_PATH]; strcpy(styleFile, stylePath()); ReadFont(styleFile); mSkin.borderWidth = ReadInt(styleFile, "borderWidth:", 1); mSkin.borderWidth = ReadInt(styleFile, "window.frame.borderWidth:", mSkin.borderWidth); strcpy(borderColorAsString, ReadString(styleFile, "borderColor:", "0x000000")); mSkin.focus_borderColor = ReadColor(styleFile, "window.frame.focus.borderColor:", borderColorAsString); mSkin.unfocus_borderColor = ReadColor(styleFile, "window.frame.unfocus.borderColor:", borderColorAsString); mSkin.handleHeight = ReadInt(styleFile, "handleWidth:", 5); mSkin.handleHeight = ReadInt(styleFile, "window.handleHeight:", mSkin.handleHeight); ReadStyleElement(styleFile, &mSkin.windowTitleFocus, "window.title.focus"); ReadStyleElement(styleFile, &mSkin.windowLabelFocus, "window.label.focus"); ReadStyleElement(styleFile, &mSkin.windowHandleFocus, "window.handle.focus"); ReadStyleElement(styleFile, &mSkin.windowGripFocus, "window.grip.focus"); ReadStyleElement(styleFile, &mSkin.windowButtonFocus, "window.button.focus"); ReadStyleElement(styleFile, &mSkin.windowButtonPressed, "window.button.pressed"); ReadStyleElement(styleFile, &mSkin.windowTitleUnfocus, "window.title.unfocus"); ReadStyleElement(styleFile, &mSkin.windowLabelUnfocus, "window.label.unfocus"); ReadStyleElement(styleFile, &mSkin.windowHandleUnfocus, "window.handle.unfocus"); ReadStyleElement(styleFile, &mSkin.windowGripUnfocus, "window.grip.unfocus"); ReadStyleElement(styleFile, &mSkin.windowButtonUnfocus, "window.button.unfocus"); }
LRESULT CALLBACK BBNoteProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case BB_GETSTYLE: return BBSendData((HWND)lParam, BB_SENDDATA, wParam, stylePath(), -1); case WM_COPYDATA: return BBReceiveData(hwnd, lParam, NULL); default: if (uMsg >= BB_MSGFIRST && uMsg < BB_MSGLAST) { if (BB_SETSTYLE == uMsg && 0 == lParam) return PostMessage(BBhwnd, uMsg, wParam, lParam); else return SendMessage(BBhwnd, uMsg, wParam, lParam); } else { return DefWindowProc(hwnd, uMsg, wParam, lParam); } } }
QJsonObject AndroidStyle::loadStyleData() { QString stylePath(QLatin1String(qgetenv("MINISTRO_ANDROID_STYLE_PATH"))); const QLatin1Char slashChar('/'); if (!stylePath.isEmpty() && !stylePath.endsWith(slashChar)) stylePath += slashChar; QString androidTheme = QLatin1String(qgetenv("QT_ANDROID_THEME")); if (!androidTheme.isEmpty() && !androidTheme.endsWith(slashChar)) androidTheme += slashChar; if (stylePath.isEmpty()) { stylePath = QLatin1String("/data/data/org.kde.necessitas.ministro/files/dl/style/") + QLatin1String(qgetenv("QT_ANDROID_THEME_DISPLAY_DPI")) + slashChar; } Q_ASSERT(!stylePath.isEmpty()); if (!androidTheme.isEmpty() && QFileInfo(stylePath + androidTheme + QLatin1String("style.json")).exists()) stylePath += androidTheme; QFile f(stylePath + QLatin1String("style.json")); if (!f.open(QIODevice::ReadOnly)) return QJsonObject(); QJsonParseError error; QJsonDocument document = QJsonDocument::fromJson(f.readAll(), &error); if (document.isNull()) { qCritical() << error.errorString(); return QJsonObject(); } if (!document.isObject()) { qCritical() << "Style.json does not contain a valid style."; return QJsonObject(); } return document.object(); }
//============================================================================= bool get_style(StyleItem *si, const char *key) { const char *s, *p; COLORREF c; int w; char fullkey[80], *r; memset(si, 0, sizeof *si); r = strchr(strcpy(fullkey, key), 0); s = stylePath(); strcpy(r, ".appearance:"); p = ReadString(s, fullkey, NULL); if (p) { si->bordered = IsInString(p, "border"); } else { strcpy(r, ":"); p = ReadString(s, fullkey, NULL); if (NULL == p) return false; si->bordered = true; } ParseItem(p, si); if (B_SOLID != si->type || si->interlaced) strcpy(r, ".color1:"); else strcpy(r, ".backgroundColor:"); c = ReadColor(s, fullkey, NULL); if ((COLORREF)-1 == c) { strcpy(r, ".color:"); c = ReadColor(s, fullkey, NULL); if ((COLORREF)-1 == c) return false; } si->Color = si->ColorTo = c; if (B_SOLID != si->type || si->interlaced) { strcpy(r, ".color2:"); c = ReadColor(s, fullkey, NULL); if ((COLORREF)-1 == c) { strcpy(r, ".colorTo:"); c = ReadColor(s, fullkey, NULL); } if ((COLORREF)-1 != c) si->ColorTo = c; } if (si->bordered) { strcpy(r, ".borderColor:"); c = ReadColor(s, fullkey, NULL); if ((COLORREF)-1 != c) si->borderColor = c; else si->borderColor = ReadColor(s, "borderColor:", "black"); strcpy(r, ".borderWidth:"); w = ReadInt(s, fullkey, -100); if (-100 != w) si->borderWidth = w; else si->borderWidth = ReadInt(s, "borderWidth:", 1); } strcpy(r, ".marginWidth:"); w = ReadInt(s, fullkey, -100); if (-100 != w) si->marginWidth = w; else si->marginWidth = ReadInt(s, "bevelWidth:", 2); return true; }
void GetStyleSettings() { // Get the path to the current style file from Blackbox... strcpy(stylepath, stylePath()); // ...and some additional parameters bevelWidth = ReadInt(stylepath, "bevelWidth:", 2); borderWidth = ReadInt(stylepath, "borderWidth:", 1); // Get the applicable color settings from the current style... backColor = ReadColor(stylepath, "toolbar.color:", "#000000"); backColorTo = ReadColor(stylepath, "toolbar.colorTo:", "#FFFFFF"); borderColor = ReadColor(stylepath, "borderColor:", "#000000"); // ...gradient type, bevel etc. from toolbar:(using a StyleItem)... char tempstyle[MAX_LINE_LENGTH]; strcpy(tempstyle, ReadString(stylepath, "toolbar:", "Flat Gradient Vertical")); if (myStyleItem) delete myStyleItem; myStyleItem = new StyleItem; ParseItem(tempstyle, myStyleItem); if(StrStrI(windowStyle, "label") != NULL && strlen(windowStyle) < 6) { // ...gradient type, bevel etc. from toolbar.label:(using a StyleItem)... char tempstyle2[MAX_LINE_LENGTH]; strcpy(tempstyle2, ReadString(stylepath, "toolbar.label:", "parentrelative")); if (!IsInString("", tempstyle2)&&!IsInString(tempstyle2, "parentrelative")) { if (myStyleItem2) delete myStyleItem2; //if everything is found in toolbar.label: then make a new StyleItem myStyleItem2 = new StyleItem; ParseItem(tempstyle2, myStyleItem2); if (!IsInString("", ReadString(stylepath, "toolbar.label.color:", ""))) backColor2 = ReadColor(stylepath, "toolbar.label.color:", "#000000"); else backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); if (!IsInString("", ReadString(stylepath, "toolbar.label.colorTo:", ""))) backColorTo2 = ReadColor(stylepath, "toolbar.label.colorTo:", "#000000"); else backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); fontColor = ReadColor(stylepath, "toolbar.label.textColor:", "#FFFFFF"); } else { if (myStyleItem2) delete myStyleItem2; //else use the the toolbar: settings myStyleItem2 = new StyleItem; ParseItem(tempstyle, myStyleItem2); //use original tempstyle if "parentrelative" backColor2 = backColor; //have to do this if parent relative found, it seems bb4win uses backColorTo2 = backColorTo; //the toolbar.color if parent relative is found for toolbar.label fontColor = ReadColor(stylepath, "toolbar.textColor:", "#FFFFFF"); } } else if(StrStrI(windowStyle, "windowlabel") != NULL) { // ...gradient type, bevel etc. from toolbar.windowLabel:(using a StyleItem)... char tempstyle2[MAX_LINE_LENGTH]; strcpy(tempstyle2, ReadString(stylepath, "toolbar.windowLabel:", "parentrelative")); if (!IsInString("", tempstyle2)&&!IsInString(tempstyle2, "parentrelative")) { if (myStyleItem2) delete myStyleItem2; //if everything is found in toolbar.windowLabel: then make a new StyleItem myStyleItem2 = new StyleItem; ParseItem(tempstyle2, myStyleItem2); if (!IsInString("", ReadString(stylepath, "toolbar.windowLabel.color:", ""))) backColor2 = ReadColor(stylepath, "toolbar.windowLabel.color:", "#000000"); else backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); if (!IsInString("", ReadString(stylepath, "toolbar.windowLabel.colorTo:", ""))) backColorTo2 = ReadColor(stylepath, "toolbar.windowLabel.colorTo:", "#000000"); else backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); fontColor = ReadColor(stylepath, "toolbar.windowLabel.textColor:", "#FFFFFF"); } } else if(StrStrI(windowStyle, "toolbar") != NULL) { if (myStyleItem2) delete myStyleItem2; //else use the the toolbar: settings myStyleItem2 = new StyleItem; ParseItem(tempstyle, myStyleItem2); //use original tempstyle if "parentrelative" backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); //have to do this if parent relative found, it seems bb4win uses backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); //the toolbar.color if parent relative is found for toolbar.windowLabel fontColor = ReadColor(stylepath, "toolbar.textColor:", "#FFFFFF"); } else if(StrStrI(windowStyle, "buttonpr") != NULL) { // ...gradient type, bevel etc. from toolbar.windowLabel:(using a StyleItem)... char tempstyle2[MAX_LINE_LENGTH]; strcpy(tempstyle2, ReadString(stylepath, "toolbar.button.pressed:", "parentrelative")); if (!IsInString("", tempstyle2)&&!IsInString(tempstyle2, "parentrelative")) { if (myStyleItem2) delete myStyleItem2; //if everything is found in toolbar.windowLabel: then make a new StyleItem myStyleItem2 = new StyleItem; ParseItem(tempstyle2, myStyleItem2); if (!IsInString("", ReadString(stylepath, "toolbar.button.pressed.color:", ""))) backColor2 = ReadColor(stylepath, "toolbar.button.pressed.color:", "#000000"); else backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); if (!IsInString("", ReadString(stylepath, "toolbar.button.pressed.colorTo:", ""))) backColorTo2 = ReadColor(stylepath, "toolbar.button.pressed.colorTo:", "#000000"); else backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); fontColor = ReadColor(stylepath, "toolbar.button.pressed.picColor:", "#FFFFFF"); } else { if (myStyleItem2) delete myStyleItem2; //else use the the toolbar: settings myStyleItem2 = new StyleItem; ParseItem(tempstyle, myStyleItem2); //use original tempstyle if "parentrelative" backColor2 = backColor; //have to do this if parent relative found, it seems bb4win uses backColorTo2 = backColorTo; //the toolbar.color if parent relative is found for toolbar.clock fontColor = ReadColor(stylepath, "toolbar.textColor:", "#FFFFFF"); } } else if(StrStrI(windowStyle, "buttonnp") != NULL) { // ...gradient type, bevel etc. from toolbar.windowLabel:(using a StyleItem)... char tempstyle2[MAX_LINE_LENGTH]; strcpy(tempstyle2, ReadString(stylepath, "toolbar.button:", "parentrelative")); if (!IsInString("", tempstyle2)&&!IsInString(tempstyle2, "parentrelative")) { if (myStyleItem2) delete myStyleItem2; //if everything is found in toolbar.windowLabel: then make a new StyleItem myStyleItem2 = new StyleItem; ParseItem(tempstyle2, myStyleItem2); if (!IsInString("", ReadString(stylepath, "toolbar.button.color:", ""))) backColor2 = ReadColor(stylepath, "toolbar.button.color:", "#000000"); else backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); if (!IsInString("", ReadString(stylepath, "toolbar.button.colorTo:", ""))) backColorTo2 = ReadColor(stylepath, "toolbar.button.colorTo:", "#000000"); else backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); fontColor = ReadColor(stylepath, "toolbar.button.picColor:", "#FFFFFF"); } else { if (myStyleItem2) delete myStyleItem2; //else use the the toolbar: settings myStyleItem2 = new StyleItem; ParseItem(tempstyle, myStyleItem2); //use original tempstyle if "parentrelative" backColor2 = backColor; //have to do this if parent relative found, it seems bb4win uses backColorTo2 = backColorTo; //the toolbar.color if parent relative is found for toolbar.clock fontColor = ReadColor(stylepath, "toolbar.textColor:", "#FFFFFF"); } } else { // ...gradient type, bevel etc. from toolbar.clock:(using a StyleItem)... char tempstyle2[MAX_LINE_LENGTH]; strcpy(tempstyle2, ReadString(stylepath, "toolbar.clock:", "parentrelative")); if (!IsInString("", tempstyle2)&&!IsInString(tempstyle2, "parentrelative")) { if (myStyleItem2) delete myStyleItem2; //if everything is found in toolbar.clock: then make a new StyleItem myStyleItem2 = new StyleItem; ParseItem(tempstyle2, myStyleItem2); if (!IsInString("", ReadString(stylepath, "toolbar.clock.color:", ""))) backColor2 = ReadColor(stylepath, "toolbar.clock.color:", "#000000"); else backColor2 = ReadColor(stylepath, "toolbar.color:", "#FFFFFF"); if (!IsInString("", ReadString(stylepath, "toolbar.clock.colorTo:", ""))) backColorTo2 = ReadColor(stylepath, "toolbar.clock.colorTo:", "#000000"); else backColorTo2 = ReadColor(stylepath, "toolbar.colorTo:", "#000000"); fontColor = ReadColor(stylepath, "toolbar.clock.textColor:", "#FFFFFF"); } else { if (myStyleItem2) delete myStyleItem2; //else use the the toolbar: settings myStyleItem2 = new StyleItem; ParseItem(tempstyle, myStyleItem2); //use original tempstyle if "parentrelative" backColor2 = backColor; //have to do this if parent relative found, it seems bb4win uses backColorTo2 = backColorTo; //the toolbar.color if parent relative is found for toolbar.clock fontColor = ReadColor(stylepath, "toolbar.textColor:", "#FFFFFF"); } } // ...font settings... strcpy(fontFace, ReadString(stylepath, "toolbar.font:", "")); if (!_stricmp(fontFace, "")) strcpy(fontFace, ReadString(stylepath, "*font:", "Tahoma")); }