From: Niki Roo Date: Wed, 8 Mar 2017 19:28:13 +0000 (+0100) Subject: Update nikiroo-utils, add new UI Options menu X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=e8eeea0a321493d270c35f594a8bf392cc95f4df;p=fanfix-jexer.git Update nikiroo-utils, add new UI Options menu - nikiroo-utils updated to 1.4.0 (with new R/W bundles and UI configuration controls) - new Options menu in UI to configure the program (minimalist UI for now) --- diff --git a/changelog.md b/changelog.md index 4fc1059..1aa90a1 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Fanfix +## Version (wip) + +- New Options menu in UI to configure the program (minimalist for now) + ## Version 1.4.1 - Fix UpdateChecker which showed the changes of ALL versions instead of the newer ones only diff --git a/libs/nikiroo-utils-1.3.6-sources.jar b/libs/nikiroo-utils-1.4.0-sources.jar similarity index 63% rename from libs/nikiroo-utils-1.3.6-sources.jar rename to libs/nikiroo-utils-1.4.0-sources.jar index e3d3c8f..afb2819 100644 Binary files a/libs/nikiroo-utils-1.3.6-sources.jar and b/libs/nikiroo-utils-1.4.0-sources.jar differ diff --git a/src/be/nikiroo/fanfix/output/InfoText.java b/src/be/nikiroo/fanfix/output/InfoText.java index 66df947..cce715d 100644 --- a/src/be/nikiroo/fanfix/output/InfoText.java +++ b/src/be/nikiroo/fanfix/output/InfoText.java @@ -9,13 +9,13 @@ import be.nikiroo.fanfix.data.Paragraph.ParagraphType; class InfoText extends Text { // quote chars - private char openQuote = Instance.getTrans().getChar( + private char openQuote = Instance.getTrans().getCharacter( StringId.OPEN_SINGLE_QUOTE); - private char closeQuote = Instance.getTrans().getChar( + private char closeQuote = Instance.getTrans().getCharacter( StringId.CLOSE_SINGLE_QUOTE); - private char openDoubleQuote = Instance.getTrans().getChar( + private char openDoubleQuote = Instance.getTrans().getCharacter( StringId.OPEN_DOUBLE_QUOTE); - private char closeDoubleQuote = Instance.getTrans().getChar( + private char closeDoubleQuote = Instance.getTrans().getCharacter( StringId.CLOSE_DOUBLE_QUOTE); @Override diff --git a/src/be/nikiroo/fanfix/output/LaTeX.java b/src/be/nikiroo/fanfix/output/LaTeX.java index de3bd05..d677f10 100644 --- a/src/be/nikiroo/fanfix/output/LaTeX.java +++ b/src/be/nikiroo/fanfix/output/LaTeX.java @@ -19,13 +19,13 @@ class LaTeX extends BasicOutput { private boolean lastWasQuote = false; // quote chars - private char openQuote = Instance.getTrans().getChar( + private char openQuote = Instance.getTrans().getCharacter( StringId.OPEN_SINGLE_QUOTE); - private char closeQuote = Instance.getTrans().getChar( + private char closeQuote = Instance.getTrans().getCharacter( StringId.CLOSE_SINGLE_QUOTE); - private char openDoubleQuote = Instance.getTrans().getChar( + private char openDoubleQuote = Instance.getTrans().getCharacter( StringId.OPEN_DOUBLE_QUOTE); - private char closeDoubleQuote = Instance.getTrans().getChar( + private char closeDoubleQuote = Instance.getTrans().getCharacter( StringId.CLOSE_DOUBLE_QUOTE); @Override diff --git a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java index 8efe1f7..58c7596 100644 --- a/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java +++ b/src/be/nikiroo/fanfix/reader/LocalReaderFrame.java @@ -34,6 +34,7 @@ import javax.swing.filechooser.FileNameExtensionFilter; import be.nikiroo.fanfix.Instance; import be.nikiroo.fanfix.Library; +import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.fanfix.bundles.UiConfig; import be.nikiroo.fanfix.data.MetaData; import be.nikiroo.fanfix.data.Story; @@ -41,6 +42,7 @@ import be.nikiroo.fanfix.output.BasicOutput.OutputType; import be.nikiroo.fanfix.reader.LocalReaderBook.BookActionListener; import be.nikiroo.utils.Progress; import be.nikiroo.utils.Version; +import be.nikiroo.utils.ui.ConfigEditor; import be.nikiroo.utils.ui.ProgressBar; /** @@ -340,9 +342,65 @@ class LocalReaderFrame extends JFrame { bar.add(authors); + JMenu options = new JMenu("Options"); + options.setMnemonic(KeyEvent.VK_O); + options.add(createMenuItemConfig()); + options.add(createMenuItemUiConfig()); + bar.add(options); + return bar; } + /** + * Create the Fanfix Configuration menu item. + * + * @return the item + */ + private JMenuItem createMenuItemConfig() { + final String title = "Fanfix Configuration"; + JMenuItem item = new JMenuItem(title); + item.setMnemonic(KeyEvent.VK_F); + + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + ConfigEditor ed = new ConfigEditor( + Config.class, Instance.getConfig(), + "This is where you configure the options of the program."); + JFrame frame = new JFrame(title); + frame.add(ed); + frame.setSize(800, 600); + frame.setVisible(true); + } + }); + + return item; + } + + /** + * Create the UI Configuration menu item. + * + * @return the item + */ + private JMenuItem createMenuItemUiConfig() { + final String title = "UI Configuration"; + JMenuItem item = new JMenuItem(title); + item.setMnemonic(KeyEvent.VK_U); + + item.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + ConfigEditor ed = new ConfigEditor( + UiConfig.class, Instance.getUiConfig(), + "This is where you configure the graphical appearence of the program."); + JFrame frame = new JFrame(title); + frame.add(ed); + frame.setSize(800, 600); + frame.setVisible(true); + } + }); + + return item; + } + /** * Create the export menu item. * diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 97338ba..0ee12fe 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -156,13 +156,13 @@ public abstract class BasicSupport { private URL currentReferer; // with only one 'r', as in 'HTTP'... // quote chars - private char openQuote = Instance.getTrans().getChar( + private char openQuote = Instance.getTrans().getCharacter( StringId.OPEN_SINGLE_QUOTE); - private char closeQuote = Instance.getTrans().getChar( + private char closeQuote = Instance.getTrans().getCharacter( StringId.CLOSE_SINGLE_QUOTE); - private char openDoubleQuote = Instance.getTrans().getChar( + private char openDoubleQuote = Instance.getTrans().getCharacter( StringId.OPEN_DOUBLE_QUOTE); - private char closeDoubleQuote = Instance.getTrans().getChar( + private char closeDoubleQuote = Instance.getTrans().getCharacter( StringId.CLOSE_DOUBLE_QUOTE); /** diff --git a/src/be/nikiroo/fanfix/test/BasicSupportTest.java b/src/be/nikiroo/fanfix/test/BasicSupportTest.java index 645d042..40da442 100644 --- a/src/be/nikiroo/fanfix/test/BasicSupportTest.java +++ b/src/be/nikiroo/fanfix/test/BasicSupportTest.java @@ -23,13 +23,13 @@ import be.nikiroo.utils.test.TestLauncher; public class BasicSupportTest extends TestLauncher { // quote chars - private char openQuote = Instance.getTrans().getChar( + private char openQuote = Instance.getTrans().getCharacter( StringId.OPEN_SINGLE_QUOTE); - private char closeQuote = Instance.getTrans().getChar( + private char closeQuote = Instance.getTrans().getCharacter( StringId.CLOSE_SINGLE_QUOTE); - private char openDoubleQuote = Instance.getTrans().getChar( + private char openDoubleQuote = Instance.getTrans().getCharacter( StringId.OPEN_DOUBLE_QUOTE); - private char closeDoubleQuote = Instance.getTrans().getChar( + private char closeDoubleQuote = Instance.getTrans().getCharacter( StringId.CLOSE_DOUBLE_QUOTE); public BasicSupportTest(String[] args) { @@ -255,10 +255,10 @@ public class BasicSupportTest extends TestLauncher { public void test() throws Exception { BasicSupportEmpty support = new BasicSupportEmpty(); - char openDoubleQuote = Instance.getTrans().getChar( - StringId.OPEN_DOUBLE_QUOTE); - char closeDoubleQuote = Instance.getTrans().getChar( - StringId.CLOSE_DOUBLE_QUOTE); + char openDoubleQuote = Instance.getTrans() + .getCharacter(StringId.OPEN_DOUBLE_QUOTE); + char closeDoubleQuote = Instance.getTrans() + .getCharacter(StringId.CLOSE_DOUBLE_QUOTE); String content = null; Paragraph para = null;