Skip to content

Commit

Permalink
Fixing PDF page switching
Browse files Browse the repository at this point in the history
  • Loading branch information
marigostra committed Jan 19, 2023
1 parent bc2acd6 commit 810d1f5
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/luwrain/app/viewer/App.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand Down Expand Up @@ -71,8 +71,8 @@ public App(String arg)
private ViewPdf createPdfView(File file) throws IOException
{
return new ViewPdf(getLuwrain(), file){
@Override void inaccessible() { getLuwrain().playSound(Sounds.ERROR); }
@Override void announcePage(int pageNum, int pageCount) { message("Страница " + pageNum, Luwrain.MessageType.OK); }
@Override void inaccessible() { getLuwrain().playSound(Sounds.EVENT_NOT_PROCESSED); }
@Override void announcePage(int pageNum, int pageCount) { message(getStrings().pdfPage(String.valueOf(pageNum), String.valueOf(pageCount)), Luwrain.MessageType.OK); }
@Override void announceMoveLeft() {}
@Override void announceMoveRight() {}
@Override void announceMoveUp() {}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/app/viewer/Extension.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/app/viewer/MainLayout.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/luwrain/app/viewer/Strings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand All @@ -22,4 +22,5 @@ public interface Strings
NAME = "luwrain.viewer";

String appName();
}
String pdfPage(String pageNum, String pageCount);
}
2 changes: 1 addition & 1 deletion src/main/java/org/luwrain/app/viewer/ViewImage.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/org/luwrain/app/viewer/ViewPdf.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2012-2022 Michael Pozhidaev <[email protected]>
Copyright 2012-2023 Michael Pozhidaev <[email protected]>
This file is part of LUWRAIN.
Expand Down Expand Up @@ -182,7 +182,7 @@ public void close()
});
}

public boolean showPage(int index)
private boolean showPage(int index)
{
if (index < 0 || index >= getPageCount())
return false;
Expand All @@ -193,7 +193,7 @@ public boolean showPage(int index)
return false;
}

int getPageCount()
private int getPageCount()
{
return doc.getNumberOfPages();
}
Expand Down Expand Up @@ -304,16 +304,16 @@ private void onKey(Interaction.GraphicalModeControl graphicalModeControl, KeyEve
graphicalModeControl.close();
break;
case PAGE_DOWN:
// listener.onInputEvent(new InputEvent(InputEvent.Special.PAGE_DOWN));
break;
nextPage();
break;
case PAGE_UP:
// listener.onInputEvent(new InputEvent(InputEvent.Special.PAGE_UP));
prevPage();
break;
case HOME:
// listener.onInputEvent(new InputEvent(InputEvent.Special.HOME));
showPage(0);
break;
case END:
// listener.onInputEvent(new InputEvent(InputEvent.Special.END));
showPage(getPageCount() - 1);
break;
case DOWN:
// listener.onInputEvent(new InputEvent(InputEvent.Special.ARROW_DOWN));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

AppName = Графический просмотр
PdfPage = Страница $1 из $2

0 comments on commit 810d1f5

Please sign in to comment.