Update nikiroo-utils, add new UI Options menu
authorNiki Roo <niki@nikiroo.be>
Wed, 8 Mar 2017 19:28:13 +0000 (20:28 +0100)
committerNiki Roo <niki@nikiroo.be>
Wed, 8 Mar 2017 19:28:13 +0000 (20:28 +0100)
- 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)

changelog.md
libs/nikiroo-utils-1.4.0-sources.jar [moved from libs/nikiroo-utils-1.3.6-sources.jar with 63% similarity]
src/be/nikiroo/fanfix/output/InfoText.java
src/be/nikiroo/fanfix/output/LaTeX.java
src/be/nikiroo/fanfix/reader/LocalReaderFrame.java
src/be/nikiroo/fanfix/supported/BasicSupport.java
src/be/nikiroo/fanfix/test/BasicSupportTest.java

index 4fc105909dc27165f202e3057ce92b3685e8e794..1aa90a1ec713777f9c364fa1c19a0f9dcaa6a8aa 100644 (file)
@@ -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
similarity index 63%
rename from libs/nikiroo-utils-1.3.6-sources.jar
rename to libs/nikiroo-utils-1.4.0-sources.jar
index e3d3c8f1f37a5f50e0e4055f076e833098384866..afb2819a856244fcc6d3e1799fe0c0503dc0593b 100644 (file)
Binary files a/libs/nikiroo-utils-1.3.6-sources.jar and b/libs/nikiroo-utils-1.4.0-sources.jar differ
index 66df9474ea4cb6753e1a3be51cbfc5d7a01d50e0..cce715dcca8d228d36b51776a5d6cc4f44166e3f 100644 (file)
@@ -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
index de3bd057e89298fca99074d7b2020d796d987f3c..d677f10f5b9d6355682febea623fbdef58321adf 100644 (file)
@@ -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
index 8efe1f7f65d2feb55e412a8e732d4b10186bc512..58c75963d2940e72c856b5a93e34bd83d1a05e01 100644 (file)
@@ -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<Config> ed = new ConfigEditor<Config>(
+                                               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<UiConfig> ed = new ConfigEditor<UiConfig>(
+                                               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.
         * 
index 97338ba4b1d8fca449c16b5799e5d4d8a23b13ed..0ee12fec463cef8b1c6dd31093ad2401c9ef4587 100644 (file)
@@ -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);
 
        /**
index 645d042e74467a3b8a2497f9b287fd1200b39a4b..40da442c0a76afb7f3c4514f8e35242c984f9da3 100644 (file)
@@ -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;