annotate src/name/blackcap/exifwasher/Main.kt @ 50:fb407182ba76

Add help menu item, UNTESTED.
author David Barts <davidb@stashtea.com>
date Thu, 07 May 2020 08:29:58 -0700
parents ee580450d45a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
1 /*
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
2 * Entry point, etc.
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
3 */
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
4 package name.blackcap.exifwasher
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
5
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
6 import javax.swing.UIManager
5
dc1f4359659d Got it compiling.
David Barts <n5jrn@me.com>
parents: 3
diff changeset
7 import java.util.logging.Level
dc1f4359659d Got it compiling.
David Barts <n5jrn@me.com>
parents: 3
diff changeset
8 import java.util.logging.Logger
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
9
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
10 object Application {
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
11 /* name we call ourselves */
27
ee580450d45a More of the Great Renaming.
davidb
parents: 20
diff changeset
12 val MYNAME = "JpegWasher"
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
13
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
14 /* global UI objects */
20
965435b85a69 Get rid of some stuttering.
David Barts <n5jrn@me.com>
parents: 6
diff changeset
15 var mainFrame: MainFrame by setOnce()
965435b85a69 Get rid of some stuttering.
David Barts <n5jrn@me.com>
parents: 6
diff changeset
16 var settingsDialog: SettingsDialog by setOnce()
50
fb407182ba76 Add help menu item, UNTESTED.
David Barts <davidb@stashtea.com>
parents: 27
diff changeset
17 var helpDialog: HelpDialog by setOnce()
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
18
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
19 fun initialize() {
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
20 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
21 mainFrame = MainFrame() /* must be created first */
6
aafc9c127c7b Fix many bugs; get settings (apparently) working.
David Barts <n5jrn@me.com>
parents: 5
diff changeset
22 mainFrame.jMenuBar = MyMenuBar()
aafc9c127c7b Fix many bugs; get settings (apparently) working.
David Barts <n5jrn@me.com>
parents: 5
diff changeset
23 setMacMenus() /* always safe to call; no-op if not a Mac */
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
24 settingsDialog = SettingsDialog()
50
fb407182ba76 Add help menu item, UNTESTED.
David Barts <davidb@stashtea.com>
parents: 27
diff changeset
25 helpDialog = HelpDialog()
3
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
26 mainFrame.setVisible(true)
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
27 }
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
28 }
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
29
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
30 fun main(args: Array<String>) {
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
31 LOGGER.log(Level.INFO, "beginning execution")
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
32 if (OS.type == OS.MAC) {
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
33 System.setProperty("apple.laf.useScreenMenuBar", "true")
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
34 }
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
35 inSwingThread {
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
36 Application.initialize()
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
37 }
19c381c536ec Code to make it a proper Mac GUI app. Untested!
David Barts <n5jrn@me.com>
parents:
diff changeset
38 }