import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Paragraph;
import be.nikiroo.fanfix.data.Story;
import be.nikiroo.fanfix.data.Chapter;
import be.nikiroo.fanfix.data.MetaData;
import be.nikiroo.fanfix.data.Paragraph;
import be.nikiroo.fanfix.data.Story;
- public TuiReaderStoryWindow(TApplication app, MetaData meta) {
- this(app, meta, 0);
- }
-
- public TuiReaderStoryWindow(TApplication app, MetaData meta, int chapter) {
+ // chapter: -1 for "none" (0 is desc)
+ public TuiReaderStoryWindow(TApplication app, BasicLibrary lib,
+ MetaData meta, int chapter) {
super(app, desc(meta), 0, 0, 60, 18, CENTERED | RESIZABLE);
super(app, desc(meta), 0, 0, 60, 18, CENTERED | RESIZABLE);
- textField = new TText2(this, "", 0, 0, getWidth() - 2, getHeight() - 2);
+ textField = new TText(this, "", 0, 0, getWidth() - 2, getHeight() - 2);
statusBar = newStatusBar(desc(meta));
statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
statusBar = newStatusBar(desc(meta));
statusBar.addShortcutKeypress(TKeypress.kbF10, TCommand.cmExit, "Exit");
- navigationButtons.add(addButton(" ", 0, row, null)); // for bg colour when << button is pressed
+ navigationButtons.add(addButton(" ", 0, row, null)); // for bg colour
+ // when <<
+ // button is
+ // pressed
navigationButtons.add(addButton("<< ", 0, row, new TAction() {
navigationButtons.add(addButton("<< ", 0, row, new TAction() {
public void DO() {
setChapter(0);
}
}));
navigationButtons.add(addButton("< ", 4, row, new TAction() {
public void DO() {
setChapter(0);
}
}));
navigationButtons.add(addButton("< ", 4, row, new TAction() {
public void DO() {
setChapter(TuiReaderStoryWindow.this.chapter - 1);
}
}));
navigationButtons.add(addButton("> ", 7, row, new TAction() {
public void DO() {
setChapter(TuiReaderStoryWindow.this.chapter - 1);
}
}));
navigationButtons.add(addButton("> ", 7, row, new TAction() {
public void DO() {
setChapter(TuiReaderStoryWindow.this.chapter + 1);
}
}));
navigationButtons.add(addButton(">> ", 10, row, new TAction() {
public void DO() {
setChapter(TuiReaderStoryWindow.this.chapter + 1);
}
}));
navigationButtons.add(addButton(">> ", 10, row, new TAction() {
navigationButtons.get(0).setEnabled(false);
navigationButtons.get(1).setEnabled(false);
navigationButtons.get(2).setEnabled(false);
navigationButtons.get(0).setEnabled(false);
navigationButtons.get(1).setEnabled(false);
navigationButtons.get(2).setEnabled(false);
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);
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);
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, max, chap.getName());
+ name = String
+ .format(" %d/%d: %s", chapter, max, chap.getName());