annotate src/name/blackcap/imageprep/Main.kt @ 19:5fa5d15b4a7b

Attempt to make it a std. app. Builds, sorta runs, needs more work.
author David Barts <n5jrn@me.com>
date Fri, 20 Nov 2020 21:38:06 -0800
parents 884f1415a330
children 92afaa27f40a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
1 /*
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
2 * Entry point, etc.
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
3 */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
4 package name.blackcap.imageprep
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
5
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
6 import java.io.File
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
7 import java.util.logging.Level
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
8 import java.util.logging.Logger
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
9 import javax.swing.UIManager
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
10 import name.blackcap.kcli.CommandLine
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
11 import name.blackcap.kcli.InvalidArgumentException
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
12 import name.blackcap.kcli.Option
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
13 import name.blackcap.kcli.PromptingParser
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
14 import org.apache.commons.cli.HelpFormatter
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
15 import org.apache.commons.cli.Options
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
16 import org.apache.commons.cli.ParseException
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
17
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
18 object Application {
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
19 /* name we call ourselves */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
20 val MYNAME = "ImagePrep"
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
21
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
22 /* global UI objects */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
23 var mainFrame: MainFrame by setOnce()
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
24 var helpDialog: HelpDialog by setOnce()
19
5fa5d15b4a7b Attempt to make it a std. app. Builds, sorta runs, needs more work.
David Barts <n5jrn@me.com>
parents: 5
diff changeset
25 var settingsDialog: SettingsDialog by setOnce()
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
26
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
27 fun initialize() {
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
28 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
29 mainFrame = MainFrame() /* must be created first */
19
5fa5d15b4a7b Attempt to make it a std. app. Builds, sorta runs, needs more work.
David Barts <n5jrn@me.com>
parents: 5
diff changeset
30 settingsDialog = SettingsDialog()
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
31 mainFrame.jMenuBar = MyMenuBar()
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
32 setMacMenus() /* always safe to call; no-op if not a Mac */
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
33 helpDialog = HelpDialog()
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
34 mainFrame.setVisible(true)
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
35 }
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
36 }
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
37
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
38 fun main(args: Array<String>) {
5
884f1415a330 Rationalized directory management.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
39 /* start up */
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
40 LOGGER.log(Level.INFO, "beginning execution")
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
41 if (OS.type == OS.MAC) {
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
42 System.setProperty("apple.laf.useScreenMenuBar", "true")
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
43 }
4
5234e4500d45 Command-line arguments (only partially tested).
David Barts <n5jrn@me.com>
parents: 0
diff changeset
44
5
884f1415a330 Rationalized directory management.
David Barts <n5jrn@me.com>
parents: 4
diff changeset
45 /* launch GUI */
0
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
46 inSwingThread {
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
47 Application.initialize()
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
48 }
e0efe7848130 Initial commit. Untested!
David Barts <davidb@stashtea.com>
parents:
diff changeset
49 }