summaryrefslogtreecommitdiffstats
path: root/reader/src/optionsDialog/reading
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2024-06-07 23:30:05 +0900
committerMichele Calgaro <[email protected]>2024-06-07 23:30:05 +0900
commit17b259df9cb6b28779d4881b2b6c805ee2e48eea (patch)
tree5ed61937459cb7081089111b0242c01ec178f1f3 /reader/src/optionsDialog/reading
parent1cba8bce178eb2d6719c6f7f21e2c9352c5513a6 (diff)
downloadtde-ebook-reader-17b259df9cb6b28779d4881b2b6c805ee2e48eea.tar.gz
tde-ebook-reader-17b259df9cb6b28779d4881b2b6c805ee2e48eea.zip
Rename to tde-ebook-reader
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'reader/src/optionsDialog/reading')
-rw-r--r--reader/src/optionsDialog/reading/IndicatorTab.cpp171
-rw-r--r--reader/src/optionsDialog/reading/KeyBindingsTab.cpp285
-rw-r--r--reader/src/optionsDialog/reading/ReadingOptionsDialog.cpp125
-rw-r--r--reader/src/optionsDialog/reading/ReadingOptionsDialog.h36
4 files changed, 617 insertions, 0 deletions
diff --git a/reader/src/optionsDialog/reading/IndicatorTab.cpp b/reader/src/optionsDialog/reading/IndicatorTab.cpp
new file mode 100644
index 0000000..6d288c6
--- /dev/null
+++ b/reader/src/optionsDialog/reading/IndicatorTab.cpp
@@ -0,0 +1,171 @@
+/*
+ * 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 <ZLToggleBooleanOptionEntry.h>
+
+#include <ZLTextStyleOptions.h>
+
+#include "ReadingOptionsDialog.h"
+
+#include "../../reader/Reader.h"
+#include "../../reader/FBView.h"
+#include "../../reader/BookTextView.h"
+
+class StateOptionEntry : public ZLToggleBooleanOptionEntry {
+
+public:
+ StateOptionEntry(ZLBooleanOption &option);
+ void onStateChanged(bool state);
+
+private:
+ bool myState;
+
+friend class SpecialFontSizeEntry;
+};
+
+class SpecialFontSizeEntry : public ZLSimpleSpinOptionEntry {
+
+public:
+ SpecialFontSizeEntry(ZLIntegerRangeOption &option, int step, StateOptionEntry &first, StateOptionEntry &second);
+ void setVisible(bool state);
+
+private:
+ StateOptionEntry &myFirst;
+ StateOptionEntry &mySecond;
+};
+
+StateOptionEntry::StateOptionEntry(ZLBooleanOption &option) : ZLToggleBooleanOptionEntry(option) {
+ myState = option.value();
+}
+
+void StateOptionEntry::onStateChanged(bool state) {
+ myState = state;
+ ZLToggleBooleanOptionEntry::onStateChanged(state);
+}
+
+SpecialFontSizeEntry::SpecialFontSizeEntry(ZLIntegerRangeOption &option, int step, StateOptionEntry &first, StateOptionEntry &second) : ZLSimpleSpinOptionEntry(option, step), myFirst(first), mySecond(second) {
+}
+
+void SpecialFontSizeEntry::setVisible(bool) {
+ ZLSimpleSpinOptionEntry::setVisible(
+ (myFirst.isVisible() && myFirst.myState) ||
+ (mySecond.isVisible() && mySecond.myState)
+ );
+}
+
+class IndicatorTypeEntry : public ZLComboOptionEntry {
+
+public:
+ IndicatorTypeEntry(const ZLResource &resource, ZLIntegerRangeOption &typeOption);
+ void addDependentEntry(ZLOptionEntry *entry);
+ const std::string &initialValue() const;
+
+private:
+ const std::vector<std::string> &values() const;
+ void onAccept(const std::string &value);
+ void onValueSelected(int index);
+
+private:
+ ZLIntegerRangeOption &myOption;
+ std::vector<std::string> myValues;
+ std::vector<ZLOptionEntry*> myDependentEntries;
+};
+
+IndicatorTypeEntry::IndicatorTypeEntry(const ZLResource &resource, ZLIntegerRangeOption &typeOption) : myOption(typeOption) {
+ myValues.push_back(resource["osScrollbar"].value());
+ myValues.push_back(resource["fbIndicator"].value());
+ myValues.push_back(resource["none"].value());
+}
+
+const std::string &IndicatorTypeEntry::initialValue() const {
+ return myValues[myOption.value()];
+}
+
+const std::vector<std::string> &IndicatorTypeEntry::values() const {
+ return myValues;
+}
+
+void IndicatorTypeEntry::addDependentEntry(ZLOptionEntry *entry) {
+ myDependentEntries.push_back(entry);
+}
+
+void IndicatorTypeEntry::onAccept(const std::string &value) {
+ for (std::size_t index = 0; index != myValues.size(); ++index) {
+ if (myValues[index] == value) {
+ myOption.setValue(index);
+ break;
+ }
+ }
+}
+
+void IndicatorTypeEntry::onValueSelected(int index) {
+ for (std::vector<ZLOptionEntry*>::iterator it = myDependentEntries.begin(); it != myDependentEntries.end(); ++it) {
+ (*it)->setVisible(index == FBIndicatorStyle::FB_INDICATOR);
+ }
+}
+
+void ReadingOptionsDialog::createIndicatorTab() {
+ ZLDialogContent &indicatorTab = dialog().createTab(ZLResourceKey("Indicator"));
+ FBIndicatorStyle &indicatorInfo = FBView::commonIndicatorInfo();
+ static ZLResourceKey typeKey("type");
+ IndicatorTypeEntry *indicatorTypeEntry =
+ new IndicatorTypeEntry(indicatorTab.resource(typeKey), indicatorInfo.TypeOption);
+ indicatorTab.addOption(typeKey, indicatorTypeEntry);
+
+ ZLOptionEntry *heightEntry =
+ new ZLSimpleSpinOptionEntry(indicatorInfo.HeightOption, 1);
+ ZLOptionEntry *offsetEntry =
+ new ZLSimpleSpinOptionEntry(indicatorInfo.OffsetOption, 1);
+ indicatorTab.addOptions(ZLResourceKey("height"), heightEntry, ZLResourceKey("offset"), offsetEntry);
+ indicatorTypeEntry->addDependentEntry(heightEntry);
+ indicatorTypeEntry->addDependentEntry(offsetEntry);
+
+ StateOptionEntry *showTextPositionEntry =
+ new StateOptionEntry(indicatorInfo.ShowTextPositionOption);
+ indicatorTab.addOption(ZLResourceKey("pageNumber"), showTextPositionEntry);
+ indicatorTypeEntry->addDependentEntry(showTextPositionEntry);
+
+ StateOptionEntry *showTimeEntry =
+ new StateOptionEntry(indicatorInfo.ShowTimeOption);
+ indicatorTab.addOption(ZLResourceKey("time"), showTimeEntry);
+ indicatorTypeEntry->addDependentEntry(showTimeEntry);
+
+ SpecialFontSizeEntry *fontSizeEntry =
+ new SpecialFontSizeEntry(indicatorInfo.FontSizeOption, 2, *showTextPositionEntry, *showTimeEntry);
+ indicatorTab.addOption(ZLResourceKey("fontSize"), fontSizeEntry);
+ indicatorTypeEntry->addDependentEntry(fontSizeEntry);
+ showTextPositionEntry->addDependentEntry(fontSizeEntry);
+ showTimeEntry->addDependentEntry(fontSizeEntry);
+
+ ZLOptionEntry *tocMarksEntry =
+ new ZLSimpleBooleanOptionEntry(Reader::Instance().bookTextView().ShowTOCMarksOption);
+ indicatorTab.addOption(ZLResourceKey("tocMarks"), tocMarksEntry);
+ indicatorTypeEntry->addDependentEntry(tocMarksEntry);
+
+ ZLOptionEntry *navigationEntry =
+ new ZLSimpleBooleanOptionEntry(indicatorInfo.IsSensitiveOption);
+ indicatorTab.addOption(ZLResourceKey("navigation"), navigationEntry);
+ indicatorTypeEntry->addDependentEntry(navigationEntry);
+
+ indicatorTypeEntry->onStringValueSelected(indicatorTypeEntry->initialValue());
+ showTextPositionEntry->onStateChanged(showTextPositionEntry->initialState());
+ showTimeEntry->onStateChanged(showTimeEntry->initialState());
+}
diff --git a/reader/src/optionsDialog/reading/KeyBindingsTab.cpp b/reader/src/optionsDialog/reading/KeyBindingsTab.cpp
new file mode 100644
index 0000000..f72023b
--- /dev/null
+++ b/reader/src/optionsDialog/reading/KeyBindingsTab.cpp
@@ -0,0 +1,285 @@
+/*
+ * 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 <ZLApplication.h>
+#include <ZLOptionEntry.h>
+
+#include <ZLSimpleOptionEntry.h>
+#include <ZLSimpleKeyOptionEntry.h>
+
+#include "ReadingOptionsDialog.h"
+
+#include "../../reader/Reader.h"
+#include "../../reader/ReaderActions.h"
+
+class KeyboardControlEntry : public ZLSimpleBooleanOptionEntry {
+
+public:
+ KeyboardControlEntry();
+ void onStateChanged(bool state);
+};
+
+KeyboardControlEntry::KeyboardControlEntry() : ZLSimpleBooleanOptionEntry(Reader::Instance().KeyboardControlOption) {
+}
+
+void KeyboardControlEntry::onStateChanged(bool state) {
+ ZLSimpleBooleanOptionEntry::onStateChanged(state);
+ Reader::Instance().grabAllKeys(state);
+}
+
+class SingleKeyOptionEntry : public ZLSimpleKeyOptionEntry {
+
+public:
+ SingleKeyOptionEntry(const CodeIndexBimap &bimap, ZLKeyBindings &bindings);
+ const CodeIndexBimap &codeIndexBimap() const;
+
+private:
+ const CodeIndexBimap &myBimap;
+};
+
+SingleKeyOptionEntry::SingleKeyOptionEntry(const CodeIndexBimap &bimap, ZLKeyBindings &bindings) : ZLSimpleKeyOptionEntry(bindings), myBimap(bimap) {
+}
+
+const ZLSimpleKeyOptionEntry::CodeIndexBimap &SingleKeyOptionEntry::codeIndexBimap() const {
+ return myBimap;
+}
+
+class MultiKeyOptionEntry : public ZLKeyOptionEntry {
+
+public:
+ MultiKeyOptionEntry(const ZLResource &resource);
+ void onAccept();
+ int actionIndex(const std::string &key);
+ void onValueChanged(const std::string &key, int index);
+ void onKeySelected(const std::string &key);
+
+ void setOrientation(ZLView::Angle);
+ void setExitOnCancelEntry(ZLOptionEntry *exitOnCancelEntry);
+
+private:
+ void addAction(const std::string &actionId);
+
+private:
+ const ZLResource &myResource;
+ ZLSimpleKeyOptionEntry::CodeIndexBimap myBimap;
+
+ SingleKeyOptionEntry myEntry0;
+ SingleKeyOptionEntry myEntry90;
+ SingleKeyOptionEntry myEntry180;
+ SingleKeyOptionEntry myEntry270;
+ SingleKeyOptionEntry *myCurrentEntry;
+ ZLOptionEntry *myExitOnCancelEntry;
+};
+
+void MultiKeyOptionEntry::addAction(const std::string &actionId) {
+ myBimap.insert(actionId);
+ addActionName(myResource[ZLResourceKey(actionId)].value());
+}
+
+MultiKeyOptionEntry::MultiKeyOptionEntry(const ZLResource &resource) :
+ ZLKeyOptionEntry(),
+ myResource(resource),
+ myEntry0(myBimap, *Reader::Instance().keyBindings(ZLView::DEGREES0)),
+ myEntry90(myBimap, *Reader::Instance().keyBindings(ZLView::DEGREES90)),
+ myEntry180(myBimap, *Reader::Instance().keyBindings(ZLView::DEGREES180)),
+ myEntry270(myBimap, *Reader::Instance().keyBindings(ZLView::DEGREES270)),
+ myCurrentEntry(&myEntry0),
+ myExitOnCancelEntry(0) {
+ addAction(ZLApplication::NoAction);
+
+ // switch view
+ addAction(ActionCode::SHOW_LIBRARY);
+ addAction(ActionCode::OPEN_PREVIOUS_BOOK);
+ addAction(ActionCode::SHOW_TOC);
+
+ // navigation
+ addAction(ActionCode::SCROLL_TO_HOME);
+ addAction(ActionCode::SCROLL_TO_START_OF_TEXT);
+ addAction(ActionCode::SCROLL_TO_END_OF_TEXT);
+ addAction(ActionCode::GOTO_NEXT_TOC_SECTION);
+ addAction(ActionCode::GOTO_PREVIOUS_TOC_SECTION);
+ addAction(ActionCode::PAGE_SCROLL_FORWARD);
+ addAction(ActionCode::PAGE_SCROLL_BACKWARD);
+ addAction(ActionCode::LINE_SCROLL_FORWARD);
+ addAction(ActionCode::LINE_SCROLL_BACKWARD);
+ addAction(ActionCode::UNDO);
+ addAction(ActionCode::REDO);
+
+ // selection
+ addAction(ActionCode::COPY_SELECTED_TEXT_TO_CLIPBOARD);
+ addAction(ActionCode::OPEN_SELECTED_TEXT_IN_DICTIONARY);
+ addAction(ActionCode::CLEAR_SELECTION);
+
+ // search
+ addAction(ActionCode::SEARCH);
+ addAction(ActionCode::FIND_PREVIOUS);
+ addAction(ActionCode::FIND_NEXT);
+
+ // look
+ addAction(ActionCode::INCREASE_FONT);
+ addAction(ActionCode::DECREASE_FONT);
+ addAction(ActionCode::SHOW_HIDE_POSITION_INDICATOR);
+ addAction(ActionCode::TOGGLE_FULLSCREEN);
+ addAction(ActionCode::ROTATE_SCREEN);
+
+ // dialogs
+ addAction(ActionCode::SHOW_OPTIONS_DIALOG);
+ addAction(ActionCode::SHOW_BOOK_INFO_DIALOG);
+ addAction(ActionCode::ADD_BOOK);
+
+ // quit
+ addAction(ActionCode::CANCEL);
+ addAction(ActionCode::QUIT);
+}
+
+void MultiKeyOptionEntry::setOrientation(ZLView::Angle angle) {
+ switch (angle) {
+ case ZLView::DEGREES0:
+ myCurrentEntry = &myEntry0;
+ break;
+ case ZLView::DEGREES90:
+ myCurrentEntry = &myEntry90;
+ break;
+ case ZLView::DEGREES180:
+ myCurrentEntry = &myEntry180;
+ break;
+ case ZLView::DEGREES270:
+ myCurrentEntry = &myEntry270;
+ break;
+ }
+ resetView();
+}
+
+void MultiKeyOptionEntry::onAccept() {
+ myEntry0.onAccept();
+ myEntry90.onAccept();
+ myEntry180.onAccept();
+ myEntry270.onAccept();
+}
+
+int MultiKeyOptionEntry::actionIndex(const std::string &key) {
+ return myCurrentEntry->actionIndex(key);
+}
+
+void MultiKeyOptionEntry::onValueChanged(const std::string &key, int index) {
+ myCurrentEntry->onValueChanged(key, index);
+ if (myExitOnCancelEntry != 0) {
+ myExitOnCancelEntry->setVisible(myBimap.codeByIndex(index) == ActionCode::CANCEL);
+ }
+}
+
+void MultiKeyOptionEntry::setExitOnCancelEntry(ZLOptionEntry *exitOnCancelEntry) {
+ myExitOnCancelEntry = exitOnCancelEntry;
+}
+
+void MultiKeyOptionEntry::onKeySelected(const std::string &key) {
+ if (myExitOnCancelEntry != 0) {
+ myExitOnCancelEntry->setVisible(myBimap.codeByIndex(myCurrentEntry->actionIndex(key)) == ActionCode::CANCEL);
+ }
+}
+
+class OrientationEntry : public ZLComboOptionEntry {
+
+public:
+ OrientationEntry(MultiKeyOptionEntry &keyEntry, const ZLResource &resource);
+ const std::string &initialValue() const;
+ const std::vector<std::string> &values() const;
+ void onValueSelected(int index);
+ void onAccept(const std::string &value);
+
+private:
+ MultiKeyOptionEntry &myKeyEntry;
+ const ZLResource &myResource;
+};
+
+OrientationEntry::OrientationEntry(MultiKeyOptionEntry &keyEntry, const ZLResource &resource) : myKeyEntry(keyEntry), myResource(resource) {
+}
+
+const std::string &OrientationEntry::initialValue() const {
+ return values()[0];
+}
+
+const std::vector<std::string> &OrientationEntry::values() const {
+ static std::vector<std::string> _values;
+ if (_values.empty()) {
+ _values.push_back(myResource["degrees0"].value());
+ _values.push_back(myResource["degrees90ccw"].value());
+ _values.push_back(myResource["degrees180"].value());
+ _values.push_back(myResource["degrees90cw"].value());
+ }
+ return _values;
+}
+
+void OrientationEntry::onValueSelected(int index) {
+ static ZLView::Angle angles[] = {
+ ZLView::DEGREES0,
+ ZLView::DEGREES90,
+ ZLView::DEGREES180,
+ ZLView::DEGREES270
+ };
+ myKeyEntry.setOrientation(angles[index]);
+}
+
+void OrientationEntry::onAccept(const std::string&) {
+}
+
+class UseSeparateOptionsEntry : public ZLSimpleBooleanOptionEntry {
+
+public:
+ UseSeparateOptionsEntry(ZLOptionEntry &keyEntry, OrientationEntry &orientationEntry);
+ void onStateChanged(bool state);
+
+private:
+ ZLOptionEntry &myKeyEntry;
+ OrientationEntry &myOrientationEntry;
+};
+
+UseSeparateOptionsEntry::UseSeparateOptionsEntry(ZLOptionEntry &keyEntry, OrientationEntry &orientationEntry) : ZLSimpleBooleanOptionEntry(Reader::Instance().UseSeparateBindingsOption), myKeyEntry(keyEntry), myOrientationEntry(orientationEntry) {
+}
+
+void UseSeparateOptionsEntry::onStateChanged(bool state) {
+ ZLSimpleBooleanOptionEntry::onStateChanged(state);
+ myOrientationEntry.setVisible(state);
+ myKeyEntry.resetView();
+}
+
+
+void ReadingOptionsDialog::createKeyBindingsTab() {
+ ZLDialogContent &dialogTab = dialog().createTab(ZLResourceKey("Keys"));
+ Reader &reader = Reader::Instance();
+ if (ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::FULL_KEYBOARD_CONTROL, false).value()) {
+ dialogTab.addOption(ZLResourceKey("grabSystemKeys"), new KeyboardControlEntry());
+ }
+ ZLResourceKey actionKey("action");
+ ZLResourceKey separateKey("separate");
+ ZLResourceKey orientationKey("orientation");
+ MultiKeyOptionEntry *keyEntry = new MultiKeyOptionEntry(dialogTab.resource(actionKey));
+ OrientationEntry *orientationEntry = new OrientationEntry(*keyEntry, dialogTab.resource(orientationKey));
+ ZLBooleanOptionEntry *useSeparateBindingsEntry = new UseSeparateOptionsEntry(*keyEntry, *orientationEntry);
+ dialogTab.addOption(separateKey, useSeparateBindingsEntry);
+ dialogTab.addOption(orientationKey, orientationEntry);
+ dialogTab.addOption("", "", keyEntry);
+ ZLOptionEntry *exitOnCancelEntry = new ZLSimpleBooleanOptionEntry(reader.QuitOnCancelOption);
+ keyEntry->setExitOnCancelEntry(exitOnCancelEntry);
+ dialogTab.addOption(ZLResourceKey("quitOnCancel"), exitOnCancelEntry);
+ exitOnCancelEntry->setVisible(false);
+ useSeparateBindingsEntry->onStateChanged(useSeparateBindingsEntry->initialState());
+ dialogTab.addOption(ZLResourceKey("keyDelay"), new ZLSimpleSpinOptionEntry(reader.KeyDelayOption, 50));
+}
diff --git a/reader/src/optionsDialog/reading/ReadingOptionsDialog.cpp b/reader/src/optionsDialog/reading/ReadingOptionsDialog.cpp
new file mode 100644
index 0000000..29528c6
--- /dev/null
+++ b/reader/src/optionsDialog/reading/ReadingOptionsDialog.cpp
@@ -0,0 +1,125 @@
+/*
+ * 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 <ZLSimpleOptionEntry.h>
+#include <ZLToggleBooleanOptionEntry.h>
+
+#include "ReadingOptionsDialog.h"
+
+#include "../../reader/Reader.h"
+#include "../../reader/FBView.h"
+
+
+class RotationTypeEntry : public ZLComboOptionEntry {
+
+public:
+ RotationTypeEntry(const ZLResource &resource, ZLIntegerOption &angleOption);
+
+ const std::string &initialValue() const;
+ const std::vector<std::string> &values() const;
+ void onAccept(const std::string &value);
+
+private:
+ ZLIntegerOption &myAngleOption;
+ std::vector<std::string> myValues;
+};
+
+RotationTypeEntry::RotationTypeEntry(const ZLResource &resource, ZLIntegerOption &angleOption) : myAngleOption(angleOption) {
+ myValues.push_back(resource["disabled"].value());
+ myValues.push_back(resource["counterclockwise"].value());
+ myValues.push_back(resource["180"].value());
+ myValues.push_back(resource["clockwise"].value());
+ myValues.push_back(resource["cycle"].value());
+}
+
+const std::string &RotationTypeEntry::initialValue() const {
+ switch (myAngleOption.value()) {
+ default:
+ return myValues[0];
+ case ZLView::DEGREES90:
+ return myValues[1];
+ case ZLView::DEGREES180:
+ return myValues[2];
+ case ZLView::DEGREES270:
+ return myValues[3];
+ case -1:
+ return myValues[4];
+ }
+}
+
+const std::vector<std::string> &RotationTypeEntry::values() const {
+ return myValues;
+}
+
+void RotationTypeEntry::onAccept(const std::string &value) {
+ int angle = ZLView::DEGREES0;
+ if (value == myValues[1]) {
+ angle = ZLView::DEGREES90;
+ } else if (value == myValues[2]) {
+ angle = ZLView::DEGREES180;
+ } else if (value == myValues[3]) {
+ angle = ZLView::DEGREES270;
+ } else if (value == myValues[4]) {
+ angle = -1;
+ }
+ myAngleOption.setValue(angle);
+}
+
+
+
+ReadingOptionsDialog::ReadingOptionsDialog() : AbstractOptionsDialog(ZLResourceKey("ReadingOptionsDialog"), true) {
+ Reader &reader = Reader::Instance();
+
+ ZLOptionsDialog &dialog = this->dialog();
+
+ ZLDialogContent &scrollingTab = dialog.createTab(ZLResourceKey("Scrolling"));
+ scrollingTab.addOption(ZLResourceKey("keyLinesToScroll"), new ZLSimpleSpinOptionEntry(reader.LinesToScrollOption, 1));
+ scrollingTab.addOption(ZLResourceKey("keyLinesToKeep"), new ZLSimpleSpinOptionEntry(reader.LinesToKeepOption, 1));
+ scrollingTab.addOption(ZLResourceKey("keyScrollDelay"), new ZLSimpleSpinOptionEntry(reader.KeyScrollingDelayOption, 50));
+ const bool hasTouchScreen =
+ ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::TOUCHSCREEN_PRESENTED, false).value();
+ if (hasTouchScreen) {
+ ZLToggleBooleanOptionEntry *enableTapScrollingEntry =
+ new ZLToggleBooleanOptionEntry(reader.EnableTapScrollingOption);
+ scrollingTab.addOption(ZLResourceKey("enableTapScrolling"), enableTapScrollingEntry);
+ const bool isFingerTapDetectionSupported =
+ ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::FINGER_TAP_DETECTABLE, false).value();
+ if (isFingerTapDetectionSupported) {
+ ZLOptionEntry *fingerOnlyEntry =
+ new ZLSimpleBooleanOptionEntry(reader.TapScrollingOnFingerOnlyOption);
+ scrollingTab.addOption(ZLResourceKey("fingerOnly"), fingerOnlyEntry);
+ enableTapScrollingEntry->addDependentEntry(fingerOnlyEntry);
+ enableTapScrollingEntry->onStateChanged(enableTapScrollingEntry->initialState());
+ }
+ }
+
+ ZLDialogContent &selectionTab = dialog.createTab(ZLResourceKey("Selection"));
+ selectionTab.addOption(ZLResourceKey("enableSelection"), FBView::selectionOption());
+
+ createIndicatorTab();
+
+ ZLDialogContent &rotationTab = dialog.createTab(ZLResourceKey("Rotation"));
+ ZLResourceKey directionKey("direction");
+ rotationTab.addOption(directionKey, new RotationTypeEntry(rotationTab.resource(directionKey), reader.RotationAngleOption));
+
+ createKeyBindingsTab();
+}
diff --git a/reader/src/optionsDialog/reading/ReadingOptionsDialog.h b/reader/src/optionsDialog/reading/ReadingOptionsDialog.h
new file mode 100644
index 0000000..83a101a
--- /dev/null
+++ b/reader/src/optionsDialog/reading/ReadingOptionsDialog.h
@@ -0,0 +1,36 @@
+/*
+ * 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 __READINGOPTIONSDIALOG_H__
+#define __READINGOPTIONSDIALOG_H__
+
+#include "../AbstractOptionsDialog.h"
+
+
+class ReadingOptionsDialog : public AbstractOptionsDialog {
+
+private:
+ void createIndicatorTab();
+ void createKeyBindingsTab();
+
+public:
+ ReadingOptionsDialog();
+};
+
+#endif /* __READINGOPTIONSDIALOG_H__ */