FlyByHelp.st
changeset 4379 0d9f544dd9c8
parent 4372 64e5908a7478
child 4380 86812797002e
--- a/FlyByHelp.st	Fri Oct 18 16:30:42 2019 +0200
+++ b/FlyByHelp.st	Fri Oct 18 23:10:37 2019 +0200
@@ -132,9 +132,14 @@
 
     topView := aView topView.
     app := topView application.
-    app isNil ifTrue:[ Transcript showCR:'no app for view: %1' with:aView. ^ self ].
-    
-    app enqueueDelayedAction:[
+    app isNil ifTrue:[ 
+        Transcript showCR:'no app for view: %1' with:aView. 
+        "/ ^ self 
+    ].
+    topView sensor 
+        pushAction:
+        "/ app enqueueDelayedAction:
+        [
         |editor m canDefineTranslationForLabel canDefineTranslationForHelpText menuItem i  viewsApp|
 
         viewsApp := aView application. "/ could be different from top-app (if embedded)
@@ -221,33 +226,35 @@
             ]
             enabled:canDefineTranslationForHelpText).
 
-        m addSeparator. 
-        m addItem:(i := MenuItem 
-            label:('Browse Application (%1)' bindWith:(viewsApp ? app) className)
-            itemValue:[ SystemBrowser default openInClass:(viewsApp ? app) class]).
-        i enabled:((viewsApp ? app) notNil).
+        (viewsApp ? app) notNil ifTrue:[
+            m addSeparator. 
+            m addItem:(i := MenuItem 
+                label:('Browse Application (%1)' bindWith:(viewsApp ? app) className)
+                itemValue:[ SystemBrowser default openInClass:(viewsApp ? app) class]).
+            i enabled:((viewsApp ? app) notNil).
 
-        m addItem:(i := MenuItem 
-            label: 'Browse Application''s helpSpec'
-            itemValue:[ SystemBrowser default openInClass:(viewsApp ? app) class theMetaclass selector:#helpSpec]).
-        i enabled:((viewsApp ? app) notNil and:[(viewsApp ? app) class theMetaclass includesSelector:#helpSpec]).
+            m addItem:(i := MenuItem 
+                label: 'Browse Application''s helpSpec'
+                itemValue:[ SystemBrowser default openInClass:(viewsApp ? app) class theMetaclass selector:#helpSpec]).
+            i enabled:((viewsApp ? app) notNil and:[(viewsApp ? app) class theMetaclass includesSelector:#helpSpec]).
 
-        m addItem:(i := MenuItem 
-            label: 'UI Painter'
-            itemValue:[ UIPainter openOnClass:(viewsApp ? app) class andSelector:#windowSpec]).
-        i enabled:((viewsApp ? app) notNil).
+            m addItem:(i := MenuItem 
+                label: 'UI Painter'
+                itemValue:[ UIPainter openOnClass:(viewsApp ? app) class andSelector:#windowSpec]).
+            i enabled:((viewsApp ? app) notNil).
 
-        viewsApp ~~ app ifTrue:[    
-            m addSeparator. 
-            m addItem:(MenuItem 
-                label:('Browse Top Application (%1)' bindWith:app className)
-                itemValue:[ SystemBrowser default openInClass:app class]).
+            viewsApp ~~ app ifTrue:[    
+                m addSeparator. 
+                m addItem:(MenuItem 
+                    label:('Browse Top Application (%1)' bindWith:app className)
+                    itemValue:[ SystemBrowser default openInClass:app class]).
 
-            m addItem:(MenuItem 
-                label: 'UI Painter on Top Application'
-                itemValue:[ UIPainter openOnClass:app class andSelector:#windowSpec]).
+                m addItem:(MenuItem 
+                    label: 'UI Painter on Top Application'
+                    itemValue:[ UIPainter openOnClass:app class andSelector:#windowSpec]).
+            ].
         ].
-        
+
         m addSeparator. 
         m addItem:(i := MenuItem label: 'Inspect Application' itemValue:[ app inspect ]).
         i enabled:(app notNil).
@@ -355,15 +362,7 @@
 "/        ].
 "/    ].
 
-    currentHelpView notNil ifTrue:[
-        "/ Transcript show:'with help view shown: '; showCR:key.
-
-        key == #Escape ifTrue:[
-            prevView := currentView.
-            self hideHelp.
-            currentView := prevView.
-            ^ false
-        ].
+    Smalltalk isStandAloneApp ifFalse:[
         (#(#'Control' #'Control_L' #'Control_R') includes:key) ifTrue:[
             Smalltalk isStandAloneApp ifFalse:[
                 aView device shiftDown ifTrue:[
@@ -376,6 +375,23 @@
             self initiateHelpFor:aView at:(x@y) now:true.
             ^ false
         ].
+        (#(#'Shift' #'Shift_L' #'Shift_R') includes:key) ifTrue:[
+            aView device ctrlDown ifTrue:[
+                self openDeveloperMenuFor:aView at:x@y
+            ].
+            ^ false
+        ].
+    ].
+
+    currentHelpView notNil ifTrue:[
+        "/ Transcript show:'with help view shown: '; showCR:key.
+
+        key == #Escape ifTrue:[
+            prevView := currentView.
+            self hideHelp.
+            currentView := prevView.
+            ^ false
+        ].
         Smalltalk isStandAloneApp ifFalse:[
             key == $§ ifTrue:[
                 "/ generate a line suitable for the resources file (a null translation)
@@ -386,40 +402,11 @@
                 self hideHelp.
                 ^ false
             ].
-            (#(#'Shift' #'Shift_L' #'Shift_R') includes:key) ifTrue:[
-                aView device ctrlDown ifTrue:[
-                    self openDeveloperMenuFor:aView at:x@y
-                ].
-                ^ false
-            ].
         ].        
         (#('Shift' #'Shift_L' #'Shift_R' ) includes:key) ifTrue:[
             "/ do not close on those...
             ^ false
         ].
-    ] ifFalse:[
-        "/ Transcript show:'without help view shown: '; showCR:key.
-        Smalltalk isStandAloneApp ifFalse:[
-            "/ both shifts AND then ctrl...
-            (#(#'Control' #'Control_L' #'Control_R') includes:key) ifTrue:[
-                aView device leftShiftDown ifTrue:[
-                    aView device rightShiftDown ifTrue:[
-                        self openDeveloperMenuFor:aView at:x@y.
-                        ^ false
-                    ].
-                ].
-            ].
-            (#('Shift' #'Shift_L' #'Shift_R' ) includes:key) ifTrue:[
-                aView device ctrlDown ifTrue:[
-                    aView device leftShiftDown ifTrue:[
-                        aView device rightShiftDown ifTrue:[
-                            self openDeveloperMenuFor:aView at:x@y.
-                            ^ false
-                        ].
-                    ].
-                ].
-            ].
-        ].    
     ].    
 
     "/ hideHelp nils the currentView