added: #shortKeyPrefixSeparator
authorClaus Gittinger <cg@exept.de>
Thu, 21 Jul 2011 16:04:47 +0200
changeset 5778 9416217f347a
parent 5777 8a5b6ccd5476
child 5779 def9764b9b8a
added: #shortKeyPrefixSeparator changed: #shortKeyStringFor:
DeviceWorkstation.st
--- a/DeviceWorkstation.st	Wed Jul 20 17:10:11 2011 +0200
+++ b/DeviceWorkstation.st	Thu Jul 21 16:04:47 2011 +0200
@@ -2711,6 +2711,16 @@
     keyboardMap := aMap
 !
 
+shortKeyPrefixSeparator
+    "the saparator shown between the shortcut modified (CTRL, CMD etc.)
+     and the actual character. I.e. makes a Ctrl+A"
+
+    "/ used to be '-'
+    ^ '+'
+
+    "Created: / 21-07-2011 / 16:04:22 / cg"
+!
+
 shortKeyStringFor:aSymbolicKey
     |untranslatedKeys untranslatedKey prefix|
 
@@ -2721,54 +2731,54 @@
     untranslatedKeys := OrderedCollection new.
     self keyboardMap keysAndValuesDo:[:k :v | v == aSymbolicKey ifTrue:[untranslatedKeys add:k]].
     untranslatedKeys size == 0 ifTrue:[
-	"/ if its not an explicit command key (Ctrl-*, Alt-* or Cmd-*),
-	"/ but a symbolic key, return nil.
-	(aSymbolicKey startsWith:'Cmd') ifFalse:[
-	    (aSymbolicKey startsWith:'Ctrl') ifFalse:[
-		(aSymbolicKey startsWith:'Alt') ifFalse:[
-		    (aSymbolicKey startsWith:'Meta') ifFalse:[
-			(aSymbolicKey startsWith:'Shift') ifFalse:[
-			    ^ nil
-			].
-		    ].
-		].
-	    ].
-	].
-	untranslatedKey := aSymbolicKey.
+        "/ if its not an explicit command key (Ctrl-*, Alt-* or Cmd-*),
+        "/ but a symbolic key, return nil.
+        (aSymbolicKey startsWith:'Cmd') ifFalse:[
+            (aSymbolicKey startsWith:'Ctrl') ifFalse:[
+                (aSymbolicKey startsWith:'Alt') ifFalse:[
+                    (aSymbolicKey startsWith:'Meta') ifFalse:[
+                        (aSymbolicKey startsWith:'Shift') ifFalse:[
+                            ^ nil
+                        ].
+                    ].
+                ].
+            ].
+        ].
+        untranslatedKey := aSymbolicKey.
     ] ifFalse:[
-	untranslatedKeys size == 1 ifTrue:[
-	    untranslatedKey := untranslatedKeys first.
-	] ifFalse:[
-	    "if there are multiple mappings, show the Ctrl or the F-key mapping"
-	    untranslatedKey := untranslatedKeys
-				detect:[:k |k startsWith:'Ctrl']
-				ifNone:[
-				    untranslatedKeys
-					detect:[:k |k startsWith:'F']
-					ifNone:[untranslatedKeys first]].
-	].
+        untranslatedKeys size == 1 ifTrue:[
+            untranslatedKey := untranslatedKeys first.
+        ] ifFalse:[
+            "if there are multiple mappings, show the Ctrl or the F-key mapping"
+            untranslatedKey := untranslatedKeys
+                                detect:[:k |k startsWith:'Ctrl']
+                                ifNone:[
+                                    untranslatedKeys
+                                        detect:[:k |k startsWith:'F']
+                                        ifNone:[untranslatedKeys first]].
+        ].
     ].
 
     "/
     "/ some modifier-key combination ?
     "/
     (untranslatedKey startsWith:#Cmd) ifTrue:[
-	prefix := #Cmd.
+        prefix := #Cmd.
     ] ifFalse:[(untranslatedKey startsWith:#Alt) ifTrue:[
-	prefix := #Alt.
+        prefix := #Alt.
     ] ifFalse:[(untranslatedKey startsWith:#Meta) ifTrue:[
-	prefix := #Meta.
+        prefix := #Meta.
     ] ifFalse:[(untranslatedKey startsWith:#Ctrl) ifTrue:[
-	prefix := #Ctrl.
+        prefix := #Ctrl.
     ]]]].
 
     prefix notNil ifTrue:[
-	|modifier|
-
-	modifier := self modifierKeyTopFor:prefix.
-	modifier := (modifier ? prefix) , '-'.
-
-	^ modifier , (untranslatedKey copyFrom:(prefix size + 1))
+        |modifier|
+
+        modifier := self modifierKeyTopFor:prefix.
+        modifier := (modifier ? prefix) , (self shortKeyPrefixSeparator).
+
+        ^ modifier , (untranslatedKey copyFrom:(prefix size + 1))
     ].
     ^ untranslatedKey
 
@@ -8095,11 +8105,11 @@
 !DeviceWorkstation class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.559 2011-03-24 12:43:06 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.560 2011-07-21 14:04:47 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.559 2011-03-24 12:43:06 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.560 2011-07-21 14:04:47 cg Exp $'
 ! !
 
 DeviceWorkstation initialize!