summaryrefslogtreecommitdiffstats
path: root/fbreader/src/optionsDialog/lookAndFeel
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
committerMichele Calgaro <[email protected]>2024-05-11 21:28:48 +0900
commit2462d03f322261bd616721c2b2065c4004b36c9c (patch)
tree239947a0737bb8386703a1497f12c09aebd3080a /fbreader/src/optionsDialog/lookAndFeel
downloadtde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.tar.gz
tde-ebook-reader-2462d03f322261bd616721c2b2065c4004b36c9c.zip
Initial import (as is) from Debian Snapshot's 'fbreader' source code (https://snapshot.debian.org/package/fbreader/0.99.4%2Bdfsg-6).
The Debian code is provided under GPL2 license. Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'fbreader/src/optionsDialog/lookAndFeel')
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.cpp112
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.h33
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp78
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.h38
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/OptionsPage.cpp52
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h76
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.cpp127
-rw-r--r--fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.h34
8 files changed, 550 insertions, 0 deletions
diff --git a/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.cpp b/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.cpp
new file mode 100644
index 0000000..3e24b87
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.cpp
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 <ZLOptionsDialog.h>
+
+#include <optionEntries/ZLSimpleOptionEntry.h>
+
+#include <ZLTextStyle.h>
+#include <ZLTextStyleCollection.h>
+#include <ZLTextStyleOptions.h>
+
+#include "FormatOptionsPage.h"
+
+#include "../../options/FBTextStyle.h"
+#include "../../bookmodel/FBTextKind.h"
+
+static const ZLResourceKey KEY_STYLE("style");
+static const ZLResourceKey KEY_BASE("Base");
+
+static const ZLResourceKey KEY_DUMMY("");
+static const ZLResourceKey KEY_LINESPACING("lineSpacing");
+static const ZLResourceKey KEY_FIRSTLINEINDENT("firstLineIndent");
+static const ZLResourceKey KEY_ALIGNMENT("alignment");
+static const ZLResourceKey KEY_SPACEBEFORE("spaceBefore");
+static const ZLResourceKey KEY_SPACEAFTER("spaceAfter");
+static const ZLResourceKey KEY_STARTINDENT("startIndent");
+static const ZLResourceKey KEY_ENDINDENT("endIndent");
+
+FormatOptionsPage::FormatOptionsPage(ZLDialogContent &dialogTab) {
+ const ZLResource &styleResource = ZLResource::resource(KEY_STYLE);
+
+ myComboEntry = new ComboOptionEntry(*this, styleResource[KEY_BASE].value());
+ myComboEntry->addValue(myComboEntry->initialValue());
+
+ ZLTextStyleCollection &collection = ZLTextStyleCollection::Instance();
+ ZLTextKind styles[] = { REGULAR, TITLE, SECTION_TITLE, SUBTITLE, H1, H2, H3, H4, H5, H6, ANNOTATION, EPIGRAPH, PREFORMATTED, AUTHOR, DATEKIND, POEM_TITLE, STANZA, VERSE };
+ const int STYLES_NUMBER = sizeof(styles) / sizeof(ZLTextKind);
+ for (int i = 0; i < STYLES_NUMBER; ++i) {
+ const ZLTextStyleDecoration *decoration = collection.decoration(styles[i]);
+ if (decoration != 0) {
+ myComboEntry->addValue(styleResource[decoration->name()].value());
+ }
+ }
+ dialogTab.addOption(ZLResourceKey("optionsFor"), myComboEntry);
+
+ {
+ const std::string &name = myComboEntry->initialValue();
+ FBTextStyle &baseStyle = FBTextStyle::Instance();
+
+ registerEntries(dialogTab,
+ KEY_LINESPACING, new ZLTextLineSpaceOptionEntry(baseStyle.LineSpacePercentOption, dialogTab.resource(KEY_LINESPACING), false),
+ KEY_DUMMY, 0,//new ZLSimpleSpinOptionEntry("First Line Indent", baseStyle.firstLineIndentDeltaOption(), -300, 300, 1),
+ name
+ );
+
+ registerEntries(dialogTab,
+ KEY_ALIGNMENT, new ZLTextAlignmentOptionEntry(baseStyle.AlignmentOption, dialogTab.resource(KEY_ALIGNMENT), false),
+ KEY_DUMMY, 0,
+ name
+ );
+ }
+
+ for (int i = 0; i < STYLES_NUMBER; ++i) {
+ ZLTextStyleDecoration *d = collection.decoration(styles[i]);
+ if ((d != 0) && (d->isFullDecoration())) {
+ ZLTextFullStyleDecoration *decoration = (ZLTextFullStyleDecoration*)d;
+ const std::string &name = styleResource[decoration->name()].value();
+
+ registerEntries(dialogTab,
+ KEY_SPACEBEFORE, new ZLSimpleSpinOptionEntry(decoration->SpaceBeforeOption, 1),
+ KEY_STARTINDENT, new ZLSimpleSpinOptionEntry(decoration->LineStartIndentOption, 1),
+ name
+ );
+
+ registerEntries(dialogTab,
+ KEY_SPACEAFTER, new ZLSimpleSpinOptionEntry(decoration->SpaceAfterOption, 1),
+ KEY_ENDINDENT, new ZLSimpleSpinOptionEntry(decoration->LineEndIndentOption, 1),
+ name
+ );
+
+ registerEntries(dialogTab,
+ KEY_LINESPACING, new ZLTextLineSpaceOptionEntry(decoration->LineSpacePercentOption, dialogTab.resource(KEY_LINESPACING), true),
+ KEY_FIRSTLINEINDENT, new ZLSimpleSpinOptionEntry(decoration->FirstLineIndentDeltaOption, 1),
+ name
+ );
+
+ registerEntries(dialogTab,
+ KEY_ALIGNMENT, new ZLTextAlignmentOptionEntry(decoration->AlignmentOption, dialogTab.resource(KEY_ALIGNMENT), true),
+ KEY_DUMMY, 0,
+ name
+ );
+ }
+ }
+
+ myComboEntry->onValueSelected(0);
+}
diff --git a/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.h b/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.h
new file mode 100644
index 0000000..81aa33a
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/FormatOptionsPage.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __FORMATOPTIONSPAGE_H__
+#define __FORMATOPTIONSPAGE_H__
+
+#include "OptionsPage.h"
+
+class ZLDialogContent;
+
+class FormatOptionsPage : public OptionsPage {
+
+public:
+ FormatOptionsPage(ZLDialogContent &dialogTab);
+};
+
+#endif /* __FORMATOPTIONSPAGE_H__ */
diff --git a/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp b/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp
new file mode 100644
index 0000000..f33c915
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.cpp
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010-2012 Geometer Plus <[email protected]>
+ *
+ * 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 <ZLDialogManager.h>
+#include <ZLOptionsDialog.h>
+#include <ZLPaintContext.h>
+
+#include <optionEntries/ZLSimpleOptionEntry.h>
+#include <optionEntries/ZLColorOptionBuilder.h>
+
+#include <ZLTextStyleCollection.h>
+
+#include "LookAndFeelOptionsDialog.h"
+
+#include "FormatOptionsPage.h"
+#include "StyleOptionsPage.h"
+
+#include "../../fbreader/FBReader.h"
+#include "../../fbreader/FBView.h"
+#include "../../options/FBOptions.h"
+
+
+LookAndFeelOptionsDialog::LookAndFeelOptionsDialog() : AbstractOptionsDialog(ZLResourceKey("LookAndFeelOptionsDialog"), true) {
+ FBReader &fbreader = FBReader::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")), *fbreader.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());
+}
diff --git a/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.h b/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.h
new file mode 100644
index 0000000..b908285
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/LookAndFeelOptionsDialog.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010-2012 Geometer Plus <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __LOOKANDFEELOPTIONSDIALOG_H__
+#define __LOOKANDFEELOPTIONSDIALOG_H__
+
+#include "../AbstractOptionsDialog.h"
+
+class OptionsPage;
+
+
+class LookAndFeelOptionsDialog : public AbstractOptionsDialog {
+
+public:
+ LookAndFeelOptionsDialog();
+
+private:
+ shared_ptr<OptionsPage> myFormatPage;
+ shared_ptr<OptionsPage> myStylePage;
+};
+
+#endif /* __LOOKANDFEELOPTIONSDIALOG_H__ */
diff --git a/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.cpp b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.cpp
new file mode 100644
index 0000000..55a6970
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 <ZLOptionsDialog.h>
+#include <ZLOptionEntry.h>
+
+#include "OptionsPage.h"
+
+void ComboOptionEntry::onValueSelected(int index) {
+ const std::string &selectedValue = values()[index];
+ const std::map<ZLOptionEntry*,std::string> &entries = myPage.myEntries;
+ int count = 0;
+ for (std::map<ZLOptionEntry*,std::string>::const_iterator it = entries.begin(); it != entries.end(); ++it, ++count) {
+ it->first->setVisible(it->second == selectedValue);
+ }
+}
+
+void OptionsPage::registerEntry(ZLDialogContent &tab, const ZLResourceKey &entryKey, ZLOptionEntry *entry, const std::string &name) {
+ if (entry != 0) {
+ entry->setVisible(false);
+ myEntries[entry] = name;
+ }
+ tab.addOption(entryKey, entry);
+}
+
+void OptionsPage::registerEntries(ZLDialogContent &tab, const ZLResourceKey &entry0Key, ZLOptionEntry *entry0, const ZLResourceKey &entry1Key, ZLOptionEntry *entry1, const std::string &name) {
+ if (entry0 != 0) {
+ entry0->setVisible(false);
+ myEntries[entry0] = name;
+ }
+ if (entry1 != 0) {
+ entry1->setVisible(false);
+ myEntries[entry1] = name;
+ }
+ tab.addOptions(entry0Key, entry0, entry1Key, entry1);
+}
diff --git a/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
new file mode 100644
index 0000000..a175c2b
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/OptionsPage.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __OPTIONSPAGE_H__
+#define __OPTIONSPAGE_H__
+
+#include <map>
+
+#include <ZLOptionEntry.h>
+
+class ZLDialogContent;
+
+class OptionsPage;
+
+class ComboOptionEntry : public ZLComboOptionEntry {
+
+public:
+ ComboOptionEntry(OptionsPage &page, const std::string &initialValue);
+ const std::string &initialValue() const;
+ const std::vector<std::string> &values() const;
+ void onAccept(const std::string&);
+ void onValueSelected(int index);
+ void addValue(const std::string &value);
+
+protected:
+ OptionsPage &myPage;
+ std::vector<std::string> myValues;
+ std::string myInitialValue;
+};
+
+class OptionsPage {
+
+public:
+ virtual ~OptionsPage();
+
+protected:
+ OptionsPage();
+
+ void registerEntry(ZLDialogContent &tab, const ZLResourceKey &entryKey, ZLOptionEntry *entry, const std::string &name);
+ void registerEntries(ZLDialogContent &tab, const ZLResourceKey &entry0Key, ZLOptionEntry *entry0, const ZLResourceKey &entry1Key, ZLOptionEntry *entry1, const std::string &name);
+
+protected:
+ ComboOptionEntry *myComboEntry;
+
+private:
+ std::map<ZLOptionEntry*,std::string> myEntries;
+
+friend class ComboOptionEntry;
+};
+
+inline ComboOptionEntry::ComboOptionEntry(OptionsPage &page, const std::string &initialValue) : myPage(page), myInitialValue(initialValue) {}
+inline const std::string &ComboOptionEntry::initialValue() const { return myInitialValue; }
+inline const std::vector<std::string> &ComboOptionEntry::values() const { return myValues; }
+inline void ComboOptionEntry::onAccept(const std::string&) {}
+inline void ComboOptionEntry::addValue(const std::string &value) { myValues.push_back(value); }
+
+inline OptionsPage::OptionsPage() {}
+inline OptionsPage::~OptionsPage() {}
+
+#endif /* __OPTIONSPAGE_H__ */
diff --git a/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.cpp b/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.cpp
new file mode 100644
index 0000000..6fc00e6
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.cpp
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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 <ZLOptionsDialog.h>
+#include <ZLPaintContext.h>
+
+#include <optionEntries/ZLSimpleOptionEntry.h>
+
+#include <ZLTextView.h>
+#include <ZLTextStyle.h>
+#include <ZLTextStyleCollection.h>
+#include <ZLTextStyleOptions.h>
+
+#include "StyleOptionsPage.h"
+
+#include "../../options/FBTextStyle.h"
+#include "../../bookmodel/FBTextKind.h"
+
+static const ZLResourceKey KEY_STYLE("style");
+static const ZLResourceKey KEY_BASE("Base");
+
+static const ZLResourceKey KEY_BOLD("bold");
+static const ZLResourceKey KEY_ITALIC("italic");
+static const ZLResourceKey KEY_FONTFAMILY("fontFamily");
+static const ZLResourceKey KEY_FONTSIZE("fontSize");
+static const ZLResourceKey KEY_FONTSIZEDIFFERENCE("fontSizeDifference");
+static const ZLResourceKey KEY_ALLOWHYPHENATIONS("allowHyphenations");
+static const ZLResourceKey KEY_AUTOHYPHENATIONS("autoHyphenations");
+static const ZLResourceKey KEY_DUMMY("");
+
+StyleOptionsPage::StyleOptionsPage(ZLDialogContent &dialogTab, ZLPaintContext &context) {
+ const ZLResource &styleResource = ZLResource::resource(KEY_STYLE);
+
+ myComboEntry = new ComboOptionEntry(*this, styleResource[KEY_BASE].value());
+ myComboEntry->addValue(myComboEntry->initialValue());
+
+ ZLTextStyleCollection &collection = ZLTextStyleCollection::Instance();
+ ZLTextKind styles[] = { REGULAR, TITLE, SECTION_TITLE, SUBTITLE, H1, H2, H3, H4, H5, H6, CONTENTS_TABLE_ENTRY, LIBRARY_ENTRY, ANNOTATION, EPIGRAPH, AUTHOR, DATEKIND, POEM_TITLE, STANZA, VERSE, CITE, INTERNAL_HYPERLINK, EXTERNAL_HYPERLINK, BOOK_HYPERLINK, FOOTNOTE, ITALIC, EMPHASIS, BOLD, STRONG, DEFINITION, DEFINITION_DESCRIPTION, PREFORMATTED, CODE };
+ const int STYLES_NUMBER = sizeof(styles) / sizeof(ZLTextKind);
+ for (int i = 0; i < STYLES_NUMBER; ++i) {
+ const ZLTextStyleDecoration *decoration = collection.decoration(styles[i]);
+ if (decoration != 0) {
+ myComboEntry->addValue(styleResource[decoration->name()].value());
+ }
+ }
+ dialogTab.addOption(ZLResourceKey("optionsFor"), myComboEntry);
+
+ {
+ const std::string &name = myComboEntry->initialValue();
+ FBTextStyle &baseStyle = FBTextStyle::Instance();
+
+ registerEntry(dialogTab,
+ KEY_FONTFAMILY, new ZLFontFamilyOptionEntry(baseStyle.FontFamilyOption, context),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_FONTSIZE, new ZLSimpleSpinOptionEntry(baseStyle.FontSizeOption, 2),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_BOLD, new ZLSimpleBooleanOptionEntry(baseStyle.BoldOption),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_ITALIC, new ZLSimpleBooleanOptionEntry(baseStyle.ItalicOption),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_AUTOHYPHENATIONS, new ZLSimpleBooleanOptionEntry(collection.AutoHyphenationOption),
+ name
+ );
+ }
+
+ for (int i = 0; i < STYLES_NUMBER; ++i) {
+ ZLTextStyleDecoration *decoration = collection.decoration(styles[i]);
+ if (decoration != 0) {
+ const std::string &name = styleResource[decoration->name()].value();
+
+ registerEntry(dialogTab,
+ KEY_FONTFAMILY, new ZLTextFontFamilyWithBaseOptionEntry(decoration->FontFamilyOption, dialogTab.resource(KEY_FONTFAMILY), context),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_FONTSIZEDIFFERENCE, new ZLSimpleSpinOptionEntry(decoration->FontSizeDeltaOption, 2),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_BOLD, new ZLSimpleBoolean3OptionEntry(decoration->BoldOption),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_ITALIC, new ZLSimpleBoolean3OptionEntry(decoration->ItalicOption),
+ name
+ );
+
+ registerEntry(dialogTab,
+ KEY_ALLOWHYPHENATIONS, new ZLSimpleBoolean3OptionEntry(decoration->AllowHyphenationsOption),
+ name
+ );
+ }
+ }
+
+ myComboEntry->onValueSelected(0);
+}
diff --git a/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.h b/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.h
new file mode 100644
index 0000000..c61709d
--- /dev/null
+++ b/fbreader/src/optionsDialog/lookAndFeel/StyleOptionsPage.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2004-2012 Geometer Plus <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __STYLEOPTIONSPAGE_H__
+#define __STYLEOPTIONSPAGE_H__
+
+#include "OptionsPage.h"
+
+class ZLDialogContent;
+class ZLPaintContext;
+
+class StyleOptionsPage : public OptionsPage {
+
+public:
+ StyleOptionsPage(ZLDialogContent &dialogTab, ZLPaintContext &context);
+};
+
+#endif /* __STYLEOPTIONSPAGE_H__ */