MenuPanel.st
changeset 987 541dff179cc2
parent 984 87d36803b9d8
child 1010 908145ffe38a
--- a/MenuPanel.st	Fri Jul 10 01:58:57 1998 +0200
+++ b/MenuPanel.st	Fri Jul 17 11:57:43 1998 +0200
@@ -2972,6 +2972,18 @@
 
 !MenuPanel::Item class methodsFor:'defaults'!
 
+displayShortKeys:aBoolean
+    "enable/disable displaying of shortCut keys"
+
+    DisplayShortKey := aBoolean.
+
+    "
+     self displayShortKeys:true
+    "
+
+    "Created: / 17.7.1998 / 11:40:38 / cg"
+!
+
 separatorSize:aType
     "returns size of a separator
     "
@@ -4402,11 +4414,7 @@
 shortcutKeyAsString
     "converts shortcutKey to a text object
     "
-    |nm key|
-
-    "/ this is somewhat complicated: we have the symbolic key at hand,
-    "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
-    "/
+    |nm key prefix|
 
     (key := self shortcutKey) isNil ifTrue:[
         ^ nil
@@ -4415,27 +4423,32 @@
     key isCharacter ifTrue:[
         nm := key asString
     ] ifFalse:[
+        "/ this is somewhat complicated: we have the symbolic key at hand,
+        "/ but want to show the untranslated (inverse keyBoardMapped) key & modifier
+        "/ Ask the devices keyboardMap for the backtranslation.
+
         nm := menuPanel device keyboardMap keyAtValue:key ifAbsent:key.
         "/
         "/ some modifier-key combination ?
         "/
-
         (nm startsWith:#Cmd) ifTrue:[
-            nm := (self shortcutKeyPrefixFor:#Cmd) , (nm copyFrom:4)
+            prefix := #Cmd.
         ] ifFalse:[(nm startsWith:#Alt) ifTrue:[
-            nm := (self shortcutKeyPrefixFor:#Alt) , (nm copyFrom:4)
+            prefix := #Alt.
         ] ifFalse:[(nm startsWith:#Meta) ifTrue:[
-            nm := (self shortcutKeyPrefixFor:#Meta), (nm copyFrom:5)
-        ]
-        ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
-            nm := (self shortcutKeyPrefixFor:#Ctrl), (nm copyFrom:5)
+            prefix := #Meta.
+        ] ifFalse:[(nm startsWith:#Ctrl) ifTrue:[
+            prefix := #Ctrl.
+        ]]]].
+        prefix notNil ifTrue:[
+            nm := (self shortcutKeyPrefixFor:prefix), (nm copyFrom:(prefix size + 1))
         ] ifFalse:[
             nm := nm asString
-        ]]]]
+        ]
     ].
     ^ nm
 
-
+    "Modified: / 17.7.1998 / 11:56:40 / cg"
 !
 
 shortcutKeyPrefixFor:aModifier
@@ -4444,11 +4457,12 @@
     |m|
 
     m := menuPanel device modifierKeyTopFor:aModifier.
-
     m notNil ifTrue:[
         ^ m , '-'
     ].
-    ^ aModifier.
+    ^ aModifier , '-'.
+
+    "Modified: / 17.7.1998 / 11:56:46 / cg"
 ! !
 
 !MenuPanel::Item methodsFor:'selection'!
@@ -4601,6 +4615,6 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.90 1998-07-08 18:07:02 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.91 1998-07-17 09:57:43 cg Exp $'
 ! !
 MenuPanel initialize!