FBOptions::FBOptions() : LeftMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "LeftMargin", 0, 1000, std::min(ZLibrary::displayDPI() / 2, ZLibrary::displayPixelsWidth() / 40)), RightMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "RightMargin", 0, 1000, std::min(ZLibrary::displayDPI() / 2, ZLibrary::displayPixelsWidth() / 40)), TopMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "TopMargin", 0, 1000, ZLibrary::displayPixelsHeight() / 100), BottomMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "BottomMargin", 0, 1000, ZLibrary::displayPixelsHeight() / 100), BackgroundColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Background", ZLColor(255, 255, 255)), RegularTextColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Text", ZLColor(0, 0, 0)) { myColorOptions["internal"] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Hyperlink", ZLColor(33, 96, 180) ); myColorOptions["external"] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "ExternalHyperlink", ZLColor(33, 96, 180) ); myColorOptions["book"] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "BookHyperlink", ZLColor(23, 68, 128) ); myColorOptions[ZLTextStyle::SELECTION_BACKGROUND] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "SelectionBackground", ZLColor(82, 131, 194) ); myColorOptions[ZLTextStyle::HIGHLIGHTED_TEXT] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "SelectedText", ZLColor(60, 139, 255) ); myColorOptions[ZLTextStyle::TREE_LINES] = new ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLORS, "TreeLines", ZLColor(127, 127, 127) ); }
void ColorOptionView::onEvent(const std::string &event, W32EventSender&) { static std::string OPTION_PREFIX = "Color"; static std::string COLOR_GROUP_NAME = "ColorDialog"; if (event == W32PushButton::RELEASED_EVENT) { CHOOSECOLOR chooser; COLORREF refs[16]; for (int i = 0; i < 16; ++i) { std::string optionName = OPTION_PREFIX; ZLStringUtil::appendNumber(optionName, i); ZLColor color = ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLOR_GROUP_NAME, optionName, ZLColor(0, 0, 0) ).value(); refs[i] = RGB(color.Red, color.Green, color.Blue); } chooser.lStructSize = sizeof(chooser); chooser.hwndOwner = GetActiveWindow(); chooser.hInstance = 0; ZLColor currentColor = myStandardColorComboBox->selectedColor(); chooser.rgbResult = RGB(currentColor.Red, currentColor.Green, currentColor.Blue); chooser.lpCustColors = refs; chooser.Flags = CC_RGBINIT | CC_FULLOPEN | CC_SOLIDCOLOR; //chooser.lCustData = 0; //chooser.lpfnHook = 0; //chooser.lpTemplateName = 0; bool code = ChooseColor(&chooser) == TRUE; for (int i = 0; i < 16; ++i) { std::string optionName = OPTION_PREFIX; ZLStringUtil::appendNumber(optionName, i); ZLColor color(GetRValue(refs[i]), GetGValue(refs[i]), GetBValue(refs[i])); ZLColorOption( ZLCategoryKey::LOOK_AND_FEEL, COLOR_GROUP_NAME, optionName, ZLColor(0, 0, 0) ).setValue(color); } if (code) { ZLColor color(GetRValue(chooser.rgbResult), GetGValue(chooser.rgbResult), GetBValue(chooser.rgbResult)); myStandardColorComboBox->setSelectedColor(color); } } }
ZLColor ZLColorOption::value() const { if (!myIsSynchronized) { myIntValue = stringToInteger(getConfigValue(), myDefaultIntValue); myIsSynchronized = true; } return ZLColor(myIntValue); }
void ColorOptionView::_onAccept() const { ((ZLColorOptionEntry&)*myOption).onAccept(ZLColor( myColor.red * 255 / 65535, myColor.green * 255 / 65535, myColor.blue * 255 / 65535 )); }
void ColorOptionView::reset() { if (myDrawingArea == 0) { return; } ZLColorOptionEntry &colorEntry = (ZLColorOptionEntry&)*myOption; colorEntry.onReset(ZLColor( myColor.red * 255 / 65535, myColor.green * 255 / 65535, myColor.blue * 255 / 65535 )); const ZLColor &color = colorEntry.color(); gtk_range_set_value(GTK_RANGE(myRSlider), color.Red); gtk_range_set_value(GTK_RANGE(myGSlider), color.Green); gtk_range_set_value(GTK_RANGE(myBSlider), color.Blue); myColor.red = color.Red * 65535 / 255; myColor.blue = color.Blue * 65535 / 255; myColor.green = color.Green * 65535 / 255; gtk_widget_modify_bg(myDrawingArea, GTK_STATE_NORMAL, &myColor); }
void ColorOptionView::reset() { if (myDrawingArea == 0) { return; } ZLColorOptionEntry &colorEntry = (ZLColorOptionEntry&)*myOption; colorEntry.onReset(ZLColor( myColor.red * 255 / 65535, myColor.green * 255 / 65535, myColor.blue * 255 / 65535 )); const ZLColor &color = colorEntry.color(); hildon_controlbar_set_value(myRSlider, (int)color.Red * COLOR_STEPS_NUMBER / 255); hildon_controlbar_set_value(myGSlider, (int)color.Green * COLOR_STEPS_NUMBER / 255); hildon_controlbar_set_value(myBSlider, (int)color.Blue * COLOR_STEPS_NUMBER / 255); myColor.red = color.Red * 65535 / 255; myColor.blue = color.Blue * 65535 / 255; myColor.green = color.Green * 65535 / 255; gtk_widget_modify_bg(myDrawingArea, GTK_STATE_NORMAL, &myColor); }
ZLColor BooksTextView::color(const std::string &aStyle) const { static const std::string INTERNAL_HYPERLINK("internal"); static const std::string EXTERNAL_HYPERLINK("external"); static const std::string BOOK_HYPERLINK("book"); if (ZLStringUtil::startsWith(aStyle, '#')) { if (aStyle.length() == 7) { int i, value = 0; for (i=1; i<7; i++) { int nibble = ZLStringUtil::fromHex(aStyle[i]); if (nibble >= 0) { value <<= 4; value |= nibble; } else { break; } } if (i == 7) { return iPaintContext.realColor(ZLColor(value)); } } } else if (aStyle == INTERNAL_HYPERLINK) { return iPaintContext.realColor(33, 96, 180); } else if (aStyle == EXTERNAL_HYPERLINK) { return iPaintContext.realColor(33, 96, 180); } else if (aStyle == BOOK_HYPERLINK) { return iPaintContext.realColor(23, 68, 128); } else if (aStyle == ZLTextStyle::SELECTION_BACKGROUND) { return iPaintContext.realColor(82, 131, 194); } else if (aStyle == ZLTextStyle::HIGHLIGHTED_TEXT) { return iPaintContext.realColor(60, 139, 255); } return iPaintContext.realColor(0, 0, 0); }
ZLTextBaseStyle::ZLTextBaseStyle(const std::string &fontFamily, int fontSize) : BackgroundColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Background", ZLColor(255, 255, 255)), SelectionBackgroundColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "SelectionBackground", ZLColor(82, 131, 194)), SelectedTextColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "SelectedText", ZLColor(60, 139, 255)), RegularTextColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Text", ZLColor(0, 0, 0)), InternalHyperlinkTextColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "Hyperlink", ZLColor(33, 96, 180)), ExternalHyperlinkTextColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "ExternalHyperlink", ZLColor(98, 174, 26)), TreeLinesColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, "TreeLines", ZLColor(127, 127, 127)), AutoHyphenationOption(ZLCategoryKey::LOOK_AND_FEEL, "Options", "AutoHyphenation", true), FontFamilyOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:fontFamily", fontFamily), FontSizeOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:fontSize", 0, 72, fontSize), BoldOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:bold", false), ItalicOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:italic", false), AlignmentOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:alignment", ALIGN_JUSTIFY), LineSpaceOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:lineSpacing", 1.2), LineSpacePercentOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:lineSpacingPercent", 120) { }
FBIndicatorStyle::FBIndicatorStyle() : TypeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Type", 0, 2, ZLTextPositionIndicatorInfo::OS_SCROLLBAR), IsSensitiveOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "TouchSensitive", true), ShowTextPositionOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "PositionText", false), ShowTimeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Time", false), ColorOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Color", ZLColor(127, 127, 127)), HeightOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Height", 1, 100, 16), OffsetOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Offset", 0, 100, 3), FontSizeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "FontSize", 4, 72, 14) { }
ZLColor color(const std::string &style) const { static QMap<std::string, ZLColor> map; if (!map.contains(style)) { qDebug() << style.c_str(); map.insert(style, ZLColor(0, 0, 0)); } (void) style; return map.value(style); }
void ColorOptionView::reset() { if (myWidget == 0) { return; } ZLColorOptionEntry &colorEntry = (ZLColorOptionEntry&)*myOption; colorEntry.onReset(ZLColor(myRSlider->value(), myGSlider->value(), myBSlider->value())); const ZLColor &color = colorEntry.color(); myRSlider->setValue(color.Red); myGSlider->setValue(color.Green); myBSlider->setValue(color.Blue); myColorBar->setBackgroundColor(QColor(color.Red, color.Green, color.Blue)); }
void ColorOptionView::reset() { if (myColorBar == 0) { return; } ZLColorOptionEntry &colorEntry = (ZLColorOptionEntry&)*myOption; colorEntry.onReset(ZLColor(myRSlider->value(), myGSlider->value(), myBSlider->value())); const ZLColor &color = colorEntry.color(); myRSlider->setValue(color.Red); myGSlider->setValue(color.Green); myBSlider->setValue(color.Blue); QPalette palette = myColorBar->palette(); palette.setColor(myColorBar->backgroundRole(), QColor(color.Red, color.Green, color.Blue)); myColorBar->setPalette(palette); }
FBIndicatorStyle::FBIndicatorStyle() : TypeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Type", 0, 2, ZLTextPositionIndicatorInfo::OS_SCROLLBAR), IsSensitiveOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "TouchSensitive", true), ShowTextPositionOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "PositionText", false), ShowTimeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Time", false), ColorOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Color", ZLColor(127, 127, 127)), HeightOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Height", 1, 100, 16), OffsetOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Offset", 0, 100, 3), FontSizeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "FontSize", 4, 100, 14) { if (ui::screenGeometry().height() >= 1024) { FontSizeOption.setValue(24); } else { FontSizeOption.setValue(22); } }
shared_ptr<ZLColorOption> ColorProfile::createOption(std::string profileName, std::string optionName, int r, int g, int b) { return new ZLColorOption(ZLCategoryKey::LOOK_AND_FEEL, COLORS, profileName + ':' + optionName, ZLColor(r, g, b)); }
void ColorOptionView::_onAccept() const { ((ZLColorOptionEntry*)myOption)->onAccept(ZLColor(myRSlider->value(), myGSlider->value(), myBSlider->value())); }
void ColorOptionView::_onAccept() const { ((ZLColorOptionEntry*)myOption)->onAccept(ZLColor(myColor.red/256, myColor.green/256, myColor.blue/256)); }
void W32ColorComboBox::initVectors() { if (ourStrings.empty()) { const ZLResource &resource = ZLResource::resource(ZLDialogManager::COLOR_KEY); addColor(resource["black"].value(), ZLColor(0, 0, 0)); addColor(resource["white"].value(), ZLColor(255, 255, 255)); addColor(resource["maroon"].value(), ZLColor(128, 0, 0)); addColor(resource["green"].value(), ZLColor(0, 128, 0)); addColor(resource["olive"].value(), ZLColor(128, 128, 0)); addColor(resource["navy"].value(), ZLColor(0, 0, 128)); addColor(resource["purple"].value(), ZLColor(128, 0, 128)); addColor(resource["teal"].value(), ZLColor(0, 128, 128)); addColor(resource["silver"].value(), ZLColor(192, 192, 192)); addColor(resource["gray"].value(), ZLColor(128, 128, 128)); addColor(resource["red"].value(), ZLColor(255, 0, 0)); addColor(resource["lime"].value(), ZLColor(0, 255, 0)); addColor(resource["yellow"].value(), ZLColor(255, 255, 0)); addColor(resource["blue"].value(), ZLColor(0, 0, 255)); addColor(resource["magenta"].value(), ZLColor(255, 0, 255)); addColor(resource["cyan"].value(), ZLColor(0, 255, 255)); } }