changeset 57:c6cccbe2f393

Port to OpenJDK 15 (mostly done).
author David Barts <n5jrn@me.com>
date Wed, 23 Mar 2022 23:56:29 -0700
parents 22725d4d7849
children 88056f373a94
files build.xml src/name/blackcap/clipman/Menus.kt src/name/blackcap/clipman/Osdep.kt src/name/blackcap/clipman/Osdep.kt.default.osdep src/name/blackcap/clipman/Osdep.kt.mac.osdep
diffstat 5 files changed, 28 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/build.xml	Sat Mar 19 23:04:40 2022 -0700
+++ b/build.xml	Wed Mar 23 23:56:29 2022 -0700
@@ -23,24 +23,14 @@
            classpath="${kotlin.lib}/kotlin-ant.jar"/>
 
   <!-- define the package-building tasks -->
-  <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
+  <!-- <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
            uri="javafx:com.sun.javafx.tools.ant"
-           classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/>
-
-  <!-- cribbed from https://stackoverflow.com/questions/7129672/uppercase-lowercase-capitalize-an-ant-property -->
-  <scriptdef language="javascript" name="toLowerCase">
-    <attribute name="value" />
-    <attribute name="target" />
-    <![CDATA[
-      project.setProperty( attributes.get( "target" ),
-                           attributes.get( "value" ).toLowerCase() );
-    ]]>
-  </scriptdef>
+           classpath="${env.JRE_HOME}/lib/ant-javafx.jar"/> -->
 
   <!-- Define the properties used by the build -->
   <property name="app.name"      value="${ant.project.name}"/>
   <property name="app.entry"     value="name.blackcap.clipman.MainKt"/>
-  <toLowerCase target="lc.app.name" value="${app.name}"/>
+  <property name="lc.app.name"   value="clipman"/>
   <property name="jar.name"      value="${basedir}/${lc.app.name}.jar"/>
   <property name="work.jar"      value="${basedir}/work.jar"/>
   <property name="lib.home"      value="${basedir}/lib"/>
@@ -86,6 +76,7 @@
   <target name="compile" depends="classpath"
           description="Compile Java sources to ${work.home}">
     <kotlinc src="${src.home}" output="${work.jar}"
+             noStdlib="false" includeRuntime="true"
              classpathref="compile.classpath">
       <compilerarg line="-jvm-target 1.8"/>
     </kotlinc>
--- a/src/name/blackcap/clipman/Menus.kt	Sat Mar 19 23:04:40 2022 -0700
+++ b/src/name/blackcap/clipman/Menus.kt	Wed Mar 23 23:56:29 2022 -0700
@@ -151,6 +151,10 @@
             actionCommand = "Edit.Clone"
             addActionListener(Application.menuItemListener)
         }))
+        add(Application.styledRequired.add(JMenuItem("Convert to Troff").apply {
+            actionCommand = "Edit.Troff"
+            addActionListener(Application.menuItemListener)
+        }))
         add(Application.styledRequired.add(JMenuItem("Coerce…").apply {
             actionCommand = "Edit.Coerce"
             addActionListener(Application.menuItemListener)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/name/blackcap/clipman/Osdep.kt	Wed Mar 23 23:56:29 2022 -0700
@@ -0,0 +1,20 @@
+/*
+ * OS-dependent code, Mac version.
+ */
+package name.blackcap.clipman
+
+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/clipman/Osdep.kt.default.osdep	Sat Mar 19 23:04:40 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.clipman
-
-fun setMacMenus() {
-    /* no-op */
-}
--- a/src/name/blackcap/clipman/Osdep.kt.mac.osdep	Sat Mar 19 23:04:40 2022 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * OS-dependent code, Mac version.
- */
-package name.blackcap.clipman
-
-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)
-    }
-}