Changed shortcut labels in menus to always show uppercase letters jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 09 Feb 2017 12:30:03 +0000
branchjv
changeset 7970 43c6888f5f92
parent 7969 2bac4f32553f
child 7972 fa17f9363939
Changed shortcut labels in menus to always show uppercase letters with optional "Shift" modifier if Shift is required. For example, shortcut label for copy is "Ctrl + C" (rather than "Ctrl+c" as before), for implementors is "Ctrl + Shift + I" (rather than "Ctrl+I"). This is in line with user interface guidelines for all modern platforms, see: * Guidelines for Keyboard User Interface Design [1] (Windows) * Keyboard input [2] (GNOME) * Keyboard Shortcuts [3] (macOS) [1]: https://msdn.microsoft.com/en-us/library/ms971323.aspx [2]: https://developer.gnome.org/hig/stable/keyboard-input.html.en [3]: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/OSXHIGuidelines/Keyboard.html
DeviceWorkstation.st
--- a/DeviceWorkstation.st	Wed Feb 08 23:58:18 2017 +0000
+++ b/DeviceWorkstation.st	Thu Feb 09 12:30:03 2017 +0000
@@ -2918,9 +2918,10 @@
      and the actual character. I.e. makes a Ctrl+A"
 
     "/ used to be '-'
-    ^ '+'
+    ^ ' + '
 
     "Created: / 21-07-2011 / 16:04:22 / cg"
+    "Modified: / 09-02-2017 / 11:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 shortKeyStringFor:symbolicOrRawKey
@@ -3010,17 +3011,26 @@
         rest := (untranslatedKey copyFrom:(prefix size + 1)).
         rest isEmpty ifTrue:[^ modifier ].
         modifier := modifier , (self shortKeyPrefixSeparator).
+        rest size == 1 ifTrue:[ 
+            rest first isUppercase ifTrue:[ 
+                ^ modifier , (self modifierKeyTopFor:#Shift) , self shortKeyPrefixSeparator , rest
+            ] ifFalse:[ 
+                ^ modifier , rest first asUppercase
+            ].
+        ].
         ^ modifier , rest
     ].
     ^ untranslatedKey
 
     "
-    Screen current shortKeyStringFor: #Find
-    Screen current shortKeyStringFor: #CtrlX
-    Screen current shortKeyStringFor: #CursorLeft
+    Screen current shortKeyStringFor: #CmdBackSpace usingMap: Screen current keyboardMap
+    Screen current shortKeyStringFor: #Find usingMap: Screen current keyboardMap
+    Screen current shortKeyStringFor: #CtrlX usingMap: Screen current keyboardMap
+    Screen current shortKeyStringFor: #CursorLeft usingMap: Screen current keyboardMap
     "
 
     "Created: / 08-02-2017 / 23:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-02-2017 / 12:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !DeviceWorkstation methodsFor:'accessing-misc'!
@@ -6900,31 +6910,32 @@
     |t modifiers|
 
     key == #Alt ifTrue:[
-	modifiers := altModifiers
+        modifiers := altModifiers
     ] ifFalse:[
-	key == #Cmd ifTrue:[
-	    modifiers := metaModifiers
-	]
+        key == #Cmd ifTrue:[
+            modifiers := metaModifiers
+        ]
     ].
 
     "/ temporary kludge ...
     (modifiers size > 0) ifTrue:[
-	(modifiers includes:'Num_Lock') ifTrue:[
-	    modifiers := modifiers copyWithout:'Num_Lock'
-	]
+        (modifiers includes:'Num_Lock') ifTrue:[
+            modifiers := modifiers copyWithout:'Num_Lock'
+        ]
     ].
 
     (modifiers size > 0) ifTrue:[
-	t := modifiers first.
-	(t includes:$_) ifTrue:[
-	    t := t copyTo:(t indexOf:$_)-1
-	].
-	^ t
+        t := modifiers first.
+        (t includes:$_) ifTrue:[
+            t := t copyTo:(t indexOf:$_)-1
+        ].
+        ^ t
     ].
     ^ key
 
-    "Created: / 28.2.1996 / 17:07:08 / cg"
-    "Modified: / 7.2.1998 / 16:18:17 / cg"
+    "Created: / 28-02-1996 / 17:07:08 / cg"
+    "Modified: / 07-02-1998 / 16:18:17 / cg"
+    "Modified: / 09-02-2017 / 11:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 modifierKeyTranslationFor:untranslatedKey