Beispiel #1
0
void BookTextView::saveState() {
	const ZLTextWordCursor &cursor = textArea().startCursor();

	if (myBook.isNull()) {
		return;
	}

	if (!cursor.isNull()) {
		ZLIntegerOption(ZLCategoryKey::STATE, LAST_STATE_GROUP, PARAGRAPH_OPTION_NAME, 0).setValue(cursor.paragraphCursor().index());
		ZLIntegerOption(ZLCategoryKey::STATE, LAST_STATE_GROUP, WORD_OPTION_NAME, 0).setValue(cursor.elementIndex());
		ZLIntegerOption(ZLCategoryKey::STATE, LAST_STATE_GROUP, CHAR_OPTION_NAME, 0).setValue(cursor.charIndex());
		ZLIntegerOption(ZLCategoryKey::STATE, LAST_STATE_GROUP, POSITION_IN_BUFFER, 0).setValue(myCurrentPointInStack);
		ZLBooleanOption(ZLCategoryKey::STATE, LAST_STATE_GROUP, STATE_VALID, false).setValue(true);

		if (myStackChanged) {
			BooksDB::Instance().saveBookStateStack(*myBook, myPositionStack);
			myStackChanged = false;
		}
	}
}
Beispiel #2
0
bool FBView::onStylusRelease(int x, int y) {
	if (ZLTextView::onStylusRelease(x, y)) {
		return true;
	}
	
	if (_onStylusRelease(x, y)) {
		return true;
	}

	myIsReleasedWithoutMotion =
		myIsReleasedWithoutMotion && (abs(x - pressedX()) <= 5) && (abs(y - pressedY()) <= 5);
	if (isReleasedWithoutMotion() &&
			fbreader().EnableTapScrollingOption.value() &&
			(!ZLBooleanOption(ZLCategoryKey::EMPTY, ZLOption::PLATFORM_GROUP, ZLOption::FINGER_TAP_DETECTABLE, false).value() ||
			 !fbreader().TapScrollingOnFingerOnlyOption.value())) {
		doTapScrolling(y);
		return true;
	}

	return false;
}
Beispiel #3
0
void ReadingOptionsDialog::createKeyBindingsTab() {
	ZLDialogContent &dialogTab = dialog().createTab(ZLResourceKey("Keys"));
	FBReader &fbreader = FBReader::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(fbreader.QuitOnCancelOption);
	keyEntry->setExitOnCancelEntry(exitOnCancelEntry);
	dialogTab.addOption(ZLResourceKey("quitOnCancel"), exitOnCancelEntry);
	exitOnCancelEntry->setVisible(false);
	useSeparateBindingsEntry->onStateChanged(useSeparateBindingsEntry->initialState());
	dialogTab.addOption(ZLResourceKey("keyDelay"), new ZLSimpleSpinOptionEntry(fbreader.KeyDelayOption, 50));
}