reafctored
authorClaus Gittinger <cg@exept.de>
Tue, 26 Feb 2008 11:25:53 +0100
changeset 2392 02244f5708b7
parent 2391 f6af9239e999
child 2393 14e0b6215b42
reafctored
FlyByHelp.st
--- a/FlyByHelp.st	Tue Feb 26 11:25:51 2008 +0100
+++ b/FlyByHelp.st	Tue Feb 26 11:25:53 2008 +0100
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libview2' }"
 
 ActiveHelp subclass:#FlyByHelp
@@ -59,11 +58,11 @@
     "Modified: 27.4.1996 / 15:07:27 / cg"
 ! !
 
-!FlyByHelp methodsFor:'listening'!
+!FlyByHelp methodsFor:'event handling'!
 
 buttonMotion:state x:x y:y view:aView
-    aView == currentHelpView ifTrue:[^ self].
-    super buttonMotion:state x:x y:y view:aView
+    aView == currentHelpView ifTrue:[^ false].
+    ^ super buttonMotion:state x:x y:y view:aView
 !
 
 pointerLeave:state view:aView
@@ -71,7 +70,7 @@
     super pointerLeave:state view:aView
 ! !
 
-!FlyByHelp methodsFor:'private'!
+!FlyByHelp methodsFor:'help texts'!
 
 helpTextFromModel:aModel view:aView at:aPointOrNil 
     "helper: ask aModel for its helpText."
@@ -107,7 +106,9 @@
         ].
     ].
     ^ text.
-!
+! !
+
+!FlyByHelp methodsFor:'private'!
 
 hideIfPointerLeft:aView
     "hide help, if the pointer is not in aView"
@@ -133,7 +134,7 @@
      re-negotiation of the displayed helpText 
      (for example in a menu, when the selection changes)"
 
-    |text|
+    |text delayTime|
 
     (self interestedIn:aView) ifFalse:[
         ^ self
@@ -141,19 +142,23 @@
 
     text := self helpTextFor:aView at:aPointOrNil.
     lastHelpText = text ifTrue:[
-        ^ self
+        self toolTipFollowsMouse ifFalse:[
+            ^ self
+        ]
     ].
 
     text size > 0 ifTrue:[
-        (showItNow not and:[self class delayTime > 0]) ifTrue:[
+        delayTime := self delayTime.
+        (showItNow not and:[delayTime > 0]) ifTrue:[
             self stopHelpDisplayProcess.
-            showProcess := [
-                    Delay waitForSeconds:self class delayTime.
-                    showProcess := nil.
-                    aView device anyButtonPressed ifFalse:[
-                        self showHelp:text for:aView
-                    ]
-            ] forkAt:(Processor userSchedulingPriority + 1).
+            showProcess := 
+                [
+                        Delay waitForSeconds:delayTime.
+                        showProcess := nil.
+                        aView device anyButtonPressed ifFalse:[
+                            self showHelp:text for:aView
+                        ]
+                ] forkAt:(Processor userSchedulingPriority + 1).
         ] ifFalse:[
             self showHelp:text for:aView
         ]
@@ -172,6 +177,12 @@
     ^ super interestedIn:aView
 ! !
 
+!FlyByHelp methodsFor:'queries'!
+
+toolTipFollowsMouse
+    ^ false
+! !
+
 !FlyByHelp methodsFor:'show & hide help'!
 
 hideHelp
@@ -242,23 +253,25 @@
     v enableButtonMotionEvents.
     v enableMotionEvents.
     currentHelpView := v.
+    currentView := view.
 
-    currentView := view.
-    closeProcess := [
-            [
-                (Delay forSeconds:self class showTime) wait.
+    self showTime notNil ifTrue:[
+        closeProcess := [
                 [
-                    currentHelpView notNil ifTrue:[
-                        currentHelpView destroy.
-                        currentHelpView := nil.
-                    ]
-                ] valueUninterruptably
-            ] ifCurtailed:[
-                closeProcess := nil.
-            ].
-        ] newProcess.
-    closeProcess priority:(Processor userSchedulingPriority + 1).
-    closeProcess resume.
+                    (Delay forSeconds:self showTime) wait.
+                    [
+                        currentHelpView notNil ifTrue:[
+                            currentHelpView destroy.
+                            currentHelpView := nil.
+                        ]
+                    ] valueUninterruptably
+                ] ifCurtailed:[
+                    closeProcess := nil.
+                ].
+            ] newProcess.
+        closeProcess priority:(Processor userSchedulingPriority + 1).
+        closeProcess resume.
+    ].
 
     "Modified: / 31-08-1995 / 19:20:45 / claus"
     "Modified: / 16-03-2004 / 15:27:50 / cg"
@@ -278,7 +291,7 @@
 !FlyByHelp class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.14 2004-07-13 10:51:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/FlyByHelp.st,v 1.15 2008-02-26 10:25:53 cg Exp $'
 ! !
 
 FlyByHelp initialize!