changeset 26:9bf3d8de6904

Fix Preferences bug, bump version number.
author David Barts <n5jrn@me.com>
date Sun, 13 Dec 2020 11:20:06 -0800
parents a4737a525af8
children 404eb7e57fe6
files build.xml src/name/blackcap/imageprep/SettingsDialog.kt
diffstat 2 files changed, 20 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Wed Nov 25 08:40:45 2020 -0800
+++ b/build.xml	Sun Dec 13 11:20:06 2020 -0800
@@ -32,7 +32,7 @@
   <!-- Define the properties used by the build -->
   <property name="app.name"      value="${ant.project.name}"/>
   <toLowerCase target="lc.app.name" value="${app.name}"/>
-  <property name="app.version"   value="1.00"/>
+  <property name="app.version"   value="1.01"/>
   <property name="app.domain"    value="name.blackcap.${lc.app.name}"/>
   <property name="app.entry"     value="${app.domain}.MainKt"/>
   <property name="app.copyright" value="Copyright © 2020, David W. Barts."/>
--- a/src/name/blackcap/imageprep/SettingsDialog.kt	Wed Nov 25 08:40:45 2020 -0800
+++ b/src/name/blackcap/imageprep/SettingsDialog.kt	Sun Dec 13 11:20:06 2020 -0800
@@ -15,6 +15,8 @@
 import java.util.logging.Level
 import java.util.logging.Logger
 import javax.swing.*
+import javax.swing.event.ChangeEvent
+import javax.swing.event.ChangeListener
 import kotlin.text.toInt
 
 /* work around name shadowing */
@@ -44,8 +46,21 @@
         return _outputSuffix.text
     }
     
+    /* button to change that other directory */
+    private val otid = _PROPS.getBoolean("outputToInputDir")
+    protected val changeOutputTo = JButton("Change").also {
+        it.noTaller()
+        it.addActionListener(ActionListener {
+            val status = _outputTo.showOpenDialog(this)
+            if (status == JFileChooser.APPROVE_OPTION) {
+                val path = outputTo
+                outputToText.text = path
+            }
+        })
+        it.setEnabled(!otid)
+    }
+    
     /* output to input dir? */
-    private val otid = _PROPS.getBoolean("outputToInputDir")
     private val outputToInputButton = JRadioButton("Create output file in same folder as input.", otid).apply {
         alignmentX = LEFT_ALIGNMENT
     }
@@ -57,6 +72,9 @@
     /* output to some other directory */
     private val outputToButton = JRadioButton("Create output file in:", !otid).apply {
         alignmentX = LEFT_ALIGNMENT
+        addChangeListener(ChangeListener {
+            changeOutputTo.setEnabled(isSelected())
+        })
     }
     
     /* name of the other directory */
@@ -76,19 +94,6 @@
         return _outputTo.selectedFile?.getCanonicalPath() ?: oto
     }
     
-    /* button to change that other directory */
-    protected val changeOutputTo = JButton("Change").also {
-        it.noTaller()
-        it.addActionListener(ActionListener {
-            val status = _outputTo.showOpenDialog(this)
-            if (status == JFileChooser.APPROVE_OPTION) {
-                val path = outputTo
-                outputToText.text = path
-            }
-        })
-        it.setEnabled(!otid)
-    }
-    
     /* radio button group */
     protected val buttonGroup = ButtonGroup().apply {
         add(outputToButton)