#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Fri, 29 Mar 2019 14:14:42 +0100
changeset 4252 ebdd626ee83b
parent 4251 159146f89764
child 4253 eddc0118e0a5
#QUALITY by cg class: FlyByHelp comment/format in: #buttonMotion:x:y:view: #buttonPress:x:y:view: #keyPress:x:y:view: #keyRelease:x:y:view: #mouseWheelMotion:x:y:amount:deltaTime:view: #pointerLeave:view: #showHelp:for: changed: #initiateHelpFor:at:now:
FlyByHelp.st
--- a/FlyByHelp.st	Fri Mar 29 14:14:26 2019 +0100
+++ b/FlyByHelp.st	Fri Mar 29 14:14:42 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2001 by eXept Software AG
               All Rights Reserved
@@ -215,6 +217,14 @@
 !FlyByHelp methodsFor:'event handling'!
 
 buttonMotion:buttonAndModifierState x:x y:y view:aView
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: ==== ButtonMotion view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
+
     aView == currentHelpView ifTrue:[
         "/ the help-bubble itself
         ^ false
@@ -231,6 +241,14 @@
 buttonPress:button x:x y:y view:aView
     |prevView|
 
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: ButtonPress view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
+
     "/ hideHelp nils the currentView
     "/ we restore it, so the tooltip is not shown again for this view
     "/ until the mouse really leaves the view
@@ -249,8 +267,15 @@
 
     |prevView text|
 
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: KeyPress view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
     currentHelpView notNil ifTrue:[
-        key == $§ ifTrue:[
+        key == $§ ifTrue:[
             "/ generate a line suitable for the resources file (a null translation)
             "/ into the clipboard; makes it easy to add missing translations to a .rs file,
             "/ by pressing paragraph whenever you see an untranslated helptext
@@ -304,6 +329,13 @@
 keyRelease:key x:x y:y view:aView
     <resource: #keyboard (#Control)>
 
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: KeyRelease view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
     currentHelpView notNil ifTrue:[
         (#(#'Control' #'Control_L' #'Control_R') includes:key) ifTrue:[
             "/ reopen showing the text
@@ -321,6 +353,13 @@
 !
 
 mouseWheelMotion:state x:x y:y amount:amount deltaTime:dTime view:aView
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: MouseWheel view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
     currentHelpView notNil ifTrue:[
         self handleMouseIn:aView x:x y:y.
     ].
@@ -328,6 +367,14 @@
 !
 
 pointerLeave:state view:aView
+    "/ DebuggingEvents := true
+    "/ DebuggingEvents := false
+    DebuggingEvents == true ifTrue:[
+        ('%1: **** PointerLeave view:%2' 
+                bindWith:self class name 
+                with:aView) infoPrintCR.
+    ].
+
     aView == currentHelpView ifTrue:[^ true].
 
     "/ clear the do-not-show-in-this-view mode (see keyPress)
@@ -522,9 +569,12 @@
 
     |text delayTime|
 
+    Debugging ifTrue:[
+        ('%1: initiateHelpFor:at:now: %2' bindWith:self class name with:aView) infoPrintCR.
+    ].
     (self interestedIn:aView) ifFalse:[
         Debugging ifTrue:[
-            'not interested' infoPrintCR
+            ('%1: not interested' bindWith:self class name) infoPrintCR
         ].    
         ^ self
     ].
@@ -533,9 +583,9 @@
     "/ helpText gatherer (the codeView parses the code for the variable under the cursor)
     [
         Error handle:[:ex |
-            ('FlyByhelp [warning]: error while asking for helpText: ',ex description) errorPrintCR.
-            Transcript showCR:'-------------------------'.
-            ex suspendedContext fullPrintAllOn:Transcript.
+            ('%1: [warning]: error while asking for helpText: %2' bindWith:self class name with:ex description) errorPrintCR.
+            '-------------------------' errorPrintCR.
+            ex suspendedContext fullPrintAllOn:(Transcript ? Stderr).
             "/ self halt.
         ] do:[
             HelpKeyInsteadOfHelpTextQuery answer:(aView device ctrlDown) do:[
@@ -543,7 +593,7 @@
             ].
         ].
     ] valueWithWatchDog:[ 
-        'FlyByhelp [info]: flyBy text generation took too long' infoPrintCR.
+        ('%1 [info]: flyBy text generation took too long' bindWith:self class name) infoPrintCR.
         ^ self 
     ] afterMilliseconds:(self flyByHelpTimeoutMillis).
 
@@ -557,11 +607,15 @@
         ].
     ].
     
-    (lastHelpText = text and:[lastHelpWidget == aView]) ifTrue:[ 
+    (lastHelpText = text and:[lastHelpWidget == aView]) ifTrue:[
+        "/ Debugging := true
         Debugging == true ifTrue:[
             'same text: ' infoPrint. text infoPrintCR.
         ].    
         self toolTipFollowsMouse ifFalse:[
+            Debugging == true ifTrue:[
+                'tooltip does not follow mouse: ' infoPrint. text infoPrintCR.
+            ].    
             ^ self
         ]
     ].
@@ -587,6 +641,9 @@
             self showHelp:text for:aView
         ]
     ] ifFalse:[
+        Debugging == true ifTrue:[
+            'empty text: ' infoPrint. text infoPrintCR.
+        ].    
         self hideHelp
     ].
 
@@ -606,6 +663,7 @@
     (wg := view windowGroup) notNil ifTrue:[
         wg isInModalLoop ifTrue:[
             wg isModal ifFalse:[
+                Debugging ifTrue:[ 'FlyByHelp: not modal' infoPrintCR ].
                 ^ self
             ].
         ].
@@ -617,11 +675,12 @@
     "/ mouse still over that view?
     cursorView := device viewFromPoint:pointerPosition.
     cursorView ~~ view ifTrue:[
-        Debugging ifTrue:[ 'mouse no longer in view' infoPrintCR ].
+        Debugging ifTrue:[ 'FlyByHelp: mouse no longer in view' infoPrintCR ].
         ^ self
     ].
 
     (view == currentView and:[lastHelpText = aHelpText]) ifTrue:[
+        Debugging ifTrue:[ 'FlyByHelp: same text and widget' infoPrintCR ].
         ^ self
     ].