[[BackLinksMenu]]

[[TicketQuery(summary=PLATFORM_DEPLOY_MAC_R0, format=table, col=summary|owner|status|type|component|priority|effort|importance, rows=description|analysis_owners|analysis_reviewers|analysis_score|design_owners|design_reviewers|design_score|implementation_owners|implementation_reviewers|implementation_score|test_owners|test_reviewers|test_score|)]]

= Analysis =
^(Give as much as possible of the needed information for designing and implementing the task in the following sections.)^

== Overview ==
There are some platform specific problems related to Mac OS X, that we must take care of.

== Task requirements ==
 * The keyboard shortcuts that are used on Windows and Linux vary on Mac OS X
  * Instead of Ctrl we must use for modifier key Command
  * The Mac option key is acting like an alt key, so it opens the menus - this should be disabled, because the option key is needed to type special characters.
 * Optional - Another issue when starting Sophie seems to start two separate applications, one which runs in the background; when you add a browser frame, another application starts running for webkit, only one app should seem to be running (no matter how many processes it uses).
 * On Mac OS X, we must use mac styled menus (at the top of the screen, not at the top of the app window).
 * Optional - Cursors for changing Sophie layout must change appropriately. Now there is no visual indication for resizing palettes. (Optional may be fixed separately as a bug)
== Task result ==
The result of this task must be source code and instructions for making Mac packages.
== Implementation idea ==
 * Make the IUManager use Mac's AquaLookAndFeel for he menu bar and use "-Dapple.laf.useScreenMenuBar=true" jvm option
 * Don't add mnemonics to menus if we're on mac
 * Use Meta key instead of Control key as modifier on mac
 * Try some option in info.plist file and try to use similar settings when spawning our processes 
 * Stop BrowserNativeBridges on application exit

== Related ==
 * GROUP_DEPLOYMENT_R2
 * GROUP_DEPLOYMENT_R1
 * GROUP_DEPLOYMENT_R0

== How to demo ==
 * Run Sophie2 on Mac OS
 * Show the placement of the menus
 * Use some keyboard shortcuts including Command and Option keys
 * Test also on Windows and Linux to see the interface is ok there.

= Design =
 * In order to ease OS checking add a class OSUtil in org.sophie2.bse.commons.util that has methods for checking if the current os is of some type.
 * In order to use Mac style menus in the SkinManager#lookAndFeel property do the following
  * If we have a LaF defined in the skin after setting it if running on Mac set the "MenuBarUI" property of the UIManager to be "com.apple.laf.AquaMenuBarUI"
  * If we have no LaF defined use the system one instead of the cross-platform one.
  * Besides that add the following VM argument to launch configurations and sophie cripts for Mac OS ; "-Dapple.laf.useScreenMenuBar=true"
 * In order to use the Mac option(alt) key in its natural Mac OS behavior in the methods setting mnemonics in Menu and MenuItem class add a check if we're not running on Mac OS.
 * In order to use Mac command key instead of control as a shortcut
  * If the above is desired we should use "Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();" method 
  * Otherwise we use fixed masks.
  * In the OSUtil class add a method that is a shorthand for the mentioned Toolkit method.
  * These are used for menus
  * In InputEventR3 dependent cases use if/else constructs to define the proper key (especially in interaction maps)
  * In TextFlowLogic#ON_INSERT besides the M_CONTROL check add a M_META check
  * Change text editing shortcuts to match MacOS defaults (use TextEdit to compare)

 * Optional requirements cannot be fulfilled now as they seem harder and more native-dependent in their solution. I suggest making a second revision of this task that should handle them alone.
  * The research made about the browser problem suggest using either some environment options (LSUIPresentationMode) or maybe some mac specific classes that control that behavior.
 
 * Design and partly implementation code in http://sophie2.org/trac/log/branches/private/pap/platform-deploy-mac?rev=7972

= Implementation =
 *  Code in 
  * Trac -  http://sophie2.org/trac/log/branches/private/pap/platform-deploy-mac
  * SVN - svn://sophie2.org/sophie2/branches/private/pap/platform-deploy-mac
 * PageUp/PageDown may still be problematic. 

 Merged to the trunk at [7974]

= Testing =
^(Place the testing results here.)^

= Comments =
^(Write comments for this or later revisions here.)