Mercurial > cgi-bin > hgweb.cgi > ImagePrep
changeset 30:098c4f5507c7
Convert to JDK 15.
author | David Barts <n5jrn@me.com> |
---|---|
date | Mon, 13 Jun 2022 11:31:49 -0700 |
parents | e90d290a9a8d |
children | 99a0eb385c9a |
files | setup.sh src/name/blackcap/imageprep/Files.kt src/name/blackcap/imageprep/Main.kt src/name/blackcap/imageprep/Menus.kt src/name/blackcap/imageprep/Osdep.kt src/name/blackcap/imageprep/Osdep.kt.default.osdep src/name/blackcap/imageprep/Osdep.kt.mac.osdep src/name/blackcap/imageprep/SettingsDialog.kt |
diffstat | 8 files changed, 28 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.sh Mon Jun 13 09:21:24 2022 -0700 +++ b/setup.sh Mon Jun 13 11:31:49 2022 -0700 @@ -1,6 +1,6 @@ #!/bin/bash -export JRE_HOME="/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home" +export JRE_HOME="/Library/Java/JavaVirtualMachines/zulu-15.jdk/Contents/Home" export JAVA_HOME="$JRE_HOME" export KOTLIN_HOME="$HOME/kotlin/1.6.10/kotlinc" export EXIV2_HOME="$HOME/temp/exiv2/exiv2-0.27.2-Source"
--- a/src/name/blackcap/imageprep/Files.kt Mon Jun 13 09:21:24 2022 -0700 +++ b/src/name/blackcap/imageprep/Files.kt Mon Jun 13 11:31:49 2022 -0700 @@ -19,7 +19,7 @@ enum class OS { MAC, UNIX, WINDOWS, OTHER; companion object { - private val rawType = System.getProperty("os.name")?.toLowerCase() + private val rawType = System.getProperty("os.name")?.lowercase() val type = if (rawType == null) { OTHER } else if (rawType.contains("win")) { @@ -40,7 +40,7 @@ /* file names */ -private val SHORTNAME = Application.MYNAME.toLowerCase() +private val SHORTNAME = Application.MYNAME.lowercase() private val LONGNAME = "name.blackcap." + SHORTNAME private val HOME = System.getenv("HOME") val PF_DIR = when (OS.type) {
--- a/src/name/blackcap/imageprep/Main.kt Mon Jun 13 09:21:24 2022 -0700 +++ b/src/name/blackcap/imageprep/Main.kt Mon Jun 13 11:31:49 2022 -0700 @@ -33,6 +33,7 @@ LOGGER.log(Level.INFO, "beginning execution") if (OS.type == OS.MAC) { System.setProperty("apple.laf.useScreenMenuBar", "true") + System.setProperty("apple.awt.application.name", Application.MYNAME) } /* launch GUI */
--- a/src/name/blackcap/imageprep/Menus.kt Mon Jun 13 09:21:24 2022 -0700 +++ b/src/name/blackcap/imageprep/Menus.kt Mon Jun 13 11:31:49 2022 -0700 @@ -99,7 +99,7 @@ } if (chooser.showOpenDialog(Application.mainFrame) == JFileChooser.APPROVE_OPTION) { currentInputDirectory = chooser.selectedFile.canonicalFile.parentFile - RotateDialog.makeDialog(chooser.selectedFile, maxDim.value as Int) + RotateDialog.makeDialog(chooser.selectedFile, maxDim.value) } } @@ -144,7 +144,7 @@ } currentOutputDirectory = chooser.selectedFile.canonicalFile.parentFile val (name, ext) = splitext(chooser.selectedFile.name) - val file = if (ext.toLowerCase() in setOf(".jpg", ".jpeg")) { + val file = if (ext.lowercase() in setOf(".jpg", ".jpeg")) { chooser.selectedFile } else { File(currentOutputDirectory, name + ".jpg")
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/name/blackcap/imageprep/Osdep.kt Mon Jun 13 11:31:49 2022 -0700 @@ -0,0 +1,20 @@ +/* + * OS-dependent code, Mac version. + */ +package name.blackcap.imageprep + +import java.awt.Desktop +import java.awt.desktop.AboutHandler +import java.awt.desktop.PreferencesHandler +import java.awt.desktop.QuitStrategy + +fun setMacMenus() { + if (OS.type == OS.MAC) { + Desktop.getDesktop().run { + setAboutHandler(AboutHandler({ showAboutDialog() })) + setPreferencesHandler( + PreferencesHandler({ Application.settingsDialog.setVisible(true) })) + setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS) + } + } +}
--- a/src/name/blackcap/imageprep/Osdep.kt.default.osdep Mon Jun 13 09:21:24 2022 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -/* - * OS-dependent code, version for all non-Mac systems. - */ -package name.blackcap.imageprep - -fun setMacMenus() { - /* no-op */ -}
--- a/src/name/blackcap/imageprep/Osdep.kt.mac.osdep Mon Jun 13 09:21:24 2022 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -/* - * OS-dependent code, Mac version. - */ -package name.blackcap.imageprep - -import com.apple.eawt.AboutHandler -import com.apple.eawt.PreferencesHandler -import com.apple.eawt.QuitStrategy - -fun setMacMenus() { - com.apple.eawt.Application.getApplication().run { - setAboutHandler(AboutHandler { showAboutDialog() }) - setPreferencesHandler( - PreferencesHandler { Application.settingsDialog.setVisible(true) }) - setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS) - } -}
--- a/src/name/blackcap/imageprep/SettingsDialog.kt Mon Jun 13 09:21:24 2022 -0700 +++ b/src/name/blackcap/imageprep/SettingsDialog.kt Mon Jun 13 11:31:49 2022 -0700 @@ -27,7 +27,7 @@ private val _maxDimension = MaxDimSpinner(_PROPS.getInt("maxDimension")) val maxDimension: Int get() { - return _maxDimension.value as Int + return _maxDimension.value } /* JPEG output quality */ @@ -227,7 +227,7 @@ val raw = getProperty(key) if (raw.isNullOrEmpty()) return false - val c1 = raw[0].toLowerCase() + val c1 = raw[0].lowercaseChar() return c1 == 't' || c1 == 'y' }