mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 01:39:18 +02:00
new gotoBookmarkImplemantation(): open page with bookmark, do not move bookmark to page top
This commit is contained in:
parent
68a58cf242
commit
55bae8453f
3 changed files with 39 additions and 3 deletions
|
@ -1,4 +1,4 @@
|
|||
* re-implement go to bookmark operation
|
||||
DONE re-implement go to bookmark operation
|
||||
DONE highlight bookmarks
|
||||
DONE show highlights in footnote view
|
||||
DONE don't draw all bookmarks, filter by position
|
||||
|
|
|
@ -408,11 +408,15 @@ public final class FBReaderApp extends ZLApplication {
|
|||
final String modelId = bookmark.ModelId;
|
||||
if (modelId == null) {
|
||||
addInvisibleBookmark();
|
||||
BookTextView.gotoPosition(bookmark);
|
||||
BookTextView.gotoHighlighting(
|
||||
new BookmarkHighlighting(BookTextView, Collection, bookmark)
|
||||
);
|
||||
setView(BookTextView);
|
||||
} else {
|
||||
setFootnoteModel(modelId);
|
||||
FootnoteView.gotoPosition(bookmark);
|
||||
FootnoteView.gotoHighlighting(
|
||||
new BookmarkHighlighting(FootnoteView, Collection, bookmark)
|
||||
);
|
||||
setView(FootnoteView);
|
||||
}
|
||||
getViewWidget().repaint();
|
||||
|
|
|
@ -142,6 +142,38 @@ public abstract class ZLTextView extends ZLTextViewBase {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void gotoHighlighting(ZLTextHighlighting highlighting) {
|
||||
myPreviousPage.reset();
|
||||
myNextPage.reset();
|
||||
boolean doRepaint = false;
|
||||
if (myCurrentPage.StartCursor.isNull()) {
|
||||
doRepaint = true;
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
if (myCurrentPage.StartCursor.isNull()) {
|
||||
return;
|
||||
}
|
||||
if (!highlighting.intersects(myCurrentPage)) {
|
||||
gotoPosition(highlighting.getStartPosition().getParagraphIndex(), 0, 0);
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
if (myCurrentPage.EndCursor.isNull()) {
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
while (!highlighting.intersects(myCurrentPage)) {
|
||||
doRepaint = true;
|
||||
scrollPage(true, ScrollingMode.NO_OVERLAPPING, 0);
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
if (doRepaint) {
|
||||
if (myCurrentPage.StartCursor.isNull()) {
|
||||
preparePaintInfo(myCurrentPage);
|
||||
}
|
||||
Application.getViewWidget().reset();
|
||||
Application.getViewWidget().repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized int search(final String text, boolean ignoreCase, boolean wholeText, boolean backward, boolean thisSectionOnly) {
|
||||
if (text.length() == 0) {
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue