changeset 25:a495f9ea498b mac-open

Initial attempts to make it respond to MacOS open message (not working).
author David Barts <n5jrn@me.com>
date Sun, 13 Dec 2020 10:29:08 -0800
parents a4737a525af8
children
files package-files/osx/Info.plist src/name/blackcap/imageprep/Osdep.kt.mac.osdep
diffstat 2 files changed, 38 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/package-files/osx/Info.plist	Wed Nov 25 08:40:45 2020 -0800
+++ b/package-files/osx/Info.plist	Sun Dec 13 10:29:08 2020 -0800
@@ -7,6 +7,34 @@
     <string>English</string>
     <key>CFBundleDisplayName</key>
     <string>@app.name@</string>
+    <key>CFBundleDocumentTypes</key>
+    <array>
+      <dict>
+        <key>CFBundleTypeName</key>
+        <string>@app.name@ Document</string>
+        <key>CFBundleTypeRole</key>
+        <string>Editor</string>
+        <key>LSItemContentTypes</key>
+        <array>
+          <string>com.compuserve.gif</string>
+          <string>com.microsoft.bmp</string>
+          <string>public.jpeg</string>
+          <string>public.png</string>
+        </array>
+        <key>CFBundleTypeExtensions</key>
+        <array>
+          <string>*</string>
+        </array>
+        <key>CFBundleTypeOSTypes</key>
+        <array>
+          <string>GIFf</string>
+          <string>BMPf</string>
+          <string>JPEG</string>
+          <string>PNGf</string>
+          <string>****</string>
+        </array>
+      </dict>
+    </array>
     <key>CFBundleExecutable</key>
     <string>JavaApplicationStub</string>
     <key>CFBundleIconFile</key>
--- a/src/name/blackcap/imageprep/Osdep.kt.mac.osdep	Wed Nov 25 08:40:45 2020 -0800
+++ b/src/name/blackcap/imageprep/Osdep.kt.mac.osdep	Sun Dec 13 10:29:08 2020 -0800
@@ -4,12 +4,22 @@
 package name.blackcap.imageprep
 
 import com.apple.eawt.AboutHandler
+import com.apple.eawt.OpenFilesHandler
 import com.apple.eawt.PreferencesHandler
 import com.apple.eawt.QuitStrategy
+import java.util.logging.Level
+import java.util.logging.Logger
 
 fun setMacMenus() {
     com.apple.eawt.Application.getApplication().run {
         setAboutHandler(AboutHandler { showAboutDialog() })
+        setOpenFileHandler(OpenFilesHandler {
+            LOGGER.log(Level.INFO, "got open request")
+            for (file in it.files) {
+                LOGGER.log(Level.INFO, "opening: ${file.toString()}")
+                RotateDialog.makeDialog(file, Application.settingsDialog.maxDimension)
+            }
+        })
         setPreferencesHandler(
             PreferencesHandler { Application.settingsDialog.setVisible(true) })
         setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS)