1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 02:39:23 +02:00

text selection: added 'scrolling in selection mode'

plucker plugin is temporary commented


git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@857 6a642e6f-84f6-412e-ac94-c4a38d5a04b0
This commit is contained in:
Nikolay Pultsin 2008-05-08 15:42:41 +00:00
parent 3354b9c134
commit eb9012933c
3 changed files with 30 additions and 7 deletions

View file

@ -40,7 +40,7 @@ public class PluginCollection {
if (ourInstance == null) { if (ourInstance == null) {
ourInstance = new PluginCollection(); ourInstance = new PluginCollection();
ourInstance.myPlugins.add(new FB2Plugin()); ourInstance.myPlugins.add(new FB2Plugin());
ourInstance.myPlugins.add(new PluckerPlugin()); //ourInstance.myPlugins.add(new PluckerPlugin());
//ourInstance->myPlugins.push_back(new DocBookPlugin()); //ourInstance->myPlugins.push_back(new DocBookPlugin());
//ourInstance.myPlugins.add(new HtmlPlugin()); //ourInstance.myPlugins.add(new HtmlPlugin());
/*ourInstance.myPlugins.add(new TxtPlugin()); /*ourInstance.myPlugins.add(new TxtPlugin());

View file

@ -22,6 +22,7 @@ package org.geometerplus.zlibrary.text.view.impl;
import java.util.*; import java.util.*;
import org.geometerplus.zlibrary.core.application.ZLApplication; import org.geometerplus.zlibrary.core.application.ZLApplication;
import org.geometerplus.zlibrary.text.view.ZLTextView;
final class ZLTextSelectionModel { final class ZLTextSelectionModel {
final static class BoundElement { final static class BoundElement {
@ -145,11 +146,11 @@ final class ZLTextSelectionModel {
myStoredY = y; myStoredY = y;
if (!mySecondBound.Before.Exists) { if (!mySecondBound.Before.Exists) {
//startSelectionScrolling(false); startSelectionScrolling(false);
} else if (!mySecondBound.After.Exists) { } else if (!mySecondBound.After.Exists) {
//startSelectionScrolling(true); startSelectionScrolling(true);
} else { } else {
//stopSelectionScrolling(); stopSelectionScrolling();
} }
if (!oldRange.Left.equalsTo(newRange.Left) || !oldRange.Right.equalsTo(newRange.Right)) { if (!oldRange.Left.equalsTo(newRange.Left) || !oldRange.Right.equalsTo(newRange.Right)) {
@ -173,13 +174,13 @@ final class ZLTextSelectionModel {
} }
void deactivate() { void deactivate() {
//stopSelectionScrolling(); stopSelectionScrolling();
myIsActive = false; myIsActive = false;
myDoUpdate = false; myDoUpdate = false;
} }
void clear() { void clear() {
//stopSelectionScrolling(); stopSelectionScrolling();
myIsEmpty = true; myIsEmpty = true;
myIsActive = false; myIsActive = false;
myDoUpdate = false; myDoUpdate = false;
@ -270,4 +271,26 @@ final class ZLTextSelectionModel {
bound.After.Exists = false; bound.After.Exists = false;
} }
} }
private final Timer myTimer = new Timer();
private TimerTask myScrollingTask;
private void startSelectionScrolling(final boolean forward) {
stopSelectionScrolling();
myScrollingTask = new TimerTask() {
public void run() {
myView.scrollPage(forward, ZLTextView.ScrollingMode.SCROLL_LINES, 1);
myDoUpdate = true;
myView.Application.refreshWindow();
}
};
myTimer.schedule(myScrollingTask, 200, 400);
}
private void stopSelectionScrolling() {
if (myScrollingTask != null) {
myScrollingTask.cancel();
}
myScrollingTask = null;
}
} }

View file

@ -360,7 +360,7 @@ public abstract class ZLTextViewImpl extends ZLTextView {
} }
} }
public void paint() { public synchronized void paint() {
//android.os.Debug.startMethodTracing("/tmp/paint"); //android.os.Debug.startMethodTracing("/tmp/paint");
preparePaintInfo(); preparePaintInfo();