--- a/ActiveHelpView.st Sat Jun 28 14:13:17 1997 +0200
+++ b/ActiveHelpView.st Sat Jun 28 14:25:10 1997 +0200
@@ -39,7 +39,7 @@
documentation
"
- a talking view.
+ a bubbleHelp view.
Instances of myself show up either as a comics-like talking
view, or as a simple square popup. This is configured via the
@@ -48,6 +48,7 @@
a symbol-value of #cartoon.
However, be aware that some servers have performance problems with
these view-shapes (or do not support shapes at all).
+ Therefore, the default style is a rectangular popupView.
[author:]
Claus Gittinger
@@ -60,7 +61,7 @@
!ActiveHelpView class methodsFor:'instance creation'!
for:someText
- "create a talking-view for some text"
+ "create a bubble-view for some text"
|helpView textView|
@@ -71,14 +72,24 @@
^ (helpView withView:textView) contents:someText
"
- (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs)
- shapeStyle:nil; realize
+ |v|
- (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs)
- shapeStyle:#cartoon; realize
+ v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil.
+ v realize.
+ Delay waitForSeconds:2.
+ v destroy
"
- "Modified: 5.7.1996 / 17:59:23 / cg"
+ "
+ |v|
+
+ v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon.
+ v realize.
+ Delay waitForSeconds:2.
+ v destroy
+ "
+
+ "Modified: 28.6.1997 / 14:24:23 / cg"
!
with:aView
@@ -113,14 +124,14 @@
shapeStyle:aStyleSymbol
"set the shapeStyle
- currently, only nil or #cartoon are supported"
+ currently, only nil, #cartoon or #cartoon2 are supported"
shapeStyle := aStyleSymbol.
self resizeToFit.
self computeShape.
"Created: 29.5.1996 / 15:39:41 / cg"
- "Modified: 29.5.1996 / 15:43:54 / cg"
+ "Modified: 28.6.1997 / 14:15:22 / cg"
!
withView:aView
@@ -188,103 +199,100 @@
|extent shapeForm borderForm y1 bw h w mirrorH mirrorV
p1 p2 p3 pB1 pB2 pB3 offs hEll|
- shapeStyle ~~ #cartoon ifTrue:[^ self].
-
- extent := self extent.
- h := extent y.
- w := extent x.
- bw := 4.
- offs := 0.
-
- self corner x > device width ifTrue:[
- mirrorH := true.
- self origin:((self origin x - w) @ (self origin y)).
- offs := bw * 2.
- ] ifFalse:[
- mirrorH := false
- ].
- self corner y > device height ifTrue:[
- mirrorV := true.
- self origin:(self origin x @ (self origin y - h)).
- ] ifFalse:[
- mirrorV := false
- ].
+ Display hasShape ifTrue:[
+ (shapeStyle == #cartoon) ifTrue:[
+ extent := self extent.
+ h := extent y.
+ w := extent x.
+ bw := 4.
+ offs := 0.
- borderForm := Form width:w height:h.
- shapeForm := Form width:w height:h.
- borderForm fill:(Color noColor).
- shapeForm fill:(Color noColor).
-
- hEll := (h // 3 * 2).
+ self corner x > device width ifTrue:[
+ mirrorH := true.
+ self origin:((self origin x - w) @ (self origin y)).
+ offs := bw * 2.
+ ] ifFalse:[
+ mirrorH := false
+ ].
+ self corner y > device height ifTrue:[
+ mirrorV := true.
+ self origin:(self origin x @ (self origin y - h)).
+ ] ifFalse:[
+ mirrorV := false
+ ].
- mirrorV ifTrue:[
- y1 := 0.
- ] ifFalse:[
- y1 := h // 4.
- ].
+ borderForm := Form width:w height:h.
+ shapeForm := Form width:w height:h.
+ borderForm fill:(Color noColor).
+ shapeForm fill:(Color noColor).
+
+ hEll := (h // 3 * 2).
- borderForm fillArcX:0
- y:y1
- width:w
- height:hEll
- from:0
- angle:360.
+ mirrorV ifTrue:[
+ y1 := 0.
+ ] ifFalse:[
+ y1 := h // 4.
+ ].
- myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
+ borderForm fillArcX:0 y:y1
+ width:w height:hEll
+ from:0 angle:360.
+
+ myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
- mirrorH ifTrue:[
- mirrorV ifTrue:[
- p1 := w @ h.
- p2 := ((w * 7 // 8) @ (h // 2)).
- p3 := ((w // 2) @ (h // 2)).
- pB1 := (w-bw) @ (h-bw).
- pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)).
- pB3 := ((w // 2 + bw) @ (h // 2 - bw))
- ] ifFalse:[
- p1 := w @ 0.
- p2 := ((w * 7 // 8) @ (h // 2)).
- p3 := ((w // 2) @ (h // 2)).
- pB1 := (w-bw) @ bw.
- pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)).
- pB3 := ((w // 2 + bw) @ (h // 2 + bw))
- ]
- ] ifFalse:[
- mirrorV ifTrue:[
- p1 := 0@h.
- p2 := ((w // 8) @ (h // 2)).
- p3 := ((w // 2) @ (h // 2)).
- pB1 := bw@(h-bw).
- pB2 := ((w // 8 + bw) @ (h // 2 - bw)).
- pB3 := ((w // 2 - bw) @ (h // 2 - bw)).
- ] ifFalse:[
- p1 := 0@0.
- p2 := ((w // 8) @ (h // 2)).
- p3 := ((w // 2) @ (h // 2)).
- pB1 := bw@bw.
- pB2 := ((w // 8 + bw) @ (h // 2 + bw)).
- pB3 := ((w // 2 - bw) @ (h // 2 + bw)).
- ]
- ].
+ mirrorH ifTrue:[
+ mirrorV ifTrue:[
+ p1 := w @ h.
+ p2 := ((w * 7 // 8) @ (h // 2)).
+ p3 := ((w // 2) @ (h // 2)).
+ pB1 := (w-bw) @ (h-bw).
+ pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)).
+ pB3 := ((w // 2 + bw) @ (h // 2 - bw))
+ ] ifFalse:[
+ p1 := w @ 0.
+ p2 := ((w * 7 // 8) @ (h // 2)).
+ p3 := ((w // 2) @ (h // 2)).
+ pB1 := (w-bw) @ bw.
+ pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)).
+ pB3 := ((w // 2 + bw) @ (h // 2 + bw))
+ ]
+ ] ifFalse:[
+ mirrorV ifTrue:[
+ p1 := 0@h.
+ p2 := ((w // 8) @ (h // 2)).
+ p3 := ((w // 2) @ (h // 2)).
+ pB1 := bw@(h-bw).
+ pB2 := ((w // 8 + bw) @ (h // 2 - bw)).
+ pB3 := ((w // 2 - bw) @ (h // 2 - bw)).
+ ] ifFalse:[
+ p1 := 0@0.
+ p2 := ((w // 8) @ (h // 2)).
+ p3 := ((w // 2) @ (h // 2)).
+ pB1 := bw@bw.
+ pB2 := ((w // 8 + bw) @ (h // 2 + bw)).
+ pB3 := ((w // 2 - bw) @ (h // 2 + bw)).
+ ]
+ ].
- borderForm fillPolygon:(Array with:p1 with:p2 with:p3).
- shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3).
+ borderForm fillPolygon:(Array with:p1 with:p2 with:p3).
+ shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3).
- shapeForm lineWidth:bw.
- shapeForm paint:(Color noColor).
- shapeForm displayPolygon:(Array with:p3 with:p1 with:p2).
+ shapeForm lineWidth:bw.
+ shapeForm paint:(Color noColor).
+ shapeForm displayPolygon:(Array with:p3 with:p1 with:p2).
- shapeForm paint:(Color colorId:1).
- shapeForm fillArcX:bw
- y:y1 + bw
- width:(w - (bw * 2))
- height:(h // 3 * 2 - (bw * 2))
- from:0
- angle:360.
+ shapeForm paint:(Color colorId:1).
+ shapeForm fillArcX:bw y:y1 + bw
+ width:(w - (bw * 2)) height:(h // 3 * 2 - (bw * 2))
+ from:0 angle:360.
+ ].
+ borderForm notNil ifTrue:[
+ self borderShape:borderForm.
+ self viewShape:shapeForm
+ ].
+ ]
- self borderShape:borderForm.
- self viewShape:shapeForm
-
- "Modified: 5.7.1996 / 17:59:05 / cg"
+ "Modified: 28.6.1997 / 14:23:39 / cg"
!
resizeToFit
@@ -303,7 +311,7 @@
self extent:pref
]
- "Modified: 29.5.1996 / 15:54:23 / cg"
+ "Modified: 28.6.1997 / 14:23:49 / cg"
! !
!ActiveHelpView methodsFor:'queries'!
@@ -319,5 +327,5 @@
!ActiveHelpView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.16 1997-01-22 17:17:33 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.17 1997-06-28 12:25:10 cg Exp $'
! !