--- a/ActiveHelp.st Sat Feb 23 15:30:50 2019 +0100
+++ b/ActiveHelp.st Wed Feb 27 15:54:01 2019 +0100
@@ -269,6 +269,12 @@
"
"Created: / 11-06-2018 / 10:30:24 / Claus Gittinger"
+!
+
+singleton
+ ^ TheOneAndOnlyHelpListener
+
+ "Created: / 27-02-2019 / 11:06:32 / Claus Gittinger"
! !
!ActiveHelp class methodsFor:'queries'!
@@ -320,6 +326,21 @@
!ActiveHelp class methodsFor:'start & stop'!
+initiateHelp
+ "determine where the mouse pointer is located,
+ and start showing a tooltip for it.
+ This can be caleld to force update of the tooltip,
+ in case a widget has changed its mind
+ (typically: an undo menu button function might wonna do this,
+ to show changed info)"
+
+ TheOneAndOnlyHelpListener notNil ifTrue:[
+ TheOneAndOnlyHelpListener initiateHelp
+ ].
+
+ "Created: / 27-02-2019 / 11:08:54 / Claus Gittinger"
+!
+
start
"start activeHelp for all apps"
@@ -423,13 +444,12 @@
"/ realViewUnderCursor := aView device viewFromPoint:(aView pointerPosition).
"/ realP := aView device translatePoint:(x@y) fromView:aView toView:realViewUnderCursor.
"/ self handleMouseIn:realViewUnderCursor x:realP x y:realP y.
- Debugging ifTrue:['motion' infoPrintCR].
+ Debugging ifTrue:[('motion %2@%3 in %1' bindWith:aView with:x with:y) infoPrintCR].
self handleMouseIn:aView x:x y:y.
].
^ false
- "Modified: / 11-06-2018 / 10:31:42 / Claus Gittinger"
- "Modified (format): / 02-08-2018 / 16:12:45 / Claus Gittinger"
+ "Modified: / 27-02-2019 / 15:49:03 / Claus Gittinger"
!
handleMouseIn:aView x:x y:y
@@ -693,9 +713,10 @@
UserPreferences current onlyShowTooltipsForActiveWindow ifTrue:[
Debugging ifTrue:[
- 'TopView:' infoPrint. aViewsTopView infoPrint.
- ' focus:' infoPrint. aViewsTopView graphicsDevice focusView infoPrint.
- ' active:' infoPrint. aViewsTopView isActive infoPrintCR.
+ ('TopView: %1 focus: %2 active: %3'
+ bindWith:aViewsTopView
+ with:aViewsTopView graphicsDevice focusView
+ with:aViewsTopView isActive) infoPrintCR.
].
aViewsTopView isActive ifFalse:[
Debugging ifTrue:[
@@ -743,7 +764,7 @@
"Created: / 26-10-1997 / 23:28:52 / cg"
"Modified: / 08-08-1998 / 13:36:19 / cg"
- "Modified (format): / 11-08-2018 / 08:15:40 / Claus Gittinger"
+ "Modified: / 27-02-2019 / 11:25:58 / Claus Gittinger"
!
targetViewInitiatesHelpViaSensor
@@ -784,6 +805,58 @@
].
!
+initiateHelp
+ "determine where the mouse pointer is located,
+ and start showing a tooltip for it right now.
+ This can be caleld to force update of the tooltip,
+ in case a widget has changed its mind
+ (typically: an undo menu button function might wonna do this,
+ to show changed info)"
+
+ |screenPos view|
+
+ screenPos := Display pointerPosition.
+ Debugging == true ifTrue:[
+ '----------------' infoPrintCR.
+ 'pos: ' infoPrint. screenPos infoPrintCR.
+ ].
+ view := Display viewFromPoint:screenPos.
+ Debugging == true ifTrue:[
+ 'view: ' infoPrint. view infoPrintCR.
+ ].
+ view notNil ifTrue:[
+ self initiateHelpFor:view.
+ ].
+
+ "Created: / 27-02-2019 / 11:09:41 / Claus Gittinger"
+ "Modified: / 27-02-2019 / 15:50:18 / Claus Gittinger"
+!
+
+initiateHelpFor:aView
+ "start showing a tooltip for aView right now.
+ This can be called to force update of the tooltip,
+ in case a widget has changed its mind
+ (typically: an undo menu button function might wonna do this,
+ to show changed info)"
+
+ |screenPos relativePos|
+
+ screenPos := Display pointerPosition.
+ Debugging == true ifTrue:[
+ 'pos: ' infoPrint. screenPos infoPrintCR.
+ ].
+ aView notNil ifTrue:[
+ relativePos := Display translatePoint:screenPos fromView:nil toView:aView.
+ Debugging == true ifTrue:[
+ 'relativePos: ' infoPrint. relativePos infoPrintCR.
+ ].
+ self initiateHelpFor:aView at:relativePos
+ ].
+
+ "Created: / 27-02-2019 / 13:59:44 / Claus Gittinger"
+ "Modified: / 27-02-2019 / 15:52:07 / Claus Gittinger"
+!
+
initiateHelpFor:aView at:aPointOrNil
"ask aView for helpText, passing x/y coordinates;
start a timeout process to display this helpText after some delay;
@@ -813,6 +886,9 @@
|text top app|
+ Debugging == true ifTrue:[
+ 'initiate help for: ' infoPrint. aView infoPrintCR.
+ ].
(self interestedIn:aView) ifFalse:[
^ self
].
@@ -833,6 +909,8 @@
lastHelpText := text.
]
].
+
+ "Modified: / 27-02-2019 / 11:15:48 / Claus Gittinger"
!
stopHelpDisplayProcess