author | Claus Gittinger <cg@exept.de> |
Fri, 22 Feb 2019 09:50:41 +0100 | |
changeset 4232 | a55135461bc3 |
parent 4137 | 1de7f929d6b5 |
child 4458 | 508be27574c1 |
permissions | -rw-r--r-- |
4115 | 1 |
"{ Encoding: utf8 }" |
2 |
||
60 | 3 |
" |
4 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3318 | 5 |
All Rights Reserved |
60 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
1485 | 14 |
"{ Package: 'stx:libview2' }" |
15 |
||
3502 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
60 | 18 |
View subclass:#ActiveHelpView |
3360 | 19 |
instanceVariableNames:'myView shapeStyle controllingHelpListener' |
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Help' |
|
60 | 23 |
! |
24 |
||
380 | 25 |
!ActiveHelpView class methodsFor:'documentation'! |
60 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
3318 | 30 |
All Rights Reserved |
60 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
||
40 |
||
138 | 41 |
! |
42 |
||
43 |
documentation |
|
44 |
" |
|
635 | 45 |
a bubbleHelp view. |
233 | 46 |
|
138 | 47 |
Instances of myself show up either as a comics-like talking |
48 |
view, or as a simple square popup. This is configured via the |
|
4128 | 49 |
styleSheet. The default is simple-square. |
50 |
||
233 | 51 |
To get the fancy comics style, add a resource 'activeHelpStyle' with |
4128 | 52 |
a symbol-value of #cartoon to the stylesheet, or set the overwrite |
53 |
in the userPrefs with: |
|
54 |
UserPreferences current toolTipShapeStyle:#cartoon. |
|
138 | 55 |
However, be aware that some servers have performance problems with |
4128 | 56 |
these view-shapes (or do not support shapes at all, like XQuartz on OSX). |
635 | 57 |
Therefore, the default style is a rectangular popupView. |
4128 | 58 |
If the prefs were changed, you can return back to the stylesheet's default with: |
59 |
UserPreferences current toolTipShapeStyle:nil. |
|
216 | 60 |
|
221 | 61 |
[author:] |
62 |
Claus Gittinger |
|
63 |
||
216 | 64 |
[See also:] |
65 |
ActiveHelp |
|
138 | 66 |
" |
60 | 67 |
! ! |
68 |
||
380 | 69 |
!ActiveHelpView class methodsFor:'instance creation'! |
60 | 70 |
|
71 |
for:someText |
|
635 | 72 |
"create a bubble-view for some text" |
233 | 73 |
|
1676 | 74 |
^ self for:someText onDevice:Screen current. |
75 |
||
76 |
" |
|
77 |
|v| |
|
78 |
||
79 |
v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil. |
|
80 |
v realize. |
|
81 |
Delay waitForSeconds:2. |
|
82 |
v destroy |
|
83 |
" |
|
84 |
||
85 |
" |
|
86 |
|v| |
|
87 |
||
88 |
v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon. |
|
89 |
v realize. |
|
90 |
Delay waitForSeconds:2. |
|
91 |
v destroy |
|
92 |
" |
|
93 |
||
94 |
"Modified: 28.6.1997 / 14:24:23 / cg" |
|
95 |
! |
|
96 |
||
97 |
for:someText onDevice:aDevice |
|
98 |
"create a bubble-view for some text" |
|
99 |
||
3654 | 100 |
|helpView textView textShown| |
60 | 101 |
|
1714
85cd314f0916
Fix ActiveHelp for foreign displays
Stefan Vogel <sv@exept.de>
parents:
1676
diff
changeset
|
102 |
helpView := self onDevice:aDevice. |
3768 | 103 |
someText isString ifFalse:[ |
104 |
textView := Label onDevice:aDevice. |
|
105 |
textView logo:someText. |
|
106 |
^ (helpView withView:textView) |
|
107 |
]. |
|
108 |
||
4137 | 109 |
((someText startsWith:'<html>' caseSensitive:false) |
110 |
or:[ (someText startsWith:'<body>' caseSensitive:false) |
|
111 |
or:[ (someText startsWith:'<!!doctype html ' caseSensitive:false) |
|
112 |
]]) ifTrue:[ |
|
3313 | 113 |
textView := HTMLView onDevice:aDevice. |
114 |
textView level:0. |
|
3318 | 115 |
textView extent:(600@400). |
3313 | 116 |
textView contents:someText. |
117 |
textView preferredExtent:(textView extentOfContents + 20 min:(Display extent * 2 // 3)). |
|
3318 | 118 |
textView extent:(textView extentOfContents + 20 min:(Display extent * 2 // 3)). |
119 |
textView contents:someText. |
|
3313 | 120 |
^ helpView withView:textView |
121 |
]. |
|
3655 | 122 |
|
123 |
textShown := someText. |
|
124 |
(textShown isString) ifTrue:[ |
|
125 |
textShown := textShown withoutTrailingSeparators. |
|
126 |
]. |
|
127 |
textView := Label onDevice:aDevice. |
|
3728 | 128 |
textView font:(helpView deviceFont). |
3655 | 129 |
^ (helpView withView:textView) contents:textShown |
60 | 130 |
|
131 |
" |
|
635 | 132 |
|v| |
285 | 133 |
|
635 | 134 |
v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:nil. |
135 |
v realize. |
|
136 |
Delay waitForSeconds:2. |
|
137 |
v destroy |
|
60 | 138 |
" |
233 | 139 |
|
635 | 140 |
" |
141 |
|v| |
|
142 |
||
143 |
v := (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) shapeStyle:#cartoon. |
|
144 |
v realize. |
|
145 |
Delay waitForSeconds:2. |
|
146 |
v destroy |
|
147 |
" |
|
148 |
||
3939 | 149 |
"Modified: / 06-03-2017 / 18:56:24 / cg" |
4137 | 150 |
"Modified: / 29-06-2018 / 11:47:11 / Claus Gittinger" |
60 | 151 |
! |
152 |
||
153 |
with:aView |
|
233 | 154 |
"create a talking-view wrapping some other view" |
155 |
||
60 | 156 |
^ self new withView:aView |
157 |
||
158 |
" |
|
159 |
(ActiveHelpView with:(TextView new)) realize |
|
160 |
(ActiveHelpView with:(TextView new)) open |
|
161 |
(ActiveHelpView with:(Button label:'ok')) open |
|
162 |
" |
|
233 | 163 |
|
164 |
"Modified: 27.4.1996 / 15:14:18 / cg" |
|
60 | 165 |
! ! |
166 |
||
4115 | 167 |
!ActiveHelpView class methodsFor:'updateStyleCache'! |
168 |
||
169 |
updateStyleCache |
|
4128 | 170 |
<resource: #style (#'activeHelp.font')> |
171 |
||
4115 | 172 |
super updateStyleCache. |
173 |
DefaultFont := StyleSheet fontAt:#'activeHelp.font' default:nil. |
|
174 |
||
175 |
"Created: / 07-06-2018 / 18:25:51 / Claus Gittinger" |
|
4128 | 176 |
"Modified: / 14-06-2018 / 08:38:04 / Claus Gittinger" |
4115 | 177 |
! ! |
178 |
||
138 | 179 |
!ActiveHelpView methodsFor:'accessing'! |
180 |
||
181 |
contents:someText |
|
233 | 182 |
"set the text" |
183 |
||
138 | 184 |
(myView isKindOf:Label) ifTrue:[ |
3963 | 185 |
myView label:someText asString withTabsExpanded. |
233 | 186 |
myView extent:(myView preferredExtent). |
138 | 187 |
] ifFalse:[ |
233 | 188 |
myView contents:someText. |
138 | 189 |
]. |
190 |
self resizeToFit |
|
191 |
||
3963 | 192 |
"Modified: / 13-07-2017 / 14:51:59 / cg" |
138 | 193 |
! |
60 | 194 |
|
3250
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
195 |
controllingHelpListener:something |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
196 |
controllingHelpListener := something. |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
197 |
! |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
198 |
|
285 | 199 |
shapeStyle:aStyleSymbol |
3218 | 200 |
"set the shapeStyle. |
201 |
Currently, only nil and #cartoon are supported" |
|
285 | 202 |
|
203 |
shapeStyle := aStyleSymbol. |
|
3246 | 204 |
Screen current supportsArbitraryShapedViews ifFalse:[ |
205 |
shapeStyle := nil |
|
206 |
]. |
|
285 | 207 |
self resizeToFit. |
208 |
self computeShape. |
|
209 |
||
210 |
"Created: 29.5.1996 / 15:39:41 / cg" |
|
635 | 211 |
"Modified: 28.6.1997 / 14:15:22 / cg" |
285 | 212 |
! |
213 |
||
138 | 214 |
withView:aView |
233 | 215 |
"set the component view" |
216 |
||
3118 | 217 |
|fg| |
218 |
||
138 | 219 |
(aView isKindOf:Label) ifTrue:[ |
233 | 220 |
aView viewBackground:viewBackground. |
221 |
aView backgroundColor:viewBackground. |
|
3118 | 222 |
(fg := styleSheet colorAt:#'activeHelp.foregroundColor' default:nil) notNil ifTrue:[ |
223 |
aView foregroundColor:fg. |
|
224 |
]. |
|
3313 | 225 |
] ifFalse:[ |
226 |
(aView isKindOf:HTMLView) ifTrue:[ |
|
3393 | 227 |
aView scrolledView |
228 |
viewBackground:viewBackground; |
|
229 |
backgroundColor:viewBackground. |
|
3313 | 230 |
aView style viewBGColor:viewBackground. |
3393 | 231 |
"/ Transcript showCR:aView scrolledView preferredExtent. |
3313 | 232 |
]. |
138 | 233 |
]. |
234 |
self addSubView:aView. |
|
235 |
myView := aView. |
|
4115 | 236 |
myView borderWidth:0. |
233 | 237 |
|
4115 | 238 |
"Modified: / 27-04-1996 / 15:16:46 / cg" |
239 |
"Modified: / 07-06-2018 / 18:37:35 / Claus Gittinger" |
|
138 | 240 |
! ! |
241 |
||
3250
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
242 |
!ActiveHelpView methodsFor:'event handling'! |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
243 |
|
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
244 |
keyPress:key x:x y:y |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
245 |
controllingHelpListener hideHelp |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
246 |
! ! |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
247 |
|
138 | 248 |
!ActiveHelpView methodsFor:'initialization'! |
249 |
||
92 | 250 |
initStyle |
380 | 251 |
"setup viewStyle specifics" |
252 |
||
725 | 253 |
<resource: #style (#'activeHelp.backgroundColor' |
254 |
#'activeHelp.borderWidth' |
|
3502 | 255 |
#'activeHelp.borderColor' |
1537 | 256 |
#'activeHelp.font' |
725 | 257 |
#'activeHelp.style')> |
285 | 258 |
|
2776
7181bb9659ae
comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
259 |
|bg defaultFont| |
236 | 260 |
|
92 | 261 |
super initStyle. |
262 |
||
3218 | 263 |
(shapeStyle := UserPreferences current toolTipShapeStyle) isNil ifTrue:[ |
264 |
shapeStyle := styleSheet at:#'activeHelp.style' default:nil. |
|
265 |
]. |
|
266 |
||
3360 | 267 |
defaultFont := self class defaultFont. |
268 |
defaultFont isNil ifTrue:[ |
|
269 |
defaultFont := styleSheet fontAt:#'activeHelp.font' default:nil. |
|
270 |
]. |
|
2776
7181bb9659ae
comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
271 |
defaultFont notNil ifTrue:[ |
7181bb9659ae
comment/format in: #withView:
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
272 |
self font:defaultFont |
1537 | 273 |
]. |
274 |
||
1583
36d82eed6873
Use #isWindowsStyle instead of comparing to style name.
Stefan Vogel <sv@exept.de>
parents:
1537
diff
changeset
|
275 |
bg := styleSheet colorAt:#'activeHelp.backgroundColor' default:nil. |
285 | 276 |
bg notNil ifTrue:[ |
277 |
viewBackground := bg |
|
278 |
] ifFalse:[ |
|
279 |
shapeStyle == #cartoon ifTrue:[ |
|
3288 | 280 |
viewBackground := self whiteColor. |
285 | 281 |
] |
282 |
]. |
|
2773
eaec2e45bd8d
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
283 |
self borderWidth:(styleSheet at:#'activeHelp.borderWidth' default:1). |
3288 | 284 |
self borderColor:(styleSheet at:#'activeHelp.borderColor' default:self blackColor). |
236 | 285 |
|
725 | 286 |
"Modified: / 26.10.1997 / 17:02:09 / cg" |
92 | 287 |
! |
288 |
||
138 | 289 |
realize |
290 |
self create. |
|
291 |
self computeShape. |
|
292 |
self enableMotionEvents. |
|
293 |
self enableButtonMotionEvents. |
|
1485 | 294 |
super realize |
60 | 295 |
! ! |
296 |
||
297 |
!ActiveHelpView methodsFor:'private'! |
|
298 |
||
299 |
computeShape |
|
233 | 300 |
"compute the shape, based upon the size of my component view" |
301 |
||
3224 | 302 |
|extent oldOrigin shapeForm borderForm y1 bw h w mirrorH mirrorV |
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
303 |
p1 p2 p3 pB1 pB2 pB3 offs hEll h2 w2 w8 w78 mousePosition graphicsDevice| |
60 | 304 |
|
4081 | 305 |
(shapeStyle ~~ #cartoon) ifTrue:[ |
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
306 |
^ self. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
307 |
]. |
3625 | 308 |
graphicsDevice := device. |
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
309 |
graphicsDevice supportsArbitraryShapedViews ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
310 |
extent := self extent. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
311 |
oldOrigin := self origin. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
312 |
h := extent y. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
313 |
w := extent x. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
314 |
bw := 4. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
315 |
offs := 0. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
316 |
mousePosition := graphicsDevice pointerPosition. |
60 | 317 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
318 |
((mousePosition > (graphicsDevice width * (2/3))) |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
319 |
or:[ self corner x > graphicsDevice usableWidth ]) ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
320 |
mirrorH := true. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
321 |
self origin:((oldOrigin x - w) @ (self origin y)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
322 |
offs := bw * 2. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
323 |
] ifFalse:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
324 |
mirrorH := false |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
325 |
]. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
326 |
((mousePosition > (graphicsDevice height * (2/3))) |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
327 |
or:[ self corner y > graphicsDevice usableHeight ]) ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
328 |
mirrorV := true. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
329 |
self origin:(oldOrigin x @ (self origin y - h)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
330 |
] ifFalse:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
331 |
mirrorV := false |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
332 |
]. |
285 | 333 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
334 |
borderForm := Form width:w height:h. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
335 |
shapeForm := Form width:w height:h. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
336 |
borderForm fill:(Color noColor). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
337 |
shapeForm fill:(Color noColor). |
635 | 338 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
339 |
hEll := (h // 3 * 2). |
60 | 340 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
341 |
mirrorV ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
342 |
y1 := 0. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
343 |
] ifFalse:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
344 |
y1 := h // 4. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
345 |
]. |
60 | 346 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
347 |
borderForm fillArcX:0 y:y1 |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
348 |
width:w height:hEll |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
349 |
from:0 angle:360. |
635 | 350 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
351 |
myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)). |
1182 | 352 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
353 |
h2 := h // 2. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
354 |
w2 := w // 2. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
355 |
w8 := w // 8. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
356 |
w78 := w * 7 // 8. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
357 |
|
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
358 |
mirrorH ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
359 |
mirrorV ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
360 |
p1 := w @ h. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
361 |
p2 := (w78 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
362 |
p3 := (w2 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
363 |
pB1 := (w-bw) @ (h-bw). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
364 |
pB2 := ((w78 - bw) @ (h2 - bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
365 |
pB3 := ((w2 + bw) @ (h2 - bw)) |
635 | 366 |
] ifFalse:[ |
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
367 |
p1 := w @ 0. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
368 |
p2 := (w78 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
369 |
p3 := (w2 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
370 |
pB1 := (w-bw) @ bw. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
371 |
pB2 := ((w78 - bw) @ (h2 + bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
372 |
pB3 := ((w2 + bw) @ (h2 + bw)) |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
373 |
] |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
374 |
] ifFalse:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
375 |
mirrorV ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
376 |
p1 := 0@h. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
377 |
p2 := (w8 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
378 |
p3 := (w2 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
379 |
pB1 := bw@(h-bw). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
380 |
pB2 := ((w8 + bw) @ (h2 - bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
381 |
pB3 := ((w2 - bw) @ (h2 - bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
382 |
] ifFalse:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
383 |
p1 := 0@0. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
384 |
p2 := (w8 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
385 |
p3 := (w2 @ h2). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
386 |
pB1 := bw@bw. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
387 |
pB2 := ((w8 + bw) @ (h2 + bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
388 |
pB3 := ((w2 - bw) @ (h2 + bw)). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
389 |
] |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
390 |
]. |
60 | 391 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
392 |
borderForm fillPolygon:(Array with:p1 with:p2 with:p3). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
393 |
shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3). |
60 | 394 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
395 |
shapeForm lineWidth:bw. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
396 |
shapeForm paint:(Color noColor). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
397 |
shapeForm displayPolygon:(Array with:p3 with:p1 with:p2). |
60 | 398 |
|
3316
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
399 |
shapeForm paint:(Color colorId:1). |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
400 |
shapeForm fillArcX:bw y:y1 + bw |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
401 |
width:(w - (bw * 2)) height:(h // 3 * 2 - (bw * 2)) |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
402 |
from:0 angle:360. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
403 |
]. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
404 |
borderForm notNil ifTrue:[ |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
405 |
self borderShape:borderForm. |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
406 |
self viewShape:shapeForm |
cbfe39899129
Access graphicsDevice via method send instead of instVar access
Stefan Vogel <sv@exept.de>
parents:
3314
diff
changeset
|
407 |
]. |
60 | 408 |
|
4081 | 409 |
"Modified: / 05-06-1999 / 21:41:01 / cg" |
410 |
"Modified: / 16-04-2018 / 11:43:55 / stefan" |
|
60 | 411 |
! |
412 |
||
413 |
resizeToFit |
|
233 | 414 |
"resize myself to make the component view fit" |
415 |
||
3223 | 416 |
|h w pref bw| |
60 | 417 |
|
285 | 418 |
pref := myView preferredExtent. |
419 |
shapeStyle == #cartoon ifTrue:[ |
|
420 |
h := pref y. |
|
421 |
w := pref x. |
|
3223 | 422 |
self extent:((w / 0.85) @ (h * 4)) rounded. |
92 | 423 |
] ifFalse:[ |
3223 | 424 |
bw := self borderWidth. |
425 |
self extent:(pref + (bw * 2)). |
|
426 |
myView origin:(bw asPoint). |
|
92 | 427 |
] |
233 | 428 |
|
635 | 429 |
"Modified: 28.6.1997 / 14:23:49 / cg" |
233 | 430 |
! ! |
431 |
||
432 |
!ActiveHelpView methodsFor:'queries'! |
|
433 |
||
434 |
isPopUpView |
|
261 | 435 |
"return true - I am a popUp type of view (no decoration, pop-to-top)" |
233 | 436 |
|
437 |
^ true |
|
438 |
||
261 | 439 |
"Modified: 12.5.1996 / 21:58:12 / cg" |
3250
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
440 |
! |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
441 |
|
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
442 |
wantsFocusWithButtonPress |
276f1af4583b
handle key press and close help.
Claus Gittinger <cg@exept.de>
parents:
3249
diff
changeset
|
443 |
^ false |
60 | 444 |
! ! |
445 |
||
380 | 446 |
!ActiveHelpView class methodsFor:'documentation'! |
60 | 447 |
|
138 | 448 |
version |
3502 | 449 |
^ '$Header$' |
2773
eaec2e45bd8d
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
450 |
! |
eaec2e45bd8d
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
451 |
|
eaec2e45bd8d
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2413
diff
changeset
|
452 |
version_CVS |
3502 | 453 |
^ '$Header$' |
60 | 454 |
! ! |
3118 | 455 |