#BUGFIX by sr
authorsr
Wed, 11 Apr 2018 17:53:27 +0200
changeset 5732 e0a1d523567c
parent 5731 920affcbb4d7
child 5733 7b192c9c2a99
#BUGFIX by sr bugfix: menus are created untranslated for #processShortcut: but they could be cached, which ends up in untranslated menu views.... class: MenuPanel class definition comment/format in: #processShortcut: class: MenuPanel::Item class definition comment/format in: #hideSubmenu: #submenu: changed: #primSubmenu: #setupSubmenu class: MenuPanel::Item::Adornment class definition class: MenuPanel::ScrollActivity class definition
MenuPanel.st
--- a/MenuPanel.st	Wed Mar 28 15:45:44 2018 +0200
+++ b/MenuPanel.st	Wed Apr 11 17:53:27 2018 +0200
@@ -14,54 +14,54 @@
 "{ NameSpace: Smalltalk }"
 
 View subclass:#MenuPanel
-        instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset
-                selection items groupSizes receiver enabled lastActiveMenu
-                enteredItem prevFocusView previousPointerGrab
-                previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
-                scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
-                showSeparatingLines showGroupDivider implicitGrabView
-                lastPointerView openDelayedMenuBlock closeDelayedMenuBlock
-                preferredWidth application originator centerItems hideOnRelease
-                defaultHideOnRelease buttonInsetX buttonInsetY itemSpace
-                stringOffsetX doAccessCharacterTranslation lastItem hasPerformed
-                focusComesByTab lastDrawnScrollerNextBounds
-                buttonActiveBackgroundColor buttonEnteredBackgroundColor
-                buttonPassiveBackgroundColor sizeFixed extraMargin
-                buttonActiveLevel buttonPassiveLevel buttonEnteredLevel
-                pluggableHelpSpecProvider'
-        classVariableNames:'DefaultBackgroundColor DefaultForegroundColor
-                IconDisabledIndicationOff IconDisabledIndicationOn
-                IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff
-                IconIndicationOn IconRadioOff IconRadioOn Images
-                InitialSelectionQuerySignal LigthenedImages
-                MaxShortCutSearchLevel'
-        poolDictionaries:''
-        category:'Views-Menus'
+	instanceVariableNames:'shadowView mapTime mustRearrange superMenu shortKeyInset
+		selection items groupSizes receiver enabled lastActiveMenu
+		enteredItem prevFocusView previousPointerGrab
+		previousKeyboardGrab relativeGrabOrigin hasImplicitGrap
+		scrollActivity rightArrowShadow rightArrow fgColor verticalLayout
+		showSeparatingLines showGroupDivider implicitGrabView
+		lastPointerView openDelayedMenuBlock closeDelayedMenuBlock
+		preferredWidth application originator centerItems hideOnRelease
+		defaultHideOnRelease buttonInsetX buttonInsetY itemSpace
+		stringOffsetX doAccessCharacterTranslation lastItem hasPerformed
+		focusComesByTab lastDrawnScrollerNextBounds
+		buttonActiveBackgroundColor buttonEnteredBackgroundColor
+		buttonPassiveBackgroundColor sizeFixed extraMargin
+		buttonActiveLevel buttonPassiveLevel buttonEnteredLevel
+		pluggableHelpSpecProvider'
+	classVariableNames:'DefaultBackgroundColor DefaultForegroundColor
+		IconDisabledIndicationOff IconDisabledIndicationOn
+		IconDisabledRadioOff IconDisabledRadioOn IconIndicationOff
+		IconIndicationOn IconRadioOff IconRadioOn Images
+		InitialSelectionQuerySignal LigthenedImages
+		MaxShortCutSearchLevel'
+	poolDictionaries:''
+	category:'Views-Menus'
 !
 
 Object subclass:#Item
-        instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
-                disabledDisplayLabel enableChannel label activeHelpText
-                flyByHelpText isVisible indication choice accessCharacter'
-        classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
-                VerticalButtonInset LabelRightOffset VerticalPopUpInset'
-        poolDictionaries:''
-        privateIn:MenuPanel
+	instanceVariableNames:'menuItem layout menuPanel subMenu displayLabel displayLabelExtent
+		disabledDisplayLabel enableChannel label activeHelpText
+		flyByHelpText isVisible indication choice accessCharacter'
+	classVariableNames:'HorizontalInset VerticalInset HorizontalButtonInset
+		VerticalButtonInset LabelRightOffset VerticalPopUpInset'
+	poolDictionaries:''
+	privateIn:MenuPanel
 !
 
 Object subclass:#Adornment
-        instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
-                choice choiceValue'
-        classVariableNames:''
-        poolDictionaries:''
-        privateIn:MenuPanel::Item
+	instanceVariableNames:'indication accessCharacterPosition shortcutKey argument argument2
+		choice choiceValue'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:MenuPanel::Item
 !
 
 Object subclass:#ScrollActivity
-        instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
-        classVariableNames:''
-        poolDictionaries:''
-        privateIn:MenuPanel
+	instanceVariableNames:'semaLock activeMenu scrollTask direction icons'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:MenuPanel
 !
 
 !MenuPanel class methodsFor:'documentation'!
@@ -5058,8 +5058,15 @@
         ^ true
     ].
 
-    Menu::NeedResourcesQuery answer:false do:[
-
+    "sr: bugfix:
+     the submenu can be cached,
+     so if we don't care about resources here (which seams like a performance optimization),
+     we have non translated sub menus (when using them later for viewing).
+     Problem expecco Menu 'View' was somethimes untranslated and somethimes not.
+     Dependent if this code was called before the user did open (instantiate) the menu via the application.
+     May also the shortcuts itself could vary when translated 'Open &File' -> 'Datei &öffnen' ????"
+    Menu::NeedResourcesQuery answer:true do:[
+"/    Menu::NeedResourcesQuery answer:false do:[
         [true] whileTrue:[
             list := menu
                         selectItemIndicesFor:[:el|
@@ -5094,6 +5101,7 @@
     ^ false     "/ never reached
 
     "Modified: / 06-10-2011 / 16:19:27 / cg"
+    "Modified (comment): / 11-04-2018 / 17:52:03 / sr"
 !
 
 selectItemIndicesFor:aOneArgBlock maxDepth:maxDepth from:aStart to:aStop ignoreSubmenuBlock:ignoreSubmenueBlock