ActiveHelp.st
changeset 92 18d1136ad2e0
parent 59 98a4d38cfc96
child 97 72fbe8f7130f
--- a/ActiveHelp.st	Sun Aug 27 02:33:33 1995 +0200
+++ b/ActiveHelp.st	Sun Aug 27 16:41:00 1995 +0200
@@ -14,8 +14,8 @@
 'From Smalltalk/X, Version:2.10.5 on 26-mar-1995 at 10:19:20 am'!
 
 EventListener subclass:#ActiveHelp
-	 instanceVariableNames:'currentView currentHelpView currentFrame closeProcess'
-	 classVariableNames:'ShowTime TheOneAndOnlyHelpListener'
+	 instanceVariableNames:'currentView currentHelpView currentFrame showProcess closeProcess'
+	 classVariableNames:'DelayTime ShowTime TheOneAndOnlyHelpListener'
 	 poolDictionaries:''
 	 category:'Interface-Help'
 !
@@ -24,7 +24,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.1 1995-03-31 03:08:53 claus Exp $
+$Header: /cvs/stx/stx/libview2/ActiveHelp.st,v 1.2 1995-08-27 14:40:57 claus Exp $
 "
 !
 
@@ -52,7 +52,12 @@
 !ActiveHelp class methodsFor:'initialization'!
 
 initialize
-    ShowTime := 15
+    ShowTime := 15.
+    DelayTime := 1.
+
+    "
+     ActiveHelp initialize
+    "
 ! !
 
 !ActiveHelp class methodsFor:'startup'!
@@ -72,20 +77,15 @@
     TheOneAndOnlyHelpListener notNil ifTrue:[
 	TheOneAndOnlyHelpListener unlisten.
     ].
+    TheOneAndOnlyHelpListener := nil
 
     "
      ActiveHelp stop
     "
-
 !
 
-release 
-    self stop.
-    TheOneAndOnlyHelpListener := nil
-
-    "
-     ActiveHelp release
-    "
+isActive 
+    ^ TheOneAndOnlyHelpListener notNil
 ! !
 
 !ActiveHelp methodsFor:'private'!
@@ -147,6 +147,10 @@
 hideIfPointerLeft:aView
     |whereOnScreen|
 
+    showProcess notNil ifTrue:[
+	showProcess terminate.
+    ].
+
     whereOnScreen := aView device pointerPosition.
 
     (currentFrame notNil
@@ -154,7 +158,6 @@
 	self hideHelp.
 	currentView := nil
     ].
-
 ! !
 
 !ActiveHelp methodsFor:'listening'!
@@ -167,6 +170,9 @@
 pointerEnter:state x:x y:y view:aView
     |text|
 
+    showProcess notNil ifTrue:[
+	showProcess terminate.
+    ].
     self hideIfPointerLeft:aView.
     aView topView == currentHelpView ifTrue:[
 	^ true
@@ -175,7 +181,18 @@
     text := self helpTextFor:aView atX:x y:y.
 
     text notNil ifTrue:[
-	self showHelp:text for:aView
+	DelayTime > 0 ifTrue:[
+	    showProcess notNil ifTrue:[
+		showProcess terminate.
+	    ].
+	    showProcess := [
+		    (Delay forSeconds:DelayTime) wait.
+		    showProcess := nil.
+		    self showHelp:text for:aView
+	    ] forkAt:(Processor userSchedulingPriority + 1).
+	] ifFalse:[
+	    self showHelp:text for:aView
+	]
     ].
 
     ^ false
@@ -199,6 +216,9 @@
 !ActiveHelp methodsFor:'show / hide help'!
 
 hideHelp
+    showProcess notNil ifTrue:[
+	showProcess terminate.
+    ].
     currentHelpView notNil ifTrue:[
 	[
 	    currentHelpView destroy.
@@ -217,6 +237,9 @@
 
     view == currentView ifTrue:[^ self].
 
+    closeProcess notNil ifTrue:[
+	closeProcess terminate.
+    ].
     currentHelpView notNil ifTrue:[
 	self hideHelp
     ].
@@ -225,9 +248,17 @@
     currentFrame := org extent:view extent.
     org :=org + (view extent // 2).
 
-org := view device pointerPosition.
+    currentHelpView := ActiveHelpView for:aHelpText withCRs.
 
-    currentHelpView := ActiveHelpView for:aHelpText withCRs.
+    org := view device pointerPosition.
+    org := org + (20@20).
+    (org x + currentHelpView width) > view device width ifTrue:[
+	org := (org x - currentHelpView width) @ org y
+    ].
+    (org y + currentHelpView height) > view device height ifTrue:[
+	org := org x @ (org y - currentHelpView height).
+    ].
+
     currentHelpView origin:org.
 "/    currentHelpView open.
     currentHelpView realize.