+
+ @Override
+ public void search(SupportType searchOn, String keywords, int page, int item) {
+ reader.search(searchOn, keywords, page,item);
+ }
+
+ @Override
+ public void searchTag(SupportType searchOn, int page, int item, String... tags) {
+ reader.searchTag(searchOn, page, item, tags);
+ }
+
+ /**
+ * Open the given {@link Story} for reading. This may or may not start an
+ * external program to read said {@link Story}.
+ *
+ * @param story
+ * the {@link Story} to read
+ * @param sync
+ * execute the process synchronously (wait until it is terminated
+ * before returning)
+ *
+ * @throws IOException
+ * in case of I/O errors
+ */
+ public void read(Story story, boolean sync) throws IOException {
+ if (story == null) {
+ throw new IOException("No story to read");
+ }
+
+ // TODO: open in editor + external option
+ if (!story.getMeta().isImageDocument()) {
+ TWindow window = new TuiReaderStoryWindow(this, story, getChapter());
+ window.maximize();
+ } else {
+ try {
+ openExternal(getLibrary(), story.getMeta().getLuid(), sync);
+ } catch (IOException e) {
+ messageBox("Error when trying to open the story",
+ e.getMessage(), TMessageBox.Type.OK);
+ }
+ }
+ }
+
+ /**
+ * Set the default status bar when this window appear.
+ * <p>
+ * Some shortcuts are always visible, and will be put here.
+ * <p>
+ * Note that shortcuts placed this way on menu won't work unless the menu
+ * also implement them.
+ *
+ * @param window
+ * the new window or menu on screen
+ * @param description
+ * the description to show on the status ba
+ */
+ public TStatusBar setStatusBar(TWindow window, String description) {
+ TStatusBar statusBar = window.newStatusBar(description);
+ statusBar.addShortcutKeypress(TKeypress.kbF10, CMD_EXIT, "Exit");
+ return statusBar;
+
+ }
+
+ private void showMain() {
+ if (main != null && main.isVisible()) {
+ main.activate();
+ } else {
+ if (main != null) {
+ main.close();
+ }
+ main = new TuiReaderMainWindow(this);
+ main.maximize();
+ }
+ }