rename configuration tab
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 25 Apr 2008 06:54:20 +0000 (06:54 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 25 Apr 2008 06:54:20 +0000 (06:54 +0000)
rename antialiasing option
make options independent

git-svn-id: http://trooper/svn/projects/jSite/trunk@763 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/jsite/gui/ConfigurationDialog.java
src/net/pterodactylus/jsite/gui/SwingInterface.java
src/net/pterodactylus/jsite/i18n/jSite.properties

index 4444868..c512c46 100644 (file)
@@ -40,7 +40,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        private I18nAction cancelAction;
 
        /** The “beautify GUI” action. */
-       private I18nAction beautifyAction;
+       private I18nAction antialiasAction;
 
        /** The “use custom control font” action. */
        private I18nAction useCustomControlFontAction;
@@ -49,7 +49,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        private I18nAction useCustomUserFontAction;
 
        /** The “beautify” checkbox. */
-       private JCheckBox beautifyCheckBox;
+       private JCheckBox antialiasCheckBox;
 
        /** The “use custom” fonts checkbox. */
        private JCheckBox useCustomControlFontCheckBox;
@@ -104,22 +104,18 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         * @return <code>true</code> if the checkbox was selected,
         *         <code>false</code> otherwise
         */
-       public boolean getBeautify() {
-               return beautifyCheckBox.isSelected();
+       public boolean isAntialias() {
+               return antialiasCheckBox.isSelected();
        }
 
        /**
-        * Sets the state of the “beautify” checkbox.
+        * Sets the state of the “antialias” checkbox.
         *
-        * @param beautify
+        * @param antialias
         *            The state of the checkbox
         */
-       public void setBeautify(boolean beautify) {
-               beautifyCheckBox.setSelected(beautify);
-               useCustomControlFontCheckBox.setEnabled(beautify);
-               controlFontList.setEnabled(beautify && useCustomControlFontCheckBox.isSelected());
-               useCustomUserFontCheckBox.setEnabled(beautify);
-               userFontList.setEnabled(beautify && useCustomUserFontCheckBox.isSelected());
+       public void setAntialias(boolean antialias) {
+               antialiasCheckBox.setSelected(antialias);
        }
 
        /**
@@ -129,7 +125,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         *         font is to be used
         */
        public String getControlFont() {
-               return (String) ((beautifyCheckBox.isSelected() && useCustomControlFontCheckBox.isSelected()) ? controlFontList.getSelectedItem() : null);
+               return (String) (useCustomControlFontCheckBox.isSelected() ? controlFontList.getSelectedItem() : null);
        }
 
        /**
@@ -141,7 +137,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         */
        public void setControlFont(String controlFont) {
                useCustomControlFontCheckBox.setSelected(controlFont != null);
-               controlFontList.setEnabled(beautifyCheckBox.isSelected() && (controlFont != null));
+               controlFontList.setEnabled(controlFont != null);
                controlFontList.setSelectedItem(controlFont);
        }
 
@@ -152,7 +148,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         *         input font is to be used
         */
        public String getUserFont() {
-               return (String) ((beautifyCheckBox.isSelected() && useCustomUserFontCheckBox.isSelected()) ? userFontList.getSelectedItem() : null);
+               return (String) (useCustomUserFontCheckBox.isSelected() ? userFontList.getSelectedItem() : null);
        }
 
        /**
@@ -164,7 +160,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
         */
        public void setUserFont(String userFont) {
                useCustomUserFontCheckBox.setSelected(userFont != null);
-               userFontList.setEnabled(beautifyCheckBox.isSelected() && (userFont != null));
+               userFontList.setEnabled(userFont != null);
                userFontList.setSelectedItem(userFont);
        }
 
@@ -196,14 +192,13 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                                actionCancel();
                        }
                };
-               beautifyAction = new I18nAction("configurationDialog.page.interface.item.beautify") {
+               antialiasAction = new I18nAction("configurationDialog.page.interface.item.beautify") {
 
                        /**
                         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
                         */
-                       @SuppressWarnings("synthetic-access")
                        public void actionPerformed(ActionEvent actionEvent) {
-                               setBeautify(beautifyCheckBox.isSelected());
+                               /* do nothing. */
                        }
                };
                useCustomControlFontAction = new I18nAction("configurationDialog.page.interface.item.useCustomControlFont") {
@@ -239,7 +234,7 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                contentPane.add(tabbedPane, BorderLayout.CENTER);
 
                JComponent interfaceConfig = createInterfaceConfig();
-               tabbedPane.add("Swing Interface", interfaceConfig);
+               tabbedPane.add(I18n.get("configurationDialog.page.interface.name"), interfaceConfig);
 
                JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 12, 12));
                contentPane.add(buttonPanel, BorderLayout.PAGE_END);
@@ -261,17 +256,17 @@ public class ConfigurationDialog extends JDialog implements I18nable {
                JPanel interfaceConfigPanel = new JPanel(new GridBagLayout());
                interfaceConfigPanel.setBorder(BorderFactory.createEmptyBorder(12, 12, 12, 12));
 
-               beautifyCheckBox = new JCheckBox(beautifyAction);
-               interfaceConfigPanel.add(beautifyCheckBox, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
+               antialiasCheckBox = new JCheckBox(antialiasAction);
+               interfaceConfigPanel.add(antialiasCheckBox, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
 
                useCustomControlFontCheckBox = new JCheckBox(useCustomControlFontAction);
-               interfaceConfigPanel.add(useCustomControlFontCheckBox, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 18, 0, 0), 0, 0));
+               interfaceConfigPanel.add(useCustomControlFontCheckBox, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 0, 0, 0), 0, 0));
 
                controlFontList = new FontComboBox();
                interfaceConfigPanel.add(controlFontList, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
 
                useCustomUserFontCheckBox = new JCheckBox(useCustomUserFontAction);
-               interfaceConfigPanel.add(useCustomUserFontCheckBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 18, 0, 0), 0, 0));
+               interfaceConfigPanel.add(useCustomUserFontCheckBox, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0));
 
                userFontList = new FontComboBox();
                interfaceConfigPanel.add(userFontList, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(6, 6, 0, 0), 0, 0));
@@ -311,7 +306,9 @@ public class ConfigurationDialog extends JDialog implements I18nable {
        public void updateI18n() {
                okayAction.updateI18n();
                cancelAction.updateI18n();
-               beautifyAction.updateI18n();
+               antialiasAction.updateI18n();
+               useCustomControlFontAction.updateI18n();
+               useCustomUserFontAction.updateI18n();
                SwingUtils.repackCentered(this);
        }
 
index 09205bc..b5d651b 100644 (file)
@@ -105,8 +105,8 @@ public class SwingInterface implements CoreListener {
        // CONFIGURATION
        //
 
-       /** Whether to beautify the GUI. */
-       private boolean beautify;
+       /** Whether to antialias the GUI. */
+       private boolean antialias;
 
        /** The control font. */
        private String controlFont;
@@ -127,14 +127,14 @@ public class SwingInterface implements CoreListener {
                this.configDirectory = configDirectory;
                I18n.setLocale(Locale.ENGLISH);
                loadConfig();
-               if (beautify) {
+               if (antialias) {
                        System.setProperty("swing.aatext", "true");
-                       if (controlFont != null) {
-                               System.setProperty("swing.plaf.metal.controlFont", controlFont);
-                       }
-                       if (userFont != null) {
-                               System.setProperty("swing.plaf.metal.userFont", userFont);
-                       }
+               }
+               if (controlFont != null) {
+                       System.setProperty("swing.plaf.metal.controlFont", controlFont);
+               }
+               if (userFont != null) {
+                       System.setProperty("swing.plaf.metal.userFont", userFont);
                }
                initActions();
                initDialogs();
@@ -285,7 +285,7 @@ public class SwingInterface implements CoreListener {
         */
        private void loadConfig() {
                /* initialize default stuff. */
-               beautify = false;
+               antialias = false;
                /* now read config. */
                File configFile = new File(configDirectory, "swing-interface.properties");
                if (!configFile.exists() || !configFile.canRead() || !configFile.isFile()) {
@@ -302,8 +302,8 @@ public class SwingInterface implements CoreListener {
                } finally {
                        Closer.close(configInputStream);
                }
-               if (configProperties.containsKey("beautify")) {
-                       beautify = Boolean.valueOf(configProperties.getProperty("beautify"));
+               if (configProperties.containsKey("antialias")) {
+                       antialias = Boolean.valueOf(configProperties.getProperty("antialias"));
                }
                if (configProperties.containsKey("controlFont")) {
                        controlFont = configProperties.getProperty("controlFont");
@@ -330,7 +330,7 @@ public class SwingInterface implements CoreListener {
                }
                File configFile = new File(configDirectory, "swing-interface.properties");
                Properties configProperties = new Properties();
-               configProperties.setProperty("beautify", String.valueOf(beautify));
+               configProperties.setProperty("antialias", String.valueOf(antialias));
                if (controlFont != null) {
                        configProperties.setProperty("controlFont", controlFont);
                }
@@ -484,12 +484,12 @@ public class SwingInterface implements CoreListener {
         * Shows the configuration dialog.
         */
        private void configure() {
-               configurationDialog.setBeautify(beautify);
+               configurationDialog.setAntialias(antialias);
                configurationDialog.setControlFont(controlFont);
                configurationDialog.setUserFont(userFont);
                configurationDialog.setVisible(true);
                if (!configurationDialog.wasCancelled()) {
-                       beautify = configurationDialog.getBeautify();
+                       antialias = configurationDialog.isAntialias();
                        controlFont = configurationDialog.getControlFont();
                        userFont = configurationDialog.getUserFont();
                        saveConfig();
index 1a79960..4ba5de4 100644 (file)
@@ -203,8 +203,22 @@ aboutDialog.page.license.header.mnemonic: VK_UNDEFINED
 #
 configurationDialog.title: Configuration
 
+configurationDialog.page.interface.name: Interface Tweaks
+
 configurationDialog.page.interface.item.beautify.name: Beautify GUI (requires restart)
 configurationDialog.page.interface.item.beautify.mnemonic: VK_B
 configurationDialog.page.interface.item.beautify.accelerator: Alt-VK_B
 configurationDialog.page.interface.item.beautify.shortDescription: Use a nicer font for the GUI
 configurationDialog.page.interface.item.beautify.longDescription: Use a nicer font for the GUI
+
+configurationDialog.page.interface.item.useCustomControlFont.name: Use custom control font
+configurationDialog.page.interface.item.useCustomControlFont.mnemonic: VK_C
+configurationDialog.page.interface.item.useCustomControlFont.accelerator: Alt-VK_C
+configurationDialog.page.interface.item.useCustomControlFont.shortDescription: Use custom control font for the GUI
+configurationDialog.page.interface.item.useCustomControlFont.longDescription: Use custom control font for the GUI
+
+configurationDialog.page.interface.item.useCustomUserFont.name: Use custom text font
+configurationDialog.page.interface.item.useCustomUserFont.mnemonic: VK_T
+configurationDialog.page.interface.item.useCustomUserFont.accelerator: Alt-VK_T
+configurationDialog.page.interface.item.useCustomUserFont.shortDescription: Use custom text font for the GUI
+configurationDialog.page.interface.item.useCustomUserFont.longDescription: Use custom text font for the GUI