diff options
Diffstat (limited to 'fbreader/src/options')
-rw-r--r-- | fbreader/src/options/FBCategoryKey.cpp | 27 | ||||
-rw-r--r-- | fbreader/src/options/FBCategoryKey.h | 36 | ||||
-rw-r--r-- | fbreader/src/options/FBOptions.cpp | 64 | ||||
-rw-r--r-- | fbreader/src/options/FBOptions.h | 65 | ||||
-rw-r--r-- | fbreader/src/options/FBTextStyle.cpp | 107 | ||||
-rw-r--r-- | fbreader/src/options/FBTextStyle.h | 71 |
6 files changed, 0 insertions, 370 deletions
diff --git a/fbreader/src/options/FBCategoryKey.cpp b/fbreader/src/options/FBCategoryKey.cpp deleted file mode 100644 index b1ab431..0000000 --- a/fbreader/src/options/FBCategoryKey.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 "FBCategoryKey.h" - -FBCategoryKey::FBCategoryKey(const std::string &name) : ZLCategoryKey(name) { -} - -const FBCategoryKey FBCategoryKey::BOOKS("books"); -const FBCategoryKey FBCategoryKey::SEARCH("search"); -const FBCategoryKey FBCategoryKey::EXTERNAL("external"); diff --git a/fbreader/src/options/FBCategoryKey.h b/fbreader/src/options/FBCategoryKey.h deleted file mode 100644 index 8550340..0000000 --- a/fbreader/src/options/FBCategoryKey.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 __FBCATEGORYKEY_H__ -#define __FBCATEGORYKEY_H__ - -#include <ZLOptions.h> - -class FBCategoryKey : public ZLCategoryKey { - -public: - static const FBCategoryKey BOOKS; - static const FBCategoryKey SEARCH; - static const FBCategoryKey EXTERNAL; - -private: - FBCategoryKey(const std::string &name); -}; - -#endif /* __FBCATEGORYKEY_H__ */ diff --git a/fbreader/src/options/FBOptions.cpp b/fbreader/src/options/FBOptions.cpp deleted file mode 100644 index c7d8f97..0000000 --- a/fbreader/src/options/FBOptions.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 "FBOptions.h" - -FBOptions* FBOptions::ourInstance = 0; - -static const std::string OPTIONS = "Options"; -static const std::string COLORS = "Colors"; - -FBOptions::FBOptions() : - LeftMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "LeftMargin", 0, 1000, 4), - RightMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "RightMargin", 0, 1000, 4), - TopMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "TopMargin", 0, 1000, 0), - BottomMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "BottomMargin", 0, 1000, 4), - 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) - ); -} - -ZLColorOption &FBOptions::colorOption(const std::string &style) { - std::map<std::string,shared_ptr<ZLColorOption> >::const_iterator it = - myColorOptions.find(style); - return it != myColorOptions.end() ? *it->second : RegularTextColorOption; -} diff --git a/fbreader/src/options/FBOptions.h b/fbreader/src/options/FBOptions.h deleted file mode 100644 index be1e1fc..0000000 --- a/fbreader/src/options/FBOptions.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 __FBOPTIONS_H__ -#define __FBOPTIONS_H__ - -#include <string> -#include <map> - -#include <shared_ptr.h> - -#include <ZLOptions.h> -#include <ZLTextStyle.h> - -class FBOptions { - -public: - static FBOptions& Instance(); - -private: - static FBOptions *ourInstance; - -public: - ZLIntegerRangeOption LeftMarginOption; - ZLIntegerRangeOption RightMarginOption; - ZLIntegerRangeOption TopMarginOption; - ZLIntegerRangeOption BottomMarginOption; - ZLColorOption BackgroundColorOption; - ZLColorOption RegularTextColorOption; - - ZLColorOption &colorOption(const std::string &style); - -private: - FBOptions(); - FBOptions(const FBOptions&); - const FBOptions &operator = (const FBOptions&); - -private: - std::map<std::string,shared_ptr<ZLColorOption> > myColorOptions; -}; - -inline FBOptions& FBOptions::Instance() { - if (ourInstance == 0) { - ourInstance = new FBOptions(); - } - return *ourInstance; -} - -#endif /* __FBOPTIONS_H__ */ diff --git a/fbreader/src/options/FBTextStyle.cpp b/fbreader/src/options/FBTextStyle.cpp deleted file mode 100644 index c8ad9c5..0000000 --- a/fbreader/src/options/FBTextStyle.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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 <ZLOptions.h> - -#include "FBTextStyle.h" - -shared_ptr<ZLTextStyle> FBTextStyle::ourInstance; - -shared_ptr<ZLTextStyle> FBTextStyle::InstanceAsPtr() { - if (ourInstance.isNull()) { - ourInstance = new FBTextStyle(); - } - return ourInstance; -} - -FBTextStyle &FBTextStyle::Instance() { - return (FBTextStyle&)*InstanceAsPtr(); -} - -static const std::string GROUP = "Style"; - -FBTextStyle::FBTextStyle() : - FontFamilyOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:fontFamily", ""), - FontSizeOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:fontSize", 5, 72, 26), - 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.4), - LineSpacePercentOption(ZLCategoryKey::LOOK_AND_FEEL, GROUP, "Base:lineSpacingPercent", 140) { -} - -const std::string &FBTextStyle::colorStyle() const { - return REGULAR_TEXT; -} - -bool FBTextStyle::isDecorated() const { - return false; -} - -const std::string &FBTextStyle::fontFamily() const { - return FontFamilyOption.value(); -} - -int FBTextStyle::fontSize() const { - return FontSizeOption.value(); -} - -bool FBTextStyle::bold() const { - return BoldOption.value(); -} - -bool FBTextStyle::italic() const { - return ItalicOption.value(); -} - -short FBTextStyle::spaceBefore(const ZLTextStyleEntry::Metrics&) const { - return 0; -} - -short FBTextStyle::spaceAfter(const ZLTextStyleEntry::Metrics&) const { - return 0; -} - -short FBTextStyle::lineStartIndent(const ZLTextStyleEntry::Metrics&, bool) const { - return 0; -} - -short FBTextStyle::lineEndIndent(const ZLTextStyleEntry::Metrics&, bool) const { - return 0; -} - -short FBTextStyle::firstLineIndentDelta(const ZLTextStyleEntry::Metrics&) const { - return 0; -} - -int FBTextStyle::verticalShift() const { - return 0; -} - -ZLTextAlignmentType FBTextStyle::alignment() const { - return (ZLTextAlignmentType)AlignmentOption.value(); -} - -double FBTextStyle::lineSpace() const { - return LineSpacePercentOption.value() / 100.0; -} - -bool FBTextStyle::allowHyphenations() const { - return true; -} diff --git a/fbreader/src/options/FBTextStyle.h b/fbreader/src/options/FBTextStyle.h deleted file mode 100644 index 8bc0762..0000000 --- a/fbreader/src/options/FBTextStyle.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 __FBTEXTSTYLE_H__ -#define __FBTEXTSTYLE_H__ - -#include <ZLTextStyle.h> - -class FBTextStyle : public ZLTextStyle { - -public: - static shared_ptr<ZLTextStyle> InstanceAsPtr(); - static FBTextStyle &Instance(); - -private: - static shared_ptr<ZLTextStyle> ourInstance; - -private: - FBTextStyle(); - -public: - bool isDecorated() const; - - const std::string &fontFamily() const; - - int fontSize() const; - bool bold() const; - bool italic() const; - - const std::string &colorStyle() const; - - short spaceBefore(const ZLTextStyleEntry::Metrics &metrics) const; - short spaceAfter(const ZLTextStyleEntry::Metrics &metrics) const; - short lineStartIndent(const ZLTextStyleEntry::Metrics &metrics, bool rtl) const; - short lineEndIndent(const ZLTextStyleEntry::Metrics &metrics, bool rtl) const; - short firstLineIndentDelta(const ZLTextStyleEntry::Metrics &metrics) const; - int verticalShift() const; - - ZLTextAlignmentType alignment() const; - - double lineSpace() const; - - bool allowHyphenations() const; - -public: - ZLStringOption FontFamilyOption; - ZLIntegerRangeOption FontSizeOption; - ZLBooleanOption BoldOption; - ZLBooleanOption ItalicOption; - ZLIntegerOption AlignmentOption; - ZLDoubleOption LineSpaceOption; - ZLIntegerOption LineSpacePercentOption; -}; - -#endif /* __FBTEXTSTYLE_H__ */ |