diff src/name/blackcap/exifwasher/Main.kt @ 3:19c381c536ec

Code to make it a proper Mac GUI app. Untested!
author David Barts <n5jrn@me.com>
date Wed, 08 Apr 2020 20:29:12 -0700
parents
children dc1f4359659d
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/exifwasher/Main.kt	Wed Apr 08 20:29:12 2020 -0700
@@ -0,0 +1,32 @@
+/*
+ * Entry point, etc.
+ */
+package name.blackcap.exifwasher
+
+import javax.swing.UIManager
+
+object Application {
+    /* name we call ourselves */
+    val MYNAME = "ExifWasher"
+
+    /* global UI objects */
+    var mainFrame: MainFrame by SetOnce<MainFrame>()
+    var settingsDialog: SettingsDialog by SetOnce<SettingsDialog>()
+
+    fun initialize() {
+        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+        mainFrame = MainFrame() /* must be created first */
+        settingsDialog = SettingsDialog()
+        mainFrame.setVisible(true)
+    }
+}
+
+fun main(args: Array<String>) {
+    LOGGER.log(Level.INFO, "beginning execution")
+    if (OS.type == OS.MAC) {
+        System.setProperty("apple.laf.useScreenMenuBar", "true")
+    }
+    inSwingThread {
+        Application.initialize()
+    }
+}