From: hansonr Date: Mon, 21 Jan 2019 18:46:50 +0000 (-0600) Subject: added Platform settings separating mouse use of win/mac difference X-Git-Tag: Release_2_11_4_0~45^2~18^2~302 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3c649fa5f3632a9e7a47a533ce0c11cc67622788;p=jalview.git added Platform settings separating mouse use of win/mac difference --- diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 2b056fc..15d5713 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -236,7 +236,7 @@ public class GAlignFrame extends JInternalFrame System.err.println(e.toString()); } - if (Platform.isWin()) // was "not mac and not JS" + if (Platform.allowMnemonics()) // was "not mac and not JS" { closeMenuItem.setMnemonic('C'); outputTextboxMenu.setMnemonic('T'); diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index bbde757..b301f6e 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -143,11 +143,13 @@ public class GDesktop extends JFrame e.printStackTrace(); } - if (Platform.isWin()) //!Platform.isAMacAndNotJS()) + if (Platform.allowMnemonics()) { + //BH was !Platform.isAMacAndNotJS()) i.e. "JS or not Mac" + // but here we want just not a Mac, period, right? FileMenu.setMnemonic('F'); inputLocalFileMenuItem.setMnemonic('L'); - VamsasMenu.setMnemonic('V'); + VamsasMenu.setMnemonic('V'); inputURLMenuItem.setMnemonic('U'); inputTextboxMenuItem.setMnemonic('C'); quit.setMnemonic('Q'); diff --git a/src/jalview/util/Platform.java b/src/jalview/util/Platform.java index f34849e..0d7724b 100644 --- a/src/jalview/util/Platform.java +++ b/src/jalview/util/Platform.java @@ -21,7 +21,6 @@ package jalview.util; import java.awt.Toolkit; -import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import javax.swing.SwingUtilities; @@ -34,15 +33,18 @@ import javax.swing.SwingUtilities; public class Platform { - private static Boolean isNoJSMac = null, isNoJSWin = null, isMac = null, isWin = null; + private static boolean isJS = /** @j2sNative true || */false; + private static Boolean isNoJSMac = null, isNoJSWin = null, + isMac = null, isWin = null; + private static Boolean isHeadless = null; /** * added to group mouse events into Windows and nonWindows (mac, unix, linux) * @return */ - public static boolean isMac() + public static boolean isMac() { return (isMac == null ? (isMac = (System.getProperty("os.name").indexOf("Mac") >= 0)) : isMac); } @@ -57,6 +59,15 @@ public class Platform } /** + * + * @return true if HTML5 JavaScript + */ + public static boolean isJS() + { + return isJS; + } + + /** * sorry folks - Macs really are different * * BH: disabled for SwingJS -- will need to check key-press issues @@ -65,7 +76,7 @@ public class Platform */ public static boolean isAMacAndNotJS() { - return (isNoJSMac == null ? (isNoJSMac = /** @j2sNative false && */isMac()) : isNoJSMac); + return (isNoJSMac == null ? (isNoJSMac = !isJS && isMac()) : isNoJSMac); } /** @@ -75,7 +86,7 @@ public class Platform */ public static boolean isWindowsAndNotJS() { - return (isNoJSWin == null ? (isNoJSWin = /** @j2sNative false && */isWin()) : isNoJSWin); + return (isNoJSWin == null ? (isNoJSWin = !isJS && isWin()) : isNoJSWin); } /** @@ -182,4 +193,9 @@ public class Platform // was !isAMac(), but that is true also for Linux and Unix and JS return isWin() && SwingUtilities.isMiddleMouseButton(e); } + + public static boolean allowMnemonics() + { + return !isMac(); + } }