git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
0b7e3d7
)
TUI: Disable "< << > >>" buttons as required
author
Niki Roo
<niki@nikiroo.be>
Fri, 30 Jun 2017 08:35:00 +0000
(10:35 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Fri, 30 Jun 2017 08:35:00 +0000
(10:35 +0200)
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
b/src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
index 26c1917deb441cf3939b3d669fcbdf89cc2c3323..ce4c58ab77c03a044da68a1eeb2c23c08465610c 100644
(file)
--- a/
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
+++ b/
src/be/nikiroo/fanfix/reader/TuiReaderStoryWindow.java
@@
-67,6
+67,10
@@
public class TuiReaderStoryWindow extends TWindow {
setChapter(getStory().getChapters().size());
}
}));
setChapter(getStory().getChapters().size());
}
}));
+
+ navigationButtons.get(0).setEnabled(false);
+ navigationButtons.get(1).setEnabled(false);
+ navigationButtons.get(2).setEnabled(false);
chapterName = addLabel("", 14, row);
chapterName.setWidth(getWidth() - 10);
chapterName = addLabel("", 14, row);
chapterName.setWidth(getWidth() - 10);
@@
-109,6
+113,14
@@
public class TuiReaderStoryWindow extends TWindow {
if (chapter != this.chapter) {
this.chapter = chapter;
if (chapter != this.chapter) {
this.chapter = chapter;
+
+ int max = getStory().getChapters().size();
+ navigationButtons.get(0).setEnabled(chapter > 0);
+ navigationButtons.get(1).setEnabled(chapter > 0);
+ navigationButtons.get(2).setEnabled(chapter > 0);
+ navigationButtons.get(3).setEnabled(chapter < max);
+ navigationButtons.get(4).setEnabled(chapter < max);
+
Chapter chap;
String name;
if (chapter == 0) {
Chapter chap;
String name;
if (chapter == 0) {
@@
-116,8
+128,7
@@
public class TuiReaderStoryWindow extends TWindow {
name = String.format(" %s", chap.getName());
} else {
chap = getStory().getChapters().get(chapter - 1);
name = String.format(" %s", chap.getName());
} else {
chap = getStory().getChapters().get(chapter - 1);
- name = String.format(" %d/%d: %s", chapter, getStory()
- .getChapters().size(), chap.getName());
+ name = String.format(" %d/%d: %s", chapter, max, chap.getName());
}
while (name.length() < getWidth() - chapterName.getX()) {
}
while (name.length() < getWidth() - chapterName.getX()) {