1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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());
}
|