﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1589	[PATCH] A Halfway Decent OS X Integration	Henry Loenwind	framm	"In response to #1471, I wondered how hard it would be to integrate JOSM better with OS X. That was a couple of hours ago, and now I know that it wouldn't be, ummm, WAS not hard. :-)


Here is the patch. All changes will only activate when JOSM is running under OS X and the communication with the native GUI classes succeeded:

(1) Application title will no longer read ""org.openstreetmap.josm.gui.MainApplication"" but ""JOSM""

(2) Closing JOSM using the OS's methods (red button on window, menu option and keyboard shortcut) will trigger the ""Unsaved changes"" dialog.

(3) Selecting ""About"" in the system menu will display JOSM's about dialog.

(4) Selecting ""Preferences"" in the system menu will display JOSM's preferences dialog.

(5) Duplicate menu options for Quit, About and Preferences will be suppressed. (This will also remove their keyboard shortcuts, but as Ctrl-Q would have been mapped to Cmd-Q, and Cmd-Q is the OS's default, and F12 is invalid on most Macs, that is no issue.)

(6) JOSM's menu bar will be merged with the system menu bar. (So there will be one, not two menu bars for JOSM.)

(7) All keyboard shortcuts involving Ctrl will be changed to Cmd. Shortcuts using META will be mapped to Ctrl, so there won't be any conflicts. Note: This only works for shortcuts registered via the JosmAction constructor.


Included files:

AboutAction.diff - added a note to the about dialog announcing the successful integration

build.diff - changed main class to JOSM (see next item)

JOSM.java - empty subclass of MainApplication, so OS X will see a ""fake"" main class---it takes that name as an application title

JosmAction.diff - map Ctrl to Cmd

Main.diff - register the Quit, About and Preferences callbacks; new static property to report on working integration

MainApplication.diff - allow subclassing for JOSM.java; Request merging of the menu bars (must be called early)

MainMenu.diff - skip Quit, About and Preferences on OS X


Note again, that all changes are protected with an ""if(withOSXIntegration)"", and that is only set when OS X is detected AND the communication with the OS worked. All communication is protected with try{} blocks. So no ill effects are to be expected on other platforms."	enhancement	closed	minor		Core	latest	wontfix		
