diff src/name/blackcap/clipman/CoerceDialog.kt @ 47:19d9da731c43

Recoded; cleaned up root namespace, removed race conditions.
author David Barts <n5jrn@me.com>
date Sun, 12 Apr 2020 14:31:06 -0700
parents 339e2da5bf83
children 22725d4d7849
line wrap: on
line diff
--- a/src/name/blackcap/clipman/CoerceDialog.kt	Mon Feb 10 16:40:09 2020 -0700
+++ b/src/name/blackcap/clipman/CoerceDialog.kt	Sun Apr 12 14:31:06 2020 -0700
@@ -17,7 +17,7 @@
 import javax.swing.event.DocumentEvent
 import javax.swing.event.DocumentListener
 
-class CoerceDialog: JDialog(frame.v), ActionListener {
+class CoerceDialog: JDialog(Application.frame), ActionListener {
     private val FONTS =
         GraphicsEnvironment.getLocalGraphicsEnvironment().availableFontFamilyNames.copyOf().apply {
             sort()
@@ -161,9 +161,9 @@
     }
 
     private fun coerce() {
-        val selected = queue.v.getSelected()
+        val selected = Application.queue.getSelected()
         if (selected == null) {
-            JOptionPane.showMessageDialog(frame.v,
+            JOptionPane.showMessageDialog(Application.frame,
                 "No item selected.",
                 "Error",
                 JOptionPane.ERROR_MESSAGE)
@@ -177,7 +177,7 @@
                     Pair(selected.contents.plain, selected.contents.html)
             }
             if (html == null) {
-                JOptionPane.showMessageDialog(frame.v,
+                JOptionPane.showMessageDialog(Application.frame,
                     "Only styled texts may be coerced.",
                     "Error",
                     JOptionPane.ERROR_MESSAGE)
@@ -197,7 +197,7 @@
     private fun badSize(control: JComboBox<Float>, default: Int, fontType: String): Boolean {
         val size = control.selectedItem as? Float
         if (size == null || size < 1.0f) {
-            JOptionPane.showMessageDialog(frame.v,
+            JOptionPane.showMessageDialog(Application.frame,
                 "Invalid ${fontType} font size.",
                 "Error",
                 JOptionPane.ERROR_MESSAGE)
@@ -226,5 +226,3 @@
         }
     }
 }
-
-val coerceDialog = CoerceDialog()