comparison src/name/blackcap/imageprep/Osdep.kt.mac.osdep @ 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 5fa5d15b4a7b
children
comparison
equal deleted inserted replaced
24:a4737a525af8 25:a495f9ea498b
2 * OS-dependent code, Mac version. 2 * OS-dependent code, Mac version.
3 */ 3 */
4 package name.blackcap.imageprep 4 package name.blackcap.imageprep
5 5
6 import com.apple.eawt.AboutHandler 6 import com.apple.eawt.AboutHandler
7 import com.apple.eawt.OpenFilesHandler
7 import com.apple.eawt.PreferencesHandler 8 import com.apple.eawt.PreferencesHandler
8 import com.apple.eawt.QuitStrategy 9 import com.apple.eawt.QuitStrategy
10 import java.util.logging.Level
11 import java.util.logging.Logger
9 12
10 fun setMacMenus() { 13 fun setMacMenus() {
11 com.apple.eawt.Application.getApplication().run { 14 com.apple.eawt.Application.getApplication().run {
12 setAboutHandler(AboutHandler { showAboutDialog() }) 15 setAboutHandler(AboutHandler { showAboutDialog() })
16 setOpenFileHandler(OpenFilesHandler {
17 LOGGER.log(Level.INFO, "got open request")
18 for (file in it.files) {
19 LOGGER.log(Level.INFO, "opening: ${file.toString()}")
20 RotateDialog.makeDialog(file, Application.settingsDialog.maxDimension)
21 }
22 })
13 setPreferencesHandler( 23 setPreferencesHandler(
14 PreferencesHandler { Application.settingsDialog.setVisible(true) }) 24 PreferencesHandler { Application.settingsDialog.setVisible(true) })
15 setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS) 25 setQuitStrategy(QuitStrategy.CLOSE_ALL_WINDOWS)
16 } 26 }
17 } 27 }