From 17b259df9cb6b28779d4881b2b6c805ee2e48eea Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Fri, 7 Jun 2024 23:30:05 +0900 Subject: Rename to tde-ebook-reader Signed-off-by: Michele Calgaro --- .../lookAndFeel/LookAndFeelOptionsDialog.cpp | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 reader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp (limited to 'reader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp') diff --git a/reader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp b/reader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp new file mode 100644 index 0000000..ca740c6 --- /dev/null +++ b/reader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010-2012 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +#include +#include +#include + +#include +#include + +#include + +#include "LookAndFeelOptionsDialog.h" + +#include "FormatOptionsPage.h" +#include "StyleOptionsPage.h" + +#include "../../reader/Reader.h" +#include "../../reader/FBView.h" +#include "../../options/FBOptions.h" + + +LookAndFeelOptionsDialog::LookAndFeelOptionsDialog() : AbstractOptionsDialog(ZLResourceKey("LookAndFeelOptionsDialog"), true) { + Reader &reader = Reader::Instance(); + FBOptions &options = FBOptions::Instance(); + + ZLOptionsDialog &dialog = this->dialog(); + + ZLDialogContent &cssTab = dialog.createTab(ZLResourceKey("CSS")); + cssTab.addOption(ZLResourceKey("overrideSpecifiedFonts"), ZLTextStyleCollection::Instance().OverrideSpecifiedFontsOption); + + ZLDialogContent &marginTab = dialog.createTab(ZLResourceKey("Margins")); + marginTab.addOptions( + ZLResourceKey("left"), new ZLSimpleSpinOptionEntry(options.LeftMarginOption, 1), + ZLResourceKey("right"), new ZLSimpleSpinOptionEntry(options.RightMarginOption, 1) + ); + marginTab.addOptions( + ZLResourceKey("top"), new ZLSimpleSpinOptionEntry(options.TopMarginOption, 1), + ZLResourceKey("bottom"), new ZLSimpleSpinOptionEntry(options.BottomMarginOption, 1) + ); + + myFormatPage = new FormatOptionsPage(dialog.createTab(ZLResourceKey("Format"))); + myStylePage = new StyleOptionsPage(dialog.createTab(ZLResourceKey("Styles")), *reader.context()); + + ZLDialogContent &colorsTab = dialog.createTab(ZLResourceKey("Colors")); + ZLResourceKey colorKey("colorFor"); + const ZLResource &resource = colorsTab.resource(colorKey); + ZLColorOptionBuilder builder; + const std::string BACKGROUND = resource["background"].value(); + builder.addOption(BACKGROUND, options.BackgroundColorOption); + builder.addOption(resource["selectionBackground"].value(), options.colorOption(ZLTextStyle::SELECTION_BACKGROUND)); + builder.addOption(resource["text"].value(), options.RegularTextColorOption); + builder.addOption(resource["internalLink"].value(), options.colorOption("internal")); + builder.addOption(resource["externalLink"].value(), options.colorOption("external")); + builder.addOption(resource["bookLink"].value(), options.colorOption("book")); + builder.addOption(resource["highlighted"].value(), options.colorOption(ZLTextStyle::HIGHLIGHTED_TEXT)); + builder.addOption(resource["treeLines"].value(), options.colorOption(ZLTextStyle::TREE_LINES)); + builder.addOption(resource["indicator"].value(), (FBView::commonIndicatorInfo().ColorOption)); + builder.setInitial(BACKGROUND); + colorsTab.addOption(colorKey, builder.comboEntry()); + colorsTab.addOption("", "", builder.colorEntry()); +} -- cgit v1.2.3