MenuPanel.st
changeset 5823 dd019996a46d
parent 5820 27c504a2f7bb
child 5824 04608830f559
--- a/MenuPanel.st	Fri Jun 29 16:10:46 2018 +0200
+++ b/MenuPanel.st	Tue Jul 03 14:38:58 2018 +0200
@@ -30,7 +30,7 @@
 		buttonActiveBackgroundColor buttonEnteredBackgroundColor
 		buttonPassiveBackgroundColor sizeFixed extraMargin
 		buttonActiveLevel buttonPassiveLevel buttonEnteredLevel
-		pluggableHelpSpecProvider'
+		pluggableHelpSpecProvider unusedShortCutsCache'
 	classVariableNames:'DefaultBackgroundColor DefaultForegroundColor
 		IconDisabledIndicationOff IconDisabledIndicationOn
 		IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff
@@ -5108,6 +5108,21 @@
     ].
 
     rawKey := aKeyEvent rawKey.
+
+    "sr: after discussion with cg,
+     we decided to cache shortcuts with no actions.
+     we also know about the fact that this will ignore short cuts 
+     from dynamic menus (but we dont care)"
+    unusedShortCutsCache isNil ifTrue:[
+        "sr: I dont care about sync here,
+         because in worst case some shortcuts are calculated twice"
+        unusedShortCutsCache := IdentitySet new.    
+    ].    
+
+    (unusedShortCutsCache includesIdentical:rawKey asSymbol) ifTrue:[
+        ^ false
+    ].    
+    
     item := nil.
     menu := self detectGrabMenu. "/ first lookup the current grabMenu before starting in the topMenu
 
@@ -5161,14 +5176,19 @@
                 ^ true
             ].
 
-            menu == self ifTrue:[ ^ false ].
+            menu == self ifTrue:[ 
+                unusedShortCutsCache add:rawKey asSymbol.
+                ^ false 
+            ].
             menu := self.
         ].
     ].
+
+    unusedShortCutsCache add:rawKey asSymbol.
     ^ false     "/ never reached
 
     "Modified: / 06-10-2011 / 16:19:27 / cg"
-    "Modified (comment): / 11-04-2018 / 17:52:03 / sr"
+    "Modified: / 03-07-2018 / 14:37:59 / sr"
 !
 
 selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop ignoreSubmenuBlock:ignoreSubmenueBlock