Exemplo n.º 1
0
void ZLApplication::doActionByKey(const std::string &key) {
    shared_ptr<ZLKeyBindings> bindings = keyBindings();
    if (bindings.isNull()) {
        return;
    }
    shared_ptr<Action> a = action(bindings->getBinding(key));
    if (!a.isNull() &&
            (!a->useKeyDelay() ||
             (myLastKeyActionTime.millisecondsTo(ZLTime()) >= KeyDelayOption.value()))) {
        a->checkAndRun();
        myLastKeyActionTime = ZLTime();
    }
}
Exemplo n.º 2
0
void ScrollingAction::run() {
	FBReader &fbreader = FBReader::Instance();
	shared_ptr<ZLView> view = fbreader.currentView();
	int delay = fbreader.myLastScrollingTime.millisecondsTo(ZLTime());
	if (view.isNull() ||
			(delay >= 0 && delay < scrollingDelay())) {
		return;
	}

	if (view->isInstanceOf(ZLTextView::TYPE_ID)) {
		((ZLTextView&)*view).scrollPage(myForward, myTextScrollingMode, textOptionValue());
		FBReader::Instance().refreshWindow();
	} else if (view->isInstanceOf(ZLBlockTreeView::TYPE_ID)) {
		((ZLBlockTreeView&)*view).scroll(myBlockScrollingMode, !myForward);
	}
	fbreader.myLastScrollingTime = ZLTime();
}
Exemplo n.º 3
0
void FBReader::ScrollingAction::run() {
	int delay = myFBReader.myLastScrollingTime.millisecondsTo(ZLTime());
	TextView *textView = (TextView*)myFBReader.currentView();
	if ((textView != 0) && ((delay < 0) || (delay >= myOptions.DelayOption.value()))) {
		TextView::ScrollingMode oType = (TextView::ScrollingMode)myOptions.ModeOption.value();
		unsigned int oValue = 0;
		switch (oType) {
			case TextView::KEEP_LINES:
				oValue = myOptions.LinesToKeepOption.value();
				break;
			case TextView::SCROLL_LINES:
				oValue = myOptions.LinesToScrollOption.value();
				break;
			case TextView::SCROLL_PERCENTAGE:
				oValue = myOptions.PercentToScrollOption.value();
				break;
			default:
				break;
		}
		textView->scrollPage(myForward, oType, oValue);
		myFBReader.refreshWindow();
		myFBReader.myLastScrollingTime = ZLTime();
	}
}
Exemplo n.º 4
0
ZLTime ZLUnixTimeManager::currentTime() const {
	struct timeb timeB;
	ftime(&timeB);
	return ZLTime(timeB.time, timeB.millitm);
}