~ubuntu-branches/ubuntu/vivid/fbreader/vivid-proposed

« back to all changes in this revision

Viewing changes to fbreader/src/fbreader/FBView.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Joey Hess
  • Date: 2008-01-23 16:51:07 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123165107-5q19etahzd72c33a
Tags: 0.8.12-3
* Add libzlui-maemo which allows using fbreader on the maemo platform, on
  Debian. Thanks, Riku Voipio. Closes: #462299
* makefiles/arch/maemo.mk: Don't build with -thumb. (Riku)
* Loosen dependency versions some more, so it only depends on the current
  upstream version or higher, ignoring the Debian revision.
* Use binary:Version instead of deprecated Source-Version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * FBReader -- electronic book reader
3
 
 * Copyright (C) 2004-2007 Nikolay Pultsin <geometer@mawhrin.net>
4
 
 * Copyright (C) 2005 Mikhail Sobolev <mss@mawhrin.net>
 
2
 * Copyright (C) 2004-2008 Geometer Plus <contact@geometerplus.com>
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or modify
7
5
 * it under the terms of the GNU General Public License as published by
28
26
static const std::string OPTIONS = "Options";
29
27
 
30
28
FBMargins::FBMargins() :
31
 
        LeftMarginOption(ZLOption::LOOK_AND_FEEL_CATEGORY, OPTIONS, "LeftMargin", 0, 1000, 4),
32
 
        RightMarginOption(ZLOption::LOOK_AND_FEEL_CATEGORY, OPTIONS, "RightMargin", 0, 1000, 4),
33
 
        TopMarginOption(ZLOption::LOOK_AND_FEEL_CATEGORY, OPTIONS, "TopMargin", 0, 1000, 0),
34
 
        BottomMarginOption(ZLOption::LOOK_AND_FEEL_CATEGORY, OPTIONS, "BottomMargin", 0, 1000, 4) {
 
29
        LeftMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "LeftMargin", 0, 1000, 4),
 
30
        RightMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "RightMargin", 0, 1000, 4),
 
31
        TopMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "TopMargin", 0, 1000, 0),
 
32
        BottomMarginOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "BottomMargin", 0, 1000, 4) {
35
33
}
36
34
 
37
35
static const std::string INDICATOR = "Indicator";
38
36
 
39
37
FBIndicatorStyle::FBIndicatorStyle() :
40
 
        ShowOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "Show", true),
41
 
        IsSensitiveOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "TouchSensitive", true),
42
 
        ShowTextPositionOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "PositionText", true),
43
 
        ShowTimeOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "Time", true),
44
 
        ColorOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "Color", ZLColor(127, 127, 127)),
45
 
        HeightOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "Height", 1, 100, 16),
46
 
        OffsetOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "Offset", 0, 100, 3),
47
 
        FontSizeOption(ZLOption::LOOK_AND_FEEL_CATEGORY, INDICATOR, "FontSize", 4, 72, 14) {
 
38
        ShowOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Show", true),
 
39
        IsSensitiveOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "TouchSensitive", true),
 
40
        ShowTextPositionOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "PositionText", true),
 
41
        ShowTimeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Time", true),
 
42
        ColorOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Color", ZLColor(127, 127, 127)),
 
43
        HeightOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Height", 1, 100, 16),
 
44
        OffsetOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "Offset", 0, 100, 3),
 
45
        FontSizeOption(ZLCategoryKey::LOOK_AND_FEEL, INDICATOR, "FontSize", 4, 72, 14) {
48
46
}
49
47
 
50
48
bool FBIndicatorStyle::isVisible() const {
81
79
 
82
80
shared_ptr<ZLTextPositionIndicatorInfo> FBView::ourIndicatorInfo;
83
81
shared_ptr<FBMargins> FBView::ourMargins;
 
82
shared_ptr<ZLBooleanOption> FBView::ourSelectionOption;
84
83
 
85
84
FBIndicatorStyle& FBView::commonIndicatorInfo() {
86
85
        if (ourIndicatorInfo.isNull()) {
99
98
        return ourIndicatorInfo;
100
99
}
101
100
 
102
 
bool FBView::onFingerTap(int, int y) {
 
101
void FBView::doTapScrolling(int y) {
103
102
        if (2 * y < context().height()) {
104
 
                fbreader().doAction(ACTION_FINGER_TAP_SCROLL_BACKWARD);
 
103
                fbreader().doAction(ActionCode::TAP_SCROLL_BACKWARD);
105
104
        } else {
106
 
                fbreader().doAction(ACTION_FINGER_TAP_SCROLL_FORWARD);
 
105
                fbreader().doAction(ActionCode::TAP_SCROLL_FORWARD);
107
106
        }
 
107
}
 
108
 
 
109
bool FBView::onFingerTap(int, int y) {
 
110
        doTapScrolling(y);
108
111
        return true;
109
112
}
110
113
 
125
128
                return true;
126
129
        }
127
130
 
 
131
        if (fbreader().EnableTapScrollingOption.value() &&
 
132
                        (!ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::FINGER_TAP_DETECTABLE, false).value() ||
 
133
                         !fbreader().TapScrollingOnFingerOnlyOption.value())) {
 
134
                doTapScrolling(y);
 
135
                return true;
 
136
        }
 
137
 
128
138
        activateSelection(x, y);
129
139
        return true;
130
140
}
176
186
int FBView::bottomMargin() const {
177
187
        return margins().BottomMarginOption.value();
178
188
}
 
189
 
 
190
ZLBooleanOption &FBView::selectionOption() {
 
191
        if (ourSelectionOption.isNull()) {
 
192
                ourSelectionOption = new ZLBooleanOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "IsSelectionEnabled", true);
 
193
        }
 
194
        return *ourSelectionOption;
 
195
}
 
196
 
 
197
bool FBView::isSelectionEnabled() const {
 
198
        return selectionOption().value();
 
199
}