3792
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
3700
|
3 |
"{ Package: 'stx:libtool2' }"
|
|
4 |
|
|
5 |
"{ NameSpace: Smalltalk }"
|
|
6 |
|
|
7 |
Object subclass:#ShowMeHowItWorks
|
3783
|
8 |
instanceVariableNames:'application opStream streamStack lastComponentName lastComponent
|
|
9 |
lastResult voice translate language verifying
|
3795
|
10 |
closeApplicationWhenFinished defaultComponentWaitTime ui
|
3803
|
11 |
theShowFile defaultElementTimeout applicationStack'
|
3790
|
12 |
classVariableNames:'IntroShownCount DebugMode StartLabel'
|
3700
|
13 |
poolDictionaries:''
|
|
14 |
category:'Interface-Help'
|
|
15 |
!
|
|
16 |
|
3796
|
17 |
Object subclass:#ItemInView
|
|
18 |
instanceVariableNames:'view item boundsInView'
|
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
|
21 |
privateIn:ShowMeHowItWorks
|
|
22 |
!
|
|
23 |
|
3700
|
24 |
!ShowMeHowItWorks class methodsFor:'documentation'!
|
|
25 |
|
|
26 |
documentation
|
|
27 |
"
|
3713
|
28 |
automatic presentations.
|
|
29 |
To see how it works, open a methodFinder:
|
|
30 |
MethodFinderWindow open
|
|
31 |
and select its 'Show me how it works' item in the help menu.
|
3700
|
32 |
|
|
33 |
[author:]
|
|
34 |
Claus Gittinger
|
|
35 |
"
|
|
36 |
!
|
|
37 |
|
|
38 |
example
|
3713
|
39 |
MethodFinderWindow open.
|
|
40 |
|
3700
|
41 |
ShowMeHowItWorks do:#(
|
|
42 |
( showing: 'Choose the number of arguments' do:(
|
|
43 |
moveTo: NumberOfArguments
|
|
44 |
select: '1'
|
|
45 |
))
|
|
46 |
(showing: 'Click into the "receiver" field' do:(
|
|
47 |
moveTo: ReceiverEditor
|
|
48 |
click: ReceiverEditor
|
|
49 |
))
|
|
50 |
(showing: 'Enter a value (or expression) into "receiver" field' do:(
|
|
51 |
enter: '100'
|
|
52 |
))
|
|
53 |
(showing: 'Click into the "first argument" field' do:(
|
|
54 |
moveTo: Arg1Editor
|
|
55 |
click: ReceiverEditor
|
|
56 |
))
|
|
57 |
(showing: 'Enter a value (or expression) into "receiver" field' do:(
|
|
58 |
enter: '100'
|
|
59 |
))
|
|
60 |
|
|
61 |
)
|
3795
|
62 |
!
|
|
63 |
|
|
64 |
scriptFormat
|
|
65 |
"
|
|
66 |
|
|
67 |
speaking:
|
|
68 |
show: 'text'
|
|
69 |
|
|
70 |
mouse movement:
|
|
71 |
moveTo: '<component>' move there and circle around
|
|
72 |
fastMoveTo: '<component>' move without circling
|
|
73 |
(drag: '<fromComponent>' toComponent: '<toComponent>' dropAt:<pos> show:'text')
|
|
74 |
pos is one of #topLeft, #topCenter, #topRght, #bottomLeft, #bottomCenter, #bottomRight
|
|
75 |
text is spoken before the drop
|
|
76 |
|
|
77 |
mouse actions:
|
|
78 |
click
|
|
79 |
click: buttonNumber
|
|
80 |
select: itemsIndexOrLabelOrPattern
|
|
81 |
itemsIndexOrLabelOrPattern can be an integer or text
|
|
82 |
|
|
83 |
misc:
|
|
84 |
wait: seconds just pause
|
|
85 |
|
|
86 |
label: 'name' for debugging, presentation can be started at some
|
|
87 |
label, by setting the StartLabel class variable
|
|
88 |
|
|
89 |
(waitFor: '<component>' timeout:seconds)
|
|
90 |
wait for a component to appear
|
|
91 |
|
|
92 |
open 'nameOfAppModelClass'
|
|
93 |
open an application (class)
|
3799
|
94 |
|
|
95 |
raise 'application'
|
|
96 |
raise 'masterApplication'
|
|
97 |
|
3795
|
98 |
intro
|
|
99 |
|
|
100 |
component naming:
|
|
101 |
'<component>' can be:
|
|
102 |
name of a component, as defined in the UI-spec's nameKey,
|
|
103 |
helpKey
|
|
104 |
title
|
|
105 |
label
|
|
106 |
|
|
107 |
a path like 'ProjectTree/ToolBar' will first find ProjectTrue, then ToolBar
|
|
108 |
a menu item index like 'Toolbar/item[idx]'
|
|
109 |
|
|
110 |
|
|
111 |
"
|
3700
|
112 |
! !
|
|
113 |
|
|
114 |
!ShowMeHowItWorks class methodsFor:'running'!
|
|
115 |
|
3775
|
116 |
application:anApplicationOrNilForAll do:specArray
|
|
117 |
"spec contains a list of action commands (show: / moveTo: etc.)"
|
|
118 |
|
|
119 |
self new
|
|
120 |
application:anApplicationOrNilForAll;
|
|
121 |
do:specArray
|
|
122 |
|
|
123 |
"
|
|
124 |
ShowMeHowItWorks do:
|
|
125 |
#(
|
|
126 |
(language: de)
|
3792
|
127 |
(show: 'üben üben üben')
|
3775
|
128 |
(wait: 0.5)
|
|
129 |
(moveTo: NameOfComponent)
|
|
130 |
)
|
|
131 |
"
|
|
132 |
|
|
133 |
"Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
|
|
134 |
"Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
|
|
135 |
!
|
|
136 |
|
3795
|
137 |
application:anApplicationOrNilForAll doShowFile:aFilename
|
|
138 |
"spec contains a list of action commands (show: / moveTo: etc.)"
|
|
139 |
|
|
140 |
self new
|
|
141 |
application:anApplicationOrNilForAll;
|
|
142 |
doShowFile:aFilename
|
|
143 |
|
|
144 |
"
|
|
145 |
ShowMeHowItWorks do:
|
|
146 |
#(
|
|
147 |
(language: de)
|
|
148 |
(show: 'üben üben üben')
|
|
149 |
(wait: 0.5)
|
|
150 |
(moveTo: NameOfComponent)
|
|
151 |
)
|
|
152 |
"
|
|
153 |
|
|
154 |
"Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
|
|
155 |
"Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
|
|
156 |
!
|
|
157 |
|
3700
|
158 |
do:specArray
|
3728
|
159 |
"spec contains a list of action commands (show: / moveTo: etc.)"
|
3727
|
160 |
|
3784
|
161 |
self do:specArray withUI:false
|
3700
|
162 |
|
3727
|
163 |
"
|
|
164 |
ShowMeHowItWorks do:
|
|
165 |
#(
|
3728
|
166 |
(language: de)
|
3792
|
167 |
(show: 'üben üben üben')
|
3728
|
168 |
(wait: 0.5)
|
3727
|
169 |
(moveTo: NameOfComponent)
|
|
170 |
)
|
|
171 |
"
|
|
172 |
|
|
173 |
"Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
|
3728
|
174 |
"Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
|
3784
|
175 |
!
|
|
176 |
|
3787
|
177 |
do:specArray from:startLabelOrNil withUI:withUIBoolean
|
|
178 |
"spec contains a list of action commands (show: / moveTo: etc.)"
|
|
179 |
|
|
180 |
self new
|
|
181 |
do:specArray
|
|
182 |
from:startLabelOrNil
|
|
183 |
withUI:withUIBoolean
|
|
184 |
|
|
185 |
"
|
|
186 |
ShowMeHowItWorks
|
|
187 |
do:#(
|
|
188 |
(language: de)
|
3792
|
189 |
(show: 'üben üben üben')
|
3787
|
190 |
(wait: 0.5)
|
|
191 |
(moveTo: NameOfComponent)
|
|
192 |
)
|
|
193 |
withUI:true
|
|
194 |
"
|
|
195 |
|
|
196 |
"Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
|
|
197 |
"Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
|
|
198 |
!
|
|
199 |
|
3784
|
200 |
do:specArray withUI:withUIBoolean
|
|
201 |
"spec contains a list of action commands (show: / moveTo: etc.)"
|
|
202 |
|
|
203 |
self new do:specArray withUI:withUIBoolean
|
|
204 |
|
|
205 |
"
|
|
206 |
ShowMeHowItWorks
|
|
207 |
do:#(
|
|
208 |
(language: de)
|
3792
|
209 |
(show: 'üben üben üben')
|
3784
|
210 |
(wait: 0.5)
|
|
211 |
(moveTo: NameOfComponent)
|
|
212 |
)
|
|
213 |
withUI:true
|
|
214 |
"
|
|
215 |
|
|
216 |
"Created: / 19-07-2019 / 10:52:59 / Claus Gittinger"
|
|
217 |
"Modified (comment): / 23-07-2019 / 10:26:42 / Claus Gittinger"
|
3713
|
218 |
! !
|
|
219 |
|
|
220 |
!ShowMeHowItWorks methodsFor:'accessing'!
|
|
221 |
|
3775
|
222 |
application:anApplication
|
3803
|
223 |
"if set, only that application is presented (widget search is limited to that one)"
|
3775
|
224 |
|
|
225 |
application := anApplication.
|
3795
|
226 |
!
|
|
227 |
|
|
228 |
setLanguage:lang
|
|
229 |
voice := OperatingSystem bestVoiceForLanguage:lang.
|
|
230 |
language := lang.
|
|
231 |
|
|
232 |
"Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
|
3700
|
233 |
! !
|
|
234 |
|
|
235 |
!ShowMeHowItWorks methodsFor:'commands'!
|
|
236 |
|
3804
|
237 |
closeApplication
|
|
238 |
<action>
|
|
239 |
|
|
240 |
application closeRequest.
|
|
241 |
!
|
|
242 |
|
3798
|
243 |
freezePin:pinName ofStep:stepName with:freezeString
|
|
244 |
<action>
|
|
245 |
|
|
246 |
|diagramEditor pinPO|
|
|
247 |
|
|
248 |
(diagramEditor := lastComponent) isScrollWrapper ifTrue:[
|
|
249 |
diagramEditor := lastComponent scrolledView
|
|
250 |
].
|
3799
|
251 |
pinPO := self pinPOForPin:pinName ofStep:stepName.
|
|
252 |
|
3798
|
253 |
diagramEditor selection:{ pinPO }.
|
|
254 |
diagramEditor doubleClickOn:pinPO.
|
|
255 |
self fastMoveTo:(lastComponentName,'/','EditField').
|
|
256 |
self click.
|
3800
|
257 |
self clear.
|
3798
|
258 |
self type:freezeString.
|
|
259 |
self key:#Return.
|
|
260 |
!
|
|
261 |
|
3711
|
262 |
intro
|
|
263 |
<action>
|
3724
|
264 |
|
3775
|
265 |
verifying ifTrue:[^ self].
|
|
266 |
|
|
267 |
IntroShownCount := (IntroShownCount ? 0).
|
|
268 |
|
3728
|
269 |
"/ only say this a few times..
|
|
270 |
IntroShownCount > 3 ifTrue:[^ self].
|
3775
|
271 |
IntroShownCount := IntroShownCount + 1.
|
|
272 |
|
3795
|
273 |
language isNil ifTrue:[
|
|
274 |
self setLanguage:(Smalltalk language).
|
|
275 |
].
|
3724
|
276 |
self tell:(self class classResources
|
3733
|
277 |
string:'You can stop this show, by pressing the SHIFT key').
|
3711
|
278 |
|
|
279 |
"Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
|
3733
|
280 |
"Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
|
3728
|
281 |
!
|
|
282 |
|
3787
|
283 |
label:nameOfLabel
|
|
284 |
<action>
|
|
285 |
|
|
286 |
"/ skipped here; see goto
|
|
287 |
!
|
|
288 |
|
3728
|
289 |
language:lang
|
|
290 |
<action>
|
|
291 |
|
3795
|
292 |
self setLanguage:lang.
|
3728
|
293 |
translate := false.
|
|
294 |
|
|
295 |
"Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
|
3711
|
296 |
!
|
|
297 |
|
3780
|
298 |
open:applicationClassName
|
|
299 |
<action>
|
|
300 |
|
|
301 |
|appClass|
|
|
302 |
|
|
303 |
(appClass := Smalltalk classNamed:applicationClassName) isNil ifTrue:[
|
|
304 |
self error:'no such application class'
|
|
305 |
].
|
|
306 |
verifying ifFalse:[
|
|
307 |
application := appClass new openAndWaitUntilVisible.
|
|
308 |
closeApplicationWhenFinished := true.
|
|
309 |
].
|
|
310 |
|
|
311 |
"Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
|
|
312 |
!
|
|
313 |
|
3700
|
314 |
pause
|
|
315 |
<action>
|
|
316 |
|
3724
|
317 |
Dialog information:(self class classResources
|
|
318 |
stringWithCRs:'Show Paused.\Click on "OK" to proceed')
|
3700
|
319 |
|
|
320 |
"Created: / 19-07-2019 / 15:03:17 / Claus Gittinger"
|
3711
|
321 |
"Modified: / 19-07-2019 / 16:13:33 / Claus Gittinger"
|
3700
|
322 |
!
|
|
323 |
|
3803
|
324 |
popApplication
|
|
325 |
<action>
|
|
326 |
|
|
327 |
"go back to the previous app"
|
|
328 |
|
|
329 |
application := applicationStack removeLast.
|
|
330 |
!
|
|
331 |
|
|
332 |
pushApplication:newApplicationOrName
|
|
333 |
<action>
|
|
334 |
|
|
335 |
"goto another app, remembering where we were before"
|
|
336 |
|
|
337 |
|newApplication|
|
|
338 |
|
|
339 |
(newApplication := newApplicationOrName) isString ifTrue:[
|
|
340 |
newApplication := self findApplication:newApplicationOrName ifMultiple:nil.
|
|
341 |
self assert: newApplication notNil.
|
|
342 |
].
|
|
343 |
|
|
344 |
applicationStack isNil ifTrue:[applicationStack := OrderedCollection new].
|
|
345 |
|
|
346 |
applicationStack add:application.
|
|
347 |
self application:newApplication.
|
|
348 |
!
|
|
349 |
|
3776
|
350 |
raise:what
|
|
351 |
<action>
|
|
352 |
|
|
353 |
verifying ifTrue:[^ self].
|
|
354 |
|
|
355 |
what == #application ifTrue:[
|
|
356 |
application topView raise.
|
|
357 |
^ self
|
|
358 |
].
|
|
359 |
what == #masterApplication ifTrue:[
|
|
360 |
application windowGroup isModal ifTrue:[
|
|
361 |
application windowGroup mainGroup topViews first raise
|
|
362 |
] ifFalse:[
|
|
363 |
(application masterApplication ? application) topViews first raise.
|
|
364 |
].
|
|
365 |
^ self
|
|
366 |
].
|
|
367 |
self halt.
|
|
368 |
!
|
|
369 |
|
3798
|
370 |
selectPin:pinName ofStep:stepName
|
|
371 |
<action>
|
|
372 |
|
3800
|
373 |
|diagramEditor pinPO count|
|
3798
|
374 |
|
|
375 |
(diagramEditor := lastComponent) isScrollWrapper ifTrue:[
|
|
376 |
diagramEditor := lastComponent scrolledView
|
|
377 |
].
|
3800
|
378 |
|
|
379 |
count := 0.
|
|
380 |
[
|
|
381 |
Delay waitForSeconds:0.1.
|
|
382 |
pinPO := self pinPOForPin:pinName ofStep:stepName.
|
|
383 |
] doWhile:[pinPO isNil and:[ (count := count+1) < 20]].
|
|
384 |
|
|
385 |
self movePointerToComponent:diagramEditor offset:(pinPO frame center).
|
3799
|
386 |
diagramEditor selection:{ pinPO }.
|
3798
|
387 |
!
|
|
388 |
|
3711
|
389 |
show:message
|
3714
|
390 |
"showing (and speak) some message."
|
3711
|
391 |
|
|
392 |
<action>
|
|
393 |
|
3776
|
394 |
self showing:message saying:nil do:nil
|
3711
|
395 |
|
|
396 |
"Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
|
3714
|
397 |
"Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
|
|
398 |
!
|
|
399 |
|
|
400 |
show:message for:seconds
|
|
401 |
"showing (and speak) some message and wait for some time."
|
|
402 |
|
|
403 |
<action>
|
3780
|
404 |
|
|
405 |
DebugMode == true ifTrue:[^ self].
|
|
406 |
|
3714
|
407 |
self show:message.
|
|
408 |
self wait:seconds.
|
|
409 |
|
|
410 |
"Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
|
3711
|
411 |
!
|
|
412 |
|
3776
|
413 |
show:message saying:sentenceOrNil
|
|
414 |
"showing (and speak) some message."
|
|
415 |
|
|
416 |
<action>
|
|
417 |
|
|
418 |
self showing:message saying:sentenceOrNil do:nil
|
|
419 |
|
|
420 |
"Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
|
|
421 |
"Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
|
|
422 |
!
|
|
423 |
|
|
424 |
show:message saying:sentenceOrNil for:seconds
|
|
425 |
"showing (and speak) some message and wait for some time."
|
|
426 |
|
|
427 |
<action>
|
|
428 |
|
3780
|
429 |
DebugMode == true ifTrue:[^ self].
|
3776
|
430 |
self show:message saying:sentenceOrNil.
|
|
431 |
self wait:seconds.
|
|
432 |
|
|
433 |
"Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
|
|
434 |
!
|
|
435 |
|
3711
|
436 |
showing:message do:operationsOrNothing
|
3714
|
437 |
"execute operationsOrNothing while showing (and speaking) some message."
|
3700
|
438 |
|
|
439 |
<action>
|
|
440 |
|
3776
|
441 |
self showing:message saying:nil do:operationsOrNothing
|
|
442 |
!
|
|
443 |
|
|
444 |
showing:message saying:sentenceOrNil do:operationsOrNothing
|
|
445 |
"execute operationsOrNothing while showing (and speaking) some message."
|
|
446 |
|
|
447 |
<action>
|
|
448 |
|
3715
|
449 |
|xLatedMessage messageView talkDone|
|
3700
|
450 |
|
3728
|
451 |
xLatedMessage := (translate and:[application notNil])
|
3803
|
452 |
ifTrue:[application resources stringWithCRs:message]
|
|
453 |
ifFalse:[message withCRs].
|
3728
|
454 |
|
3711
|
455 |
self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
|
3700
|
456 |
|
3715
|
457 |
messageView := ActiveHelpView for:xLatedMessage.
|
3700
|
458 |
"/ messageView shapeStyle:#cartoon.
|
|
459 |
[
|
3804
|
460 |
|p top left bot right w h|
|
|
461 |
|
|
462 |
w := messageView preferredExtent x.
|
|
463 |
h := messageView preferredExtent y.
|
|
464 |
|
|
465 |
p := Screen current pointerPosition.
|
|
466 |
left := p x. top := p y.
|
|
467 |
bot := top + h. right := left + w.
|
|
468 |
|
|
469 |
messageView origin:(left @ top).
|
3780
|
470 |
messageView makeFullyVisible.
|
3700
|
471 |
messageView realize.
|
|
472 |
|
|
473 |
self talking ifTrue:[
|
|
474 |
talkDone := Semaphore new.
|
|
475 |
[
|
3815
|
476 |
|sentence|
|
|
477 |
sentence := (sentenceOrNil ? xLatedMessage) copy withCRs replaceAny:c'\t' with:(Character space).
|
3776
|
478 |
self tell:(sentenceOrNil ? xLatedMessage).
|
3700
|
479 |
talkDone signal
|
|
480 |
] fork.
|
|
481 |
|
|
482 |
"/
|
|
483 |
"/ allow speaker some headoff
|
3775
|
484 |
verifying ifFalse:[
|
|
485 |
Delay waitForSeconds:(xLatedMessage size / 15)+0.5.
|
|
486 |
].
|
3700
|
487 |
].
|
|
488 |
|
3711
|
489 |
operationsOrNothing notEmptyOrNil ifTrue:[
|
|
490 |
self doStream:(operationsOrNothing readStream).
|
|
491 |
].
|
3700
|
492 |
] ensure:[
|
|
493 |
messageView destroy
|
|
494 |
].
|
|
495 |
self talking ifTrue:[
|
|
496 |
talkDone wait.
|
|
497 |
].
|
|
498 |
|
|
499 |
"Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
|
3728
|
500 |
"Modified: / 23-07-2019 / 10:52:30 / Claus Gittinger"
|
|
501 |
!
|
|
502 |
|
|
503 |
thankyou
|
|
504 |
<action>
|
|
505 |
|
|
506 |
self show:(self randomThankYou).
|
|
507 |
|
|
508 |
"Created: / 23-07-2019 / 10:50:43 / Claus Gittinger"
|
3700
|
509 |
!
|
|
510 |
|
3799
|
511 |
timeout:seconds
|
|
512 |
<action>
|
|
513 |
|
|
514 |
defaultElementTimeout := seconds.
|
|
515 |
|
|
516 |
"Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
|
|
517 |
!
|
|
518 |
|
3700
|
519 |
wait:seconds
|
|
520 |
<action>
|
|
521 |
|
3775
|
522 |
verifying ifTrue:[^ self].
|
3780
|
523 |
DebugMode == true ifTrue:[^ self].
|
3776
|
524 |
Display ctrlDown ifTrue:[^ self].
|
|
525 |
|
3700
|
526 |
Delay waitForSeconds:seconds
|
|
527 |
|
|
528 |
"Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
|
3780
|
529 |
!
|
|
530 |
|
|
531 |
waitFor:componentName timeout:seconds
|
|
532 |
<action>
|
|
533 |
|
3799
|
534 |
|endTime component|
|
3780
|
535 |
|
3781
|
536 |
verifying ifTrue:[^ self].
|
|
537 |
|
3799
|
538 |
lastComponentName := componentName.
|
3780
|
539 |
endTime := Timestamp now + seconds.
|
3787
|
540 |
[
|
3799
|
541 |
(component := self findComponent:componentName inAllApplications:true ifMultiple:nil) notNil ifTrue:[
|
|
542 |
lastComponent := component.
|
3780
|
543 |
^ self
|
|
544 |
].
|
3799
|
545 |
Delay waitForSeconds:0.1.
|
3780
|
546 |
Timestamp now > endTime ifTrue:[
|
|
547 |
self error:('component %1 not present after %2' bindWith:componentName with:seconds)
|
|
548 |
]
|
|
549 |
] loop
|
3700
|
550 |
! !
|
|
551 |
|
3711
|
552 |
!ShowMeHowItWorks methodsFor:'commands - checking'!
|
|
553 |
|
|
554 |
isEmpty:componentName
|
3799
|
555 |
"true if the addressed textview/field is empty.
|
|
556 |
Leaves component in lastComponent"
|
|
557 |
|
3711
|
558 |
<action>
|
|
559 |
|
|
560 |
|component|
|
|
561 |
|
|
562 |
component := self componentNamed:componentName.
|
|
563 |
component isScrollWrapper ifTrue:[ component := component scrolledView ].
|
|
564 |
component isTextView ifTrue:[
|
|
565 |
^ component contents isEmptyOrNil
|
|
566 |
].
|
3799
|
567 |
self error:'isEmpty: unhandled (non-text) component type: ',component displayString.
|
3711
|
568 |
|
|
569 |
"Created: / 19-07-2019 / 15:33:47 / Claus Gittinger"
|
|
570 |
!
|
|
571 |
|
|
572 |
unless:query do:actions
|
|
573 |
<action>
|
|
574 |
|
|
575 |
|result|
|
|
576 |
|
|
577 |
result := self doCommand:query.
|
|
578 |
result ifFalse:[
|
|
579 |
self doCommand:actions
|
|
580 |
].
|
|
581 |
|
|
582 |
"Created: / 19-07-2019 / 15:33:32 / Claus Gittinger"
|
|
583 |
! !
|
|
584 |
|
|
585 |
!ShowMeHowItWorks methodsFor:'commands - mouse & keyboard'!
|
|
586 |
|
3798
|
587 |
clear
|
3799
|
588 |
"clear entry fields of last component"
|
3798
|
589 |
|
|
590 |
<action>
|
|
591 |
|
|
592 |
verifying ifTrue:[^ self].
|
|
593 |
|
|
594 |
lastComponent contents:nil
|
|
595 |
!
|
|
596 |
|
3711
|
597 |
click
|
3799
|
598 |
"press-release in last component"
|
3711
|
599 |
|
|
600 |
<action>
|
|
601 |
|
|
602 |
^ self click:1 inComponent:lastComponent
|
|
603 |
|
|
604 |
"Created: / 19-07-2019 / 16:11:03 / Claus Gittinger"
|
|
605 |
!
|
3700
|
606 |
|
|
607 |
click:buttonNr
|
3799
|
608 |
"press-release in last component"
|
3700
|
609 |
|
|
610 |
<action>
|
|
611 |
|
3711
|
612 |
self assert:(buttonNr isInteger).
|
|
613 |
^ self click:buttonNr inComponent:lastComponent
|
3700
|
614 |
|
|
615 |
"Created: / 19-07-2019 / 13:21:20 / Claus Gittinger"
|
3711
|
616 |
"Modified: / 19-07-2019 / 16:10:19 / Claus Gittinger"
|
3700
|
617 |
!
|
|
618 |
|
3800
|
619 |
click:buttonNr clickTime:t
|
|
620 |
"press-release in last component"
|
|
621 |
|
|
622 |
<action>
|
|
623 |
|
|
624 |
self assert:(buttonNr isInteger).
|
|
625 |
^ self click:buttonNr inComponent:lastComponent clickTime:t
|
|
626 |
!
|
|
627 |
|
3711
|
628 |
clickIn:componentName
|
3799
|
629 |
"press-release.
|
|
630 |
Leaves component in lastComponent"
|
3711
|
631 |
|
|
632 |
<action>
|
|
633 |
|
|
634 |
^ self click:1 inComponent:(self componentNamed:componentName)
|
|
635 |
|
|
636 |
"Created: / 19-07-2019 / 16:09:58 / Claus Gittinger"
|
|
637 |
!
|
|
638 |
|
3787
|
639 |
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where
|
|
640 |
"drag an item (by index or label) from the current treeView,
|
|
641 |
into another component.
|
|
642 |
where is one of: #top, #center or #bottom.
|
|
643 |
allowed after moving to:
|
|
644 |
aSelectionInHierarchyView
|
|
645 |
"
|
|
646 |
|
|
647 |
<action>
|
|
648 |
|
3790
|
649 |
self drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:nil
|
|
650 |
!
|
|
651 |
|
|
652 |
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:textWhenDroppingOrNil
|
|
653 |
"drag an item (by index or label) from the current treeView,
|
|
654 |
into another component.
|
|
655 |
where is one of: #top, #center or #bottom.
|
|
656 |
allowed after moving to:
|
|
657 |
aSelectionInHierarchyView
|
|
658 |
"
|
|
659 |
|
|
660 |
<action>
|
|
661 |
|
3787
|
662 |
|sourceComponent targetComponent idx yPos sourcePos sourcePosOnScreen
|
3790
|
663 |
targetPos targetPosOnScreen targetPosInSource dNdMgr|
|
3787
|
664 |
|
|
665 |
verifying ifTrue:[^ self].
|
|
666 |
|
|
667 |
targetComponent := self findComponent:targetComponentName.
|
|
668 |
self assert:targetComponent notNil.
|
|
669 |
|
|
670 |
((sourceComponent := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
671 |
sourceComponent := sourceComponent scrolledView.
|
|
672 |
].
|
|
673 |
|
3796
|
674 |
targetPos := self where:where inComponent:targetComponent.
|
3790
|
675 |
|
|
676 |
(sourceComponent isKindOf:HierarchicalListView) ifTrue:[
|
3787
|
677 |
|
|
678 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
679 |
idx := itemsIndexOrLabelOrPattern
|
|
680 |
] ifFalse:[
|
|
681 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
682 |
idx := sourceComponent indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
683 |
] ifFalse:[
|
|
684 |
idx := sourceComponent indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
|
685 |
].
|
|
686 |
idx == 0 ifTrue:[
|
|
687 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
688 |
].
|
|
689 |
].
|
3796
|
690 |
|
3787
|
691 |
yPos := sourceComponent yVisibleOfLine:idx.
|
|
692 |
self movePointerToComponent:sourceComponent rightOffset:(10 @ (yPos + 3)).
|
|
693 |
Delay waitForSeconds:0.5.
|
|
694 |
sourcePosOnScreen := Display pointerPosition.
|
3796
|
695 |
sourcePos := Display translatePoint:sourcePosOnScreen fromView:nil toView:sourceComponent.
|
|
696 |
|
|
697 |
targetPosOnScreen := Display translatePoint:targetPos fromView:targetComponent toView:nil.
|
|
698 |
targetPosInSource := Display translatePoint:targetPosOnScreen fromView:nil toView:sourceComponent.
|
3787
|
699 |
|
3796
|
700 |
sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:false.
|
|
701 |
sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:true.
|
|
702 |
Delay waitForSeconds:0.2.
|
3787
|
703 |
|
3790
|
704 |
dNdMgr := sourceComponent startDragAt:sourcePos.
|
|
705 |
|
|
706 |
textWhenDroppingOrNil notNil ifTrue:[
|
|
707 |
self show:textWhenDroppingOrNil.
|
|
708 |
].
|
|
709 |
|
|
710 |
Delay waitForSeconds:1.
|
3787
|
711 |
self movePointerToComponent:targetComponent offset:targetPos.
|
3790
|
712 |
Delay waitForSeconds:1.
|
|
713 |
dNdMgr buttonMotion:1 x:targetPos x y:targetPos y view:targetComponent.
|
3787
|
714 |
|
3790
|
715 |
dNdMgr buttonRelease:1 x:targetPos x y:targetPos y view:targetComponent.
|
3796
|
716 |
sourceComponent simulateButtonRelease:1 at:targetPos sendDisplayEvent:false.
|
3787
|
717 |
^ self
|
|
718 |
].
|
|
719 |
|
|
720 |
self error:'cannot expand in this component'
|
|
721 |
|
|
722 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
723 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
724 |
!
|
|
725 |
|
|
726 |
expand:itemsIndexOrLabelOrPattern
|
|
727 |
"expand an item in a treeView by label,
|
|
728 |
allowed after moving to:
|
|
729 |
aSelectionInHierarchyView
|
|
730 |
"
|
|
731 |
|
|
732 |
<action>
|
|
733 |
|
|
734 |
|component|
|
|
735 |
|
|
736 |
verifying ifTrue:[^ self].
|
|
737 |
|
|
738 |
((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
739 |
component := component scrolledView.
|
|
740 |
].
|
|
741 |
|
|
742 |
(component isKindOf:HierarchicalListView) ifTrue:[
|
|
743 |
|idx yPos|
|
|
744 |
|
|
745 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
746 |
idx := itemsIndexOrLabelOrPattern
|
|
747 |
] ifFalse:[
|
|
748 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
749 |
idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
750 |
] ifFalse:[
|
|
751 |
idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
|
752 |
].
|
|
753 |
idx == 0 ifTrue:[
|
|
754 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
755 |
].
|
|
756 |
].
|
|
757 |
yPos := component yVisibleOfLine:idx.
|
|
758 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
759 |
Delay waitForSeconds:0.5.
|
|
760 |
(component listAt:idx) expand.
|
|
761 |
^ self
|
|
762 |
].
|
|
763 |
|
|
764 |
self error:'cannot expand in this component'
|
|
765 |
|
|
766 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
767 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
768 |
!
|
|
769 |
|
3798
|
770 |
fastMoveRelativeX:dX y:dY
|
|
771 |
"move the mouse to a new relative position"
|
|
772 |
|
|
773 |
<action>
|
|
774 |
|
|
775 |
|screen newPos currentPos|
|
|
776 |
|
|
777 |
verifying ifTrue:[^ self].
|
|
778 |
|
|
779 |
screen := Screen current.
|
|
780 |
currentPos := screen pointerPosition.
|
|
781 |
newPos := currentPos + (dX @ dY).
|
|
782 |
self fastMovePointerToScreenPosition:newPos
|
|
783 |
!
|
|
784 |
|
3711
|
785 |
fastMoveTo:componentName
|
3799
|
786 |
"move the mouse to componentName without circling.
|
|
787 |
Leaves component in lastComponent"
|
3700
|
788 |
|
|
789 |
<action>
|
|
790 |
|
3711
|
791 |
|component|
|
3700
|
792 |
|
3711
|
793 |
component := self componentNamed:componentName.
|
3717
|
794 |
self movePointerToComponent:component speed:(self pointerMoveSpeedFast).
|
3711
|
795 |
|
3727
|
796 |
"
|
|
797 |
ShowMeHowItWorks basicNew fastMoveTo:'Classes'
|
|
798 |
ShowMeHowItWorks basicNew fastMoveTo:'Klassen'
|
|
799 |
"
|
|
800 |
|
3711
|
801 |
"Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
|
3717
|
802 |
"Modified: / 20-07-2019 / 08:14:16 / Claus Gittinger"
|
3727
|
803 |
"Modified (comment): / 23-07-2019 / 09:33:31 / Claus Gittinger"
|
3700
|
804 |
!
|
|
805 |
|
3798
|
806 |
key:aKeySymbol
|
3799
|
807 |
"press/release a key in last component"
|
3798
|
808 |
|
|
809 |
<action>
|
|
810 |
|
|
811 |
|t|
|
|
812 |
|
|
813 |
verifying ifTrue:[^ self].
|
|
814 |
|
|
815 |
t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
|
|
816 |
lastComponent
|
|
817 |
simulateKey:aKeySymbol at:(lastComponent extent // 2) sendDisplayEvent:false keyPressTime:t
|
|
818 |
|
|
819 |
"Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
|
|
820 |
!
|
|
821 |
|
3700
|
822 |
moveTo:componentName
|
|
823 |
"move the mouse to componentName,
|
3799
|
824 |
then circle around it a few times.
|
|
825 |
Leaves component in lastComponent"
|
3700
|
826 |
|
|
827 |
<action>
|
|
828 |
|
|
829 |
|component|
|
|
830 |
|
3711
|
831 |
component := self componentNamed:componentName.
|
3700
|
832 |
self movePointerToComponent:component.
|
3776
|
833 |
Display ctrlDown ifTrue:[^ self].
|
3700
|
834 |
self circlePointerAroundComponent:component.
|
|
835 |
|
|
836 |
"Created: / 19-07-2019 / 11:20:42 / Claus Gittinger"
|
3711
|
837 |
"Modified: / 19-07-2019 / 15:38:11 / Claus Gittinger"
|
3700
|
838 |
!
|
|
839 |
|
3795
|
840 |
press:buttonNr
|
|
841 |
<action>
|
|
842 |
|
3799
|
843 |
"press at the current position in last component"
|
3795
|
844 |
|
|
845 |
self assert:(buttonNr isInteger).
|
|
846 |
^ self press:buttonNr inComponent:lastComponent.
|
|
847 |
|
|
848 |
"/ "press at the current position"
|
|
849 |
"/
|
|
850 |
"/ |position screen x y|
|
|
851 |
"/
|
|
852 |
"/ verifying ifTrue:[^ self].
|
|
853 |
"/
|
|
854 |
"/ screen := Screen current.
|
|
855 |
"/ position := screen pointerPosition.
|
|
856 |
"/ x := position x.
|
|
857 |
"/ y := position y.
|
|
858 |
"/
|
|
859 |
"/ "/ self movePointerToScreenPosition:position.
|
|
860 |
"/
|
|
861 |
"/ false "OperatingSystem isOSXlike" ifTrue:[
|
|
862 |
"/ |osxPos|
|
|
863 |
"/
|
|
864 |
"/ osxPos := OperatingSystem getMousePosition.
|
|
865 |
"/ x := osxPos x rounded.
|
|
866 |
"/ y := osxPos y rounded.
|
|
867 |
"/ OperatingSystem generateButtonEvent:buttonNr down:true x:x y:y.
|
|
868 |
"/ ^ self.
|
|
869 |
"/ ].
|
|
870 |
"/
|
|
871 |
"/ screen sendKeyOrButtonEvent:#buttonPress x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
|
|
872 |
"/ screen flush.
|
|
873 |
"/
|
|
874 |
"/ "Created: / 19-07-2019 / 13:52:38 / Claus Gittinger"
|
|
875 |
"/ "Modified: / 23-07-2019 / 09:38:31 / Claus Gittinger"
|
|
876 |
!
|
|
877 |
|
|
878 |
release:buttonNr
|
|
879 |
<action>
|
|
880 |
|
3799
|
881 |
"release at the current position in last component"
|
3795
|
882 |
|
|
883 |
<action>
|
|
884 |
|
|
885 |
self assert:(buttonNr isInteger).
|
|
886 |
^ self press:buttonNr inComponent:lastComponent.
|
|
887 |
"/ |position screen x y|
|
|
888 |
"/
|
|
889 |
"/ verifying ifTrue:[^ self].
|
|
890 |
"/
|
|
891 |
"/ screen := Screen current.
|
|
892 |
"/ position := screen pointerPosition.
|
|
893 |
"/ x := position x.
|
|
894 |
"/ y := position y.
|
|
895 |
"/
|
|
896 |
"/ self movePointerToScreenPosition:position.
|
|
897 |
"/
|
|
898 |
"/ false "OperatingSystem isOSXlike" ifTrue:[
|
|
899 |
"/ |osxPos|
|
|
900 |
"/
|
|
901 |
"/ osxPos := OperatingSystem getMousePosition.
|
|
902 |
"/ x := osxPos x rounded.
|
|
903 |
"/ y := osxPos y rounded.
|
|
904 |
"/ OperatingSystem generateButtonEvent:buttonNr down:false x:x y:y.
|
|
905 |
"/ ^ self.
|
|
906 |
"/ ].
|
|
907 |
"/
|
|
908 |
"/ screen sendKeyOrButtonEvent:#buttonRelease x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
|
|
909 |
"/ screen flush.
|
|
910 |
|
|
911 |
"Created: / 19-07-2019 / 13:53:05 / Claus Gittinger"
|
|
912 |
"Modified: / 23-07-2019 / 09:38:38 / Claus Gittinger"
|
|
913 |
!
|
|
914 |
|
3787
|
915 |
select:itemsIndexOrLabelOrPattern
|
3700
|
916 |
"select an item by label,
|
|
917 |
allowed after moving to:
|
3803
|
918 |
a ComboBox
|
|
919 |
a SelectionInListView
|
|
920 |
a NoteBook
|
|
921 |
a DSVColumnView
|
3700
|
922 |
"
|
|
923 |
|
|
924 |
<action>
|
|
925 |
|
3803
|
926 |
|idx component yPos tab|
|
3775
|
927 |
|
|
928 |
verifying ifTrue:[^ self].
|
|
929 |
|
3783
|
930 |
((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
931 |
component := component scrolledView.
|
|
932 |
].
|
|
933 |
|
|
934 |
(component isKindOf:ComboView) ifTrue:[
|
3700
|
935 |
"/ click on the menubutton
|
3783
|
936 |
self movePointerToComponent:component menuButton.
|
|
937 |
self click:1 inComponent:component menuButton.
|
3700
|
938 |
Delay waitForSeconds:0.3.
|
3787
|
939 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
940 |
idx := itemsIndexOrLabelOrPattern
|
|
941 |
] ifFalse:[
|
|
942 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
943 |
idx := component list findFirst:[:lbl | itemsIndexOrLabelOrPattern match:lbl]
|
|
944 |
] ifFalse:[
|
|
945 |
idx := component list indexOf:itemsIndexOrLabelOrPattern.
|
|
946 |
].
|
|
947 |
idx == 0 ifTrue:[
|
|
948 |
self error:'no such item in comboList: ',itemsIndexOrLabelOrPattern
|
|
949 |
].
|
3700
|
950 |
].
|
3783
|
951 |
component select:idx.
|
3700
|
952 |
Delay waitForSeconds:0.3.
|
3783
|
953 |
component shownMenu notNil ifTrue:[
|
|
954 |
component shownMenu hide.
|
3700
|
955 |
].
|
|
956 |
^ self
|
|
957 |
].
|
3783
|
958 |
(component isKindOf:HierarchicalListView) ifTrue:[
|
3787
|
959 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
960 |
idx := itemsIndexOrLabelOrPattern
|
|
961 |
] ifFalse:[
|
|
962 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
963 |
idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
964 |
] ifFalse:[
|
|
965 |
idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
3783
|
966 |
].
|
3787
|
967 |
idx == 0 ifTrue:[
|
|
968 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
969 |
].
|
|
970 |
].
|
|
971 |
yPos := component yVisibleOfLine:idx.
|
|
972 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
973 |
component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
974 |
Delay waitForSeconds:0.1.
|
|
975 |
component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
976 |
"/ component selection:idx.
|
3783
|
977 |
^ self
|
|
978 |
].
|
3798
|
979 |
(component isKindOf:SelectionInListModelView) ifTrue:[
|
|
980 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
981 |
idx := itemsIndexOrLabelOrPattern
|
|
982 |
] ifFalse:[
|
|
983 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
984 |
idx := component indexOfElementForWhich:[:el | el notNil and:[itemsIndexOrLabelOrPattern match:el string]].
|
|
985 |
] ifFalse:[
|
|
986 |
idx := component indexOfElementForWhich:[:el | el notNil and:[el string = itemsIndexOrLabelOrPattern]].
|
|
987 |
].
|
|
988 |
idx == 0 ifTrue:[
|
|
989 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
990 |
].
|
|
991 |
].
|
|
992 |
yPos := component yVisibleOfLine:idx.
|
|
993 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
994 |
component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
995 |
Delay waitForSeconds:0.1.
|
|
996 |
component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
997 |
"/ component selection:idx.
|
|
998 |
^ self
|
|
999 |
].
|
|
1000 |
|
|
1001 |
(component isKindOf:ItemInView) ifTrue:[
|
|
1002 |
component isMenuItem ifTrue:[
|
|
1003 |
self movePointerToComponent:component.
|
3803
|
1004 |
self click.
|
|
1005 |
^ self
|
3798
|
1006 |
].
|
|
1007 |
].
|
|
1008 |
|
3803
|
1009 |
(component isKindOf:NoteBookView) ifTrue:[
|
|
1010 |
(idx := itemsIndexOrLabelOrPattern) isInteger ifFalse:[
|
3814
|
1011 |
idx := component list
|
|
1012 |
findFirst:[:eachNotebookTab|
|
|
1013 |
eachNotebookTab label string = itemsIndexOrLabelOrPattern string
|
|
1014 |
or:[ eachNotebookTab printableLabel string = itemsIndexOrLabelOrPattern string ]
|
|
1015 |
].
|
|
1016 |
"/ idx := component indexOfTabNamed:itemsIndexOrLabelOrPattern
|
3803
|
1017 |
].
|
|
1018 |
tab := component tabAtIndex:idx.
|
|
1019 |
self movePointerToComponent:component offset:(tab layout center).
|
|
1020 |
component selection:idx.
|
|
1021 |
^ self
|
|
1022 |
].
|
|
1023 |
(component isKindOf:DSVColumnView) ifTrue:[
|
|
1024 |
(idx := itemsIndexOrLabelOrPattern) isInteger ifFalse:[
|
|
1025 |
self halt.
|
|
1026 |
].
|
|
1027 |
yPos := ((component yVisibleOfRowNr:idx) + (component yVisibleOfRowNr:idx+1)) // 2.
|
|
1028 |
self movePointerToComponent:component offset:(1 @ yPos).
|
|
1029 |
component selectRow:idx.
|
|
1030 |
^ self
|
|
1031 |
].
|
|
1032 |
|
|
1033 |
self error:('cannot select "%1" this component: %2' bindWith:itemsIndexOrLabelOrPattern with:component className)
|
3700
|
1034 |
|
|
1035 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
1036 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
1037 |
!
|
|
1038 |
|
3803
|
1039 |
selectComponent:componentName
|
|
1040 |
"Leaves component in lastComponent without moving"
|
|
1041 |
|
|
1042 |
<action>
|
|
1043 |
|
|
1044 |
|component|
|
|
1045 |
|
|
1046 |
component := self componentNamed:componentName.
|
|
1047 |
!
|
|
1048 |
|
3700
|
1049 |
selectIndex:itemsIndex
|
|
1050 |
"select an item by index,
|
|
1051 |
allowed after moving to:
|
|
1052 |
aComboBox
|
|
1053 |
aSelectionInListView
|
|
1054 |
"
|
|
1055 |
|
|
1056 |
<action>
|
|
1057 |
|
3716
|
1058 |
self selectIndex:itemsIndex in:lastComponent
|
|
1059 |
|
|
1060 |
"Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
|
|
1061 |
"Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
|
|
1062 |
!
|
3711
|
1063 |
|
3716
|
1064 |
selectIndex:itemsIndex in:widgetArg
|
|
1065 |
"select an item by index,
|
|
1066 |
allowed after moving to:
|
|
1067 |
aComboBox
|
|
1068 |
aSelectionInListView
|
|
1069 |
"
|
|
1070 |
|
|
1071 |
<action>
|
|
1072 |
|
|
1073 |
|widget y offset possibleWidgets|
|
|
1074 |
|
3775
|
1075 |
verifying ifTrue:[^ self].
|
|
1076 |
|
3716
|
1077 |
(widget := widgetArg) isScrollWrapper ifTrue:[
|
3711
|
1078 |
widget := widget scrolledView
|
|
1079 |
].
|
|
1080 |
|
|
1081 |
(widget isKindOf:ComboView) ifTrue:[
|
3700
|
1082 |
"/ click on the menubutton
|
3711
|
1083 |
self movePointerToComponent:widget menuButton.
|
|
1084 |
self click:1 inComponent:widget menuButton.
|
3700
|
1085 |
Delay waitForSeconds:0.5.
|
3711
|
1086 |
widget select:itemsIndex.
|
3700
|
1087 |
Delay waitForSeconds:0.5.
|
|
1088 |
^ self
|
|
1089 |
].
|
3711
|
1090 |
(widget isKindOf:SelectionInListView) ifTrue:[
|
3716
|
1091 |
(widget isLineVisible:itemsIndex) ifFalse:[
|
|
1092 |
widget scrollToLine:itemsIndex
|
|
1093 |
].
|
3711
|
1094 |
"/ click on the item
|
|
1095 |
y := widget yOfLine:itemsIndex.
|
|
1096 |
offset := (widget width // 2) @ y.
|
|
1097 |
self movePointerToComponent:widget offset:offset.
|
|
1098 |
widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
|
|
1099 |
Delay waitForSeconds:(self clickTime).
|
|
1100 |
widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
|
|
1101 |
Delay waitForSeconds:0.5.
|
|
1102 |
^ self
|
3716
|
1103 |
].
|
|
1104 |
(widget isKindOf:SelectionInListModelView) ifTrue:[
|
|
1105 |
(widget isLineVisible:itemsIndex) ifFalse:[
|
|
1106 |
widget scrollToLine:itemsIndex
|
|
1107 |
].
|
|
1108 |
y := widget yVisibleOfLine:itemsIndex.
|
|
1109 |
offset := (widget width // 2) @ y.
|
|
1110 |
self movePointerToComponent:widget offset:offset.
|
|
1111 |
widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
|
|
1112 |
Delay waitForSeconds:(self clickTime).
|
|
1113 |
widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
|
|
1114 |
Delay waitForSeconds:0.5.
|
|
1115 |
^ self
|
|
1116 |
].
|
|
1117 |
|
|
1118 |
"/ none of it - see what is in there
|
|
1119 |
possibleWidgets := OrderedCollection new.
|
|
1120 |
widget allSubViewsDo:[:each |
|
|
1121 |
((each isKindOf:ComboView)
|
|
1122 |
or:[(each isKindOf:SelectionInListView)
|
|
1123 |
or:[(each isKindOf:SelectionInListModelView)
|
|
1124 |
]]) ifTrue:[
|
|
1125 |
possibleWidgets add:each
|
|
1126 |
]
|
|
1127 |
].
|
|
1128 |
possibleWidgets size == 1 ifTrue:[
|
|
1129 |
self selectIndex:itemsIndex in:(possibleWidgets first).
|
|
1130 |
^ self
|
3711
|
1131 |
].
|
3716
|
1132 |
|
3700
|
1133 |
self error:'cannot select this component'
|
|
1134 |
|
3716
|
1135 |
"Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
|
|
1136 |
"Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
|
3711
|
1137 |
!
|
|
1138 |
|
|
1139 |
type:aString
|
|
1140 |
"enter text into the last component"
|
|
1141 |
|
|
1142 |
<action>
|
|
1143 |
|
3776
|
1144 |
|t|
|
|
1145 |
|
3775
|
1146 |
verifying ifTrue:[^ self].
|
|
1147 |
|
3776
|
1148 |
t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
|
|
1149 |
lastComponent
|
|
1150 |
simulateTextInput:aString at:(lastComponent extent // 2)
|
|
1151 |
sendDisplayEvent:false keyPressTime:t
|
3711
|
1152 |
|
|
1153 |
"Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
|
3700
|
1154 |
! !
|
|
1155 |
|
|
1156 |
!ShowMeHowItWorks methodsFor:'defaults'!
|
|
1157 |
|
|
1158 |
circlingCount
|
|
1159 |
"circle around move-end position that many times"
|
|
1160 |
|
|
1161 |
^ 3
|
|
1162 |
|
|
1163 |
"Created: / 19-07-2019 / 13:03:45 / Claus Gittinger"
|
|
1164 |
!
|
|
1165 |
|
|
1166 |
circlingRadius
|
|
1167 |
"radius when circling"
|
|
1168 |
|
|
1169 |
^ 30 "/ pixels
|
|
1170 |
|
|
1171 |
"Created: / 19-07-2019 / 13:07:59 / Claus Gittinger"
|
|
1172 |
!
|
|
1173 |
|
|
1174 |
circlingSpeed
|
|
1175 |
"time per round when circling"
|
|
1176 |
|
|
1177 |
^ 0.3 seconds. "/ time per round
|
|
1178 |
|
|
1179 |
"Created: / 19-07-2019 / 13:02:34 / Claus Gittinger"
|
|
1180 |
!
|
|
1181 |
|
|
1182 |
clickTime
|
|
1183 |
"when clicking"
|
|
1184 |
|
3711
|
1185 |
^ self shortClickTime
|
3700
|
1186 |
|
|
1187 |
"Created: / 19-07-2019 / 13:17:20 / Claus Gittinger"
|
3711
|
1188 |
"Modified: / 19-07-2019 / 15:21:51 / Claus Gittinger"
|
|
1189 |
!
|
|
1190 |
|
|
1191 |
longClickTime
|
|
1192 |
"when clicking buttons"
|
|
1193 |
|
|
1194 |
^ 500 milliseconds
|
|
1195 |
|
|
1196 |
"Created: / 19-07-2019 / 15:21:42 / Claus Gittinger"
|
3700
|
1197 |
!
|
|
1198 |
|
|
1199 |
pointerAnimationDelay
|
|
1200 |
^ 50 milliseconds. "/ 20 updates per second
|
|
1201 |
|
|
1202 |
"Created: / 19-07-2019 / 13:04:45 / Claus Gittinger"
|
|
1203 |
!
|
|
1204 |
|
|
1205 |
pointerMoveSpeed
|
|
1206 |
^ 400. "/ pixels per second
|
|
1207 |
|
|
1208 |
"Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
|
|
1209 |
!
|
|
1210 |
|
3717
|
1211 |
pointerMoveSpeedFast
|
|
1212 |
^ 600. "/ pixels per second
|
|
1213 |
|
|
1214 |
"Created: / 20-07-2019 / 08:13:58 / Claus Gittinger"
|
|
1215 |
!
|
|
1216 |
|
3711
|
1217 |
shortClickTime
|
|
1218 |
"when clicking"
|
|
1219 |
|
|
1220 |
^ 100 milliseconds
|
|
1221 |
|
|
1222 |
"Created: / 19-07-2019 / 15:21:29 / Claus Gittinger"
|
|
1223 |
!
|
|
1224 |
|
3700
|
1225 |
talking
|
3780
|
1226 |
"/ DebugMode := true
|
3775
|
1227 |
verifying ifTrue:[^ false].
|
3780
|
1228 |
DebugMode == true ifTrue:[^ false].
|
3775
|
1229 |
|
3727
|
1230 |
"/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled
|
3700
|
1231 |
^ true
|
|
1232 |
|
|
1233 |
"Created: / 19-07-2019 / 14:31:14 / Claus Gittinger"
|
3727
|
1234 |
"Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger"
|
3700
|
1235 |
! !
|
|
1236 |
|
|
1237 |
!ShowMeHowItWorks methodsFor:'helper'!
|
|
1238 |
|
3715
|
1239 |
randomThankYou
|
|
1240 |
^ #(
|
|
1241 |
'thank you, for watching'
|
|
1242 |
'thank you for watching'
|
|
1243 |
'thank you'
|
3775
|
1244 |
'thanks'
|
3715
|
1245 |
'have a good day'
|
3775
|
1246 |
'have a nice day'
|
3715
|
1247 |
'have fun'
|
|
1248 |
'have fun with expecco'
|
|
1249 |
'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
|
|
1250 |
'happy hacking'
|
|
1251 |
'happy hacking, I hope you liked what you saw'
|
|
1252 |
'hope you liked it'
|
|
1253 |
'see you again'
|
3775
|
1254 |
'be the source with you'
|
|
1255 |
'be the force with you'
|
|
1256 |
'may the force be with you'
|
|
1257 |
'may the source be with you'
|
3715
|
1258 |
'please give feedback, and let us know, if you liked it'
|
|
1259 |
'if you have any questions, please contact exept'
|
|
1260 |
'if you need more information, please take a look at the wiki'
|
|
1261 |
) atRandom
|
|
1262 |
|
|
1263 |
"
|
3775
|
1264 |
OperatingSystem speak:'may the source be with you'
|
3715
|
1265 |
OperatingSystem speak:'have fun with expecco'
|
3716
|
1266 |
OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin'
|
3715
|
1267 |
OperatingSystem speak:'happy hacking, I hope you liked what you saw'
|
|
1268 |
OperatingSystem speak:'please give feedback, and let us know, if you liked it'
|
|
1269 |
OperatingSystem speak:'if you have any questions, please contact exept'
|
|
1270 |
OperatingSystem speak:'if you need more information, please take a look at the wiki'
|
|
1271 |
"
|
|
1272 |
|
|
1273 |
"Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
|
|
1274 |
!
|
|
1275 |
|
3700
|
1276 |
tell:message
|
|
1277 |
self talking ifTrue:[
|
3728
|
1278 |
OperatingSystem speak:message voiceName:voice.
|
3700
|
1279 |
].
|
|
1280 |
|
|
1281 |
"Created: / 19-07-2019 / 14:57:50 / Claus Gittinger"
|
3728
|
1282 |
"Modified: / 23-07-2019 / 10:28:02 / Claus Gittinger"
|
3700
|
1283 |
! !
|
|
1284 |
|
|
1285 |
!ShowMeHowItWorks methodsFor:'helpers - broken'!
|
|
1286 |
|
|
1287 |
click:buttonNr atPosition:position
|
|
1288 |
"press-release at position"
|
|
1289 |
|
|
1290 |
|screen|
|
|
1291 |
|
3775
|
1292 |
verifying ifTrue:[^ self].
|
|
1293 |
|
3700
|
1294 |
screen := Screen current.
|
|
1295 |
|
|
1296 |
screen setPointerPosition:position.
|
|
1297 |
screen flush.
|
|
1298 |
self click:buttonNr
|
|
1299 |
|
|
1300 |
"Created: / 19-07-2019 / 13:14:51 / Claus Gittinger"
|
|
1301 |
! !
|
|
1302 |
|
3727
|
1303 |
!ShowMeHowItWorks methodsFor:'helpers - component search'!
|
|
1304 |
|
3800
|
1305 |
chooseBestComponentFrom:foundItems
|
|
1306 |
|reallyShown inMyApp|
|
|
1307 |
|
|
1308 |
foundItems size == 1 ifTrue:[^ foundItems first].
|
|
1309 |
foundItems size == 0 ifTrue:[^ nil].
|
|
1310 |
|
|
1311 |
reallyShown := foundItems select:[:item | item isReallyShown].
|
|
1312 |
reallyShown size == 1 ifTrue:[^ reallyShown first].
|
|
1313 |
reallyShown size == 0 ifTrue:[^ nil].
|
|
1314 |
|
|
1315 |
"/ is there one in my application
|
|
1316 |
application notNil ifTrue:[
|
|
1317 |
inMyApp := reallyShown select:[:item | item topView application == application].
|
|
1318 |
inMyApp size == 1 ifTrue:[^ inMyApp first].
|
|
1319 |
].
|
|
1320 |
"/ there seems to be a mapped view, but underneath
|
|
1321 |
"/ select the last one found
|
|
1322 |
^ foundItems last.
|
|
1323 |
!
|
|
1324 |
|
3727
|
1325 |
componentNamed:componentName
|
|
1326 |
"retrieve a component by name or report an error if not found.
|
|
1327 |
Can return either a view or a menu item"
|
|
1328 |
|
|
1329 |
|component|
|
|
1330 |
|
3799
|
1331 |
verifying ifFalse:[
|
|
1332 |
self waitFor:componentName timeout:(defaultElementTimeout ? 1).
|
|
1333 |
^ lastComponent.
|
|
1334 |
].
|
|
1335 |
|
3727
|
1336 |
lastComponentName := componentName.
|
|
1337 |
|
|
1338 |
component := self findComponent:componentName.
|
|
1339 |
component isNil ifTrue:[
|
3784
|
1340 |
self error:'no component found for: ',componentName mayProceed:verifying.
|
|
1341 |
^ nil
|
3727
|
1342 |
].
|
|
1343 |
lastComponent := component.
|
|
1344 |
^ component
|
|
1345 |
|
|
1346 |
"Created: / 19-07-2019 / 15:37:35 / Claus Gittinger"
|
|
1347 |
"Modified (comment): / 23-07-2019 / 09:31:53 / Claus Gittinger"
|
|
1348 |
!
|
|
1349 |
|
3803
|
1350 |
findApplication:classNameOrWindowTitle ifMultiple:exceptionalValue
|
|
1351 |
"find an application by name"
|
|
1352 |
|
|
1353 |
|candidates|
|
|
1354 |
|
|
1355 |
candidates := IdentitySet new.
|
|
1356 |
|
|
1357 |
"/ search through all current applications
|
|
1358 |
WindowGroup scheduledWindowGroups do:[:eachWG |
|
|
1359 |
|eachApp|
|
|
1360 |
|
|
1361 |
(eachApp := eachWG application) notNil ifTrue:[
|
|
1362 |
((classNameOrWindowTitle match:eachApp className)
|
|
1363 |
or:[(classNameOrWindowTitle match:eachApp class nameWithoutPrefix)
|
|
1364 |
or:[(classNameOrWindowTitle match:eachApp mainWindow label)]]) ifTrue:[
|
|
1365 |
candidates add:eachApp
|
|
1366 |
].
|
|
1367 |
].
|
|
1368 |
].
|
|
1369 |
candidates size == 1 ifTrue:[
|
|
1370 |
^ candidates first
|
|
1371 |
].
|
|
1372 |
candidates notEmpty ifTrue:[
|
|
1373 |
"/ multiple elements (probably there are multiple topviews open...
|
|
1374 |
"/ check the current windowGroup
|
|
1375 |
^ exceptionalValue value
|
|
1376 |
].
|
|
1377 |
^ nil
|
|
1378 |
|
|
1379 |
"
|
|
1380 |
ShowMeHowItWorks basicNew findApplication:'Inspector*' ifMultiple:nil.
|
|
1381 |
"
|
|
1382 |
|
|
1383 |
"Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
|
|
1384 |
"Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
|
|
1385 |
"Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
|
|
1386 |
!
|
|
1387 |
|
3727
|
1388 |
findComponent:componentName
|
|
1389 |
"find a component by name - in the active and possibly in any app.
|
|
1390 |
Can return either a view or a menu item"
|
|
1391 |
|
3787
|
1392 |
^ self
|
|
1393 |
findComponent:componentName
|
|
1394 |
inAllApplications:true
|
|
1395 |
ifMultiple:[
|
|
1396 |
self proceedableError:('multiple components found by name: ',componentName).
|
|
1397 |
nil
|
3727
|
1398 |
].
|
3780
|
1399 |
|
3787
|
1400 |
"
|
|
1401 |
ShowMeHowItWorks basicNew findComponent:'Classes'
|
|
1402 |
ShowMeHowItWorks basicNew findComponent:'Klassen'
|
|
1403 |
"
|
3780
|
1404 |
|
3787
|
1405 |
"Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
|
|
1406 |
"Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
|
|
1407 |
"Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
|
|
1408 |
!
|
|
1409 |
|
|
1410 |
findComponent:componentName ifMultiple:exceptionalValue
|
|
1411 |
"find a component by name - in the active and possibly in any app.
|
|
1412 |
Can return either a view or a menu item"
|
|
1413 |
|
|
1414 |
^ self
|
|
1415 |
findComponent:componentName
|
|
1416 |
inAllApplications:true
|
|
1417 |
ifMultiple:exceptionalValue
|
3727
|
1418 |
|
|
1419 |
"
|
|
1420 |
ShowMeHowItWorks basicNew findComponent:'Classes'
|
|
1421 |
ShowMeHowItWorks basicNew findComponent:'Klassen'
|
|
1422 |
"
|
|
1423 |
|
|
1424 |
"Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
|
|
1425 |
"Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
|
|
1426 |
"Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
|
|
1427 |
!
|
|
1428 |
|
3781
|
1429 |
findComponent:componentNameOrPath in:anApplicationOrViewOrMenuItem
|
3780
|
1430 |
"find a component by name inside an app or inside a view.
|
3727
|
1431 |
Uses the NameKey of the spec, and optionally the label or modelKey.
|
|
1432 |
Can return either a view or a menu item"
|
|
1433 |
|
3798
|
1434 |
|quoted idxString idx app window component componentNameSymbol
|
3793
|
1435 |
foundByName foundByHelpKey foundByTitle foundByLabel item
|
3780
|
1436 |
checkIfAllMenuItemsDoTheSame|
|
|
1437 |
|
3798
|
1438 |
"/ split at "/";
|
|
1439 |
"/ but not if inside quotes
|
|
1440 |
quoted := false.
|
|
1441 |
componentNameOrPath doWithIndex:[:ch :idx |
|
|
1442 |
ch == $" ifTrue:[
|
|
1443 |
quoted := quoted not.
|
|
1444 |
] ifFalse:[
|
|
1445 |
((ch == $/) and:[quoted not]) ifTrue:[
|
|
1446 |
|containerName restPath container|
|
3780
|
1447 |
|
3798
|
1448 |
containerName := componentNameOrPath copyTo:idx-1.
|
|
1449 |
restPath := componentNameOrPath copyFrom:idx+1.
|
|
1450 |
container := self findComponent:containerName in:anApplicationOrViewOrMenuItem.
|
|
1451 |
container isNil ifTrue:[ ^ nil ].
|
|
1452 |
^ self findComponent:restPath in:container
|
|
1453 |
]
|
3780
|
1454 |
]
|
|
1455 |
].
|
3798
|
1456 |
|
|
1457 |
(anApplicationOrViewOrMenuItem isKindOf:ItemInView) ifTrue:[
|
|
1458 |
anApplicationOrViewOrMenuItem isMenuItem ifTrue:[
|
|
1459 |
^ self findComponent:componentNameOrPath in:anApplicationOrViewOrMenuItem item submenu
|
|
1460 |
].
|
|
1461 |
].
|
|
1462 |
|
3797
|
1463 |
(componentNameOrPath startsWith:'item[') ifTrue:[
|
|
1464 |
idxString := (componentNameOrPath withoutPrefix:'item[') withoutSuffix:']'.
|
|
1465 |
(idxString conform:#isDigit) ifTrue:[
|
|
1466 |
idx := Integer readFrom:idxString.
|
|
1467 |
] ifFalse:[
|
3798
|
1468 |
idxString := idxString withoutQuotes.
|
3814
|
1469 |
idx := nil.
|
|
1470 |
].
|
|
1471 |
|
|
1472 |
(anApplicationOrViewOrMenuItem isKindOf:NoteBookView) ifTrue:[
|
|
1473 |
idx isNil ifTrue:[
|
|
1474 |
idxString includesMatchCharacters ifTrue:[
|
|
1475 |
idx := anApplicationOrViewOrMenuItem list
|
|
1476 |
findFirst:[:aTab| (aTab label matches:idxString)
|
|
1477 |
or:[aTab printableLabel matches:idxString]].
|
|
1478 |
] ifFalse:[
|
|
1479 |
idx := anApplicationOrViewOrMenuItem listIndexOf:idxString
|
|
1480 |
].
|
|
1481 |
].
|
|
1482 |
idx notNil ifTrue:[
|
|
1483 |
self halt.
|
|
1484 |
]
|
|
1485 |
] ifFalse:[
|
|
1486 |
anApplicationOrViewOrMenuItem isMenu ifFalse:[
|
|
1487 |
self assert:false message:'container is not a menu'.
|
|
1488 |
].
|
|
1489 |
"/ a menu item
|
|
1490 |
idx notNil ifTrue:[
|
|
1491 |
item := anApplicationOrViewOrMenuItem itemAtIndex:idx.
|
3798
|
1492 |
] ifFalse:[
|
3814
|
1493 |
idxString includesMatchCharacters ifTrue:[
|
|
1494 |
item :=
|
|
1495 |
anApplicationOrViewOrMenuItem itemForWhich:[:item |
|
|
1496 |
(idxString match:(item nameKey ? '') )
|
|
1497 |
or:[ (idxString match:(item textLabel ? ''))
|
|
1498 |
or:[ (item value isSymbol and:[idxString match:(item value)])]]
|
|
1499 |
]
|
|
1500 |
] ifFalse:[
|
|
1501 |
item :=
|
|
1502 |
anApplicationOrViewOrMenuItem itemForWhich:[:item |
|
|
1503 |
item nameKey = idxString
|
|
1504 |
or:[ item textLabel = idxString
|
|
1505 |
or:[ (item value isSymbol and:[ item value = idxString ])]]
|
|
1506 |
]
|
|
1507 |
].
|
3798
|
1508 |
].
|
3814
|
1509 |
self assert:item notNil message:('no menu item named "%1"' bindWith:idxString).
|
|
1510 |
^ ItemInView new view:anApplicationOrViewOrMenuItem item:item boundsInView:(item layout)
|
3797
|
1511 |
].
|
3796
|
1512 |
].
|
3797
|
1513 |
(componentNameOrPath startsWith:'tab[') ifTrue:[
|
3796
|
1514 |
(anApplicationOrViewOrMenuItem isKindOf:NoteBookView) ifFalse:[
|
|
1515 |
self assert:false message:'container is not a notebook'.
|
|
1516 |
].
|
3797
|
1517 |
idxString := (componentNameOrPath withoutPrefix:'tab[') withoutSuffix:']'.
|
|
1518 |
(idxString conform:#isDigit) ifTrue:[
|
|
1519 |
idx := Integer readFrom:idxString.
|
|
1520 |
item := anApplicationOrViewOrMenuItem tabAtIndex:idx.
|
|
1521 |
] ifFalse:[
|
3798
|
1522 |
idxString := idxString withoutQuotes.
|
3797
|
1523 |
item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab tabItem rawLabel = idxString].
|
|
1524 |
item isNil ifTrue:[
|
|
1525 |
item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab printableLabel = idxString].
|
|
1526 |
item isNil ifTrue:[
|
|
1527 |
item := anApplicationOrViewOrMenuItem tabForWhich:[:tab | tab activeHelpKey = idxString].
|
|
1528 |
].
|
|
1529 |
].
|
|
1530 |
].
|
|
1531 |
self assert:item notNil.
|
3796
|
1532 |
^ ItemInView new view:anApplicationOrViewOrMenuItem item:item boundsInView:(item layout)
|
3794
|
1533 |
].
|
3780
|
1534 |
|
|
1535 |
componentNameSymbol := componentNameOrPath asSymbolIfInterned ? componentNameOrPath.
|
3727
|
1536 |
|
3781
|
1537 |
(app := anApplicationOrViewOrMenuItem) isView ifTrue:[
|
|
1538 |
window := anApplicationOrViewOrMenuItem.
|
|
1539 |
app := anApplicationOrViewOrMenuItem application
|
3727
|
1540 |
].
|
3781
|
1541 |
app isApplicationModel ifTrue:[
|
3780
|
1542 |
(component := app componentAt:componentNameSymbol) notNil ifTrue:[^ component].
|
|
1543 |
window := window ? app window.
|
3781
|
1544 |
] ifFalse:[
|
3796
|
1545 |
(app askFor:#isMenuItem) ifTrue:[
|
3781
|
1546 |
window := app submenu.
|
|
1547 |
]
|
|
1548 |
].
|
3792
|
1549 |
window notNil ifTrue:[
|
|
1550 |
window shown ifFalse:[^ nil].
|
|
1551 |
].
|
|
1552 |
|
3727
|
1553 |
"/ mhmh - search through all widgets of anApplication;
|
|
1554 |
"/ maybe it was not created via the builder/spec,
|
|
1555 |
"/ or it has changed its name.
|
|
1556 |
"/ look for: widget's name, widget's title, widget's label
|
|
1557 |
foundByName := OrderedCollection new.
|
3793
|
1558 |
foundByHelpKey := OrderedCollection new.
|
3727
|
1559 |
foundByTitle := OrderedCollection new.
|
|
1560 |
foundByLabel := OrderedCollection new.
|
3792
|
1561 |
|
3780
|
1562 |
window withAllSubViewsDo:[:each |
|
3727
|
1563 |
|foundIt|
|
|
1564 |
|
|
1565 |
foundIt := false.
|
3780
|
1566 |
each shown ifTrue:[
|
3793
|
1567 |
{
|
|
1568 |
#name . foundByName .
|
|
1569 |
#helpKey . foundByHelpKey .
|
|
1570 |
#title . foundByTitle .
|
|
1571 |
#label . foundByLabel .
|
|
1572 |
} pairWiseDo:[:attr :coll |
|
3727
|
1573 |
foundIt ifFalse:[
|
3780
|
1574 |
[
|
3793
|
1575 |
(each perform:attr) = componentNameSymbol ifTrue:[
|
|
1576 |
coll add:each. foundIt := true
|
|
1577 |
]
|
3780
|
1578 |
] on:MessageNotUnderstood do:[:ex | ].
|
3793
|
1579 |
]
|
|
1580 |
].
|
|
1581 |
foundIt ifFalse:[
|
|
1582 |
each isMenu ifTrue:[
|
3799
|
1583 |
|comp|
|
|
1584 |
|
3793
|
1585 |
(item := each detectItemForNameKey:componentNameSymbol) notNil ifTrue:[
|
3799
|
1586 |
comp := ItemInView new view:each item:item boundsInView:(item layout).
|
|
1587 |
foundByName add:comp. foundIt := true
|
3793
|
1588 |
].
|
3780
|
1589 |
foundIt ifFalse:[
|
3793
|
1590 |
(item := each detectItemForKey:componentNameSymbol) notNil ifTrue:[
|
3799
|
1591 |
comp := ItemInView new view:each item:item boundsInView:(item layout).
|
|
1592 |
foundByName add:comp. foundIt := true
|
3780
|
1593 |
].
|
3793
|
1594 |
foundIt ifFalse:[
|
|
1595 |
(item := each detectItemForLabel:componentNameSymbol) notNil ifTrue:[
|
3799
|
1596 |
comp := ItemInView new view:each item:item boundsInView:(item layout).
|
|
1597 |
foundByLabel add:comp. foundIt := true
|
3793
|
1598 |
].
|
|
1599 |
].
|
3780
|
1600 |
].
|
3793
|
1601 |
].
|
3780
|
1602 |
].
|
3727
|
1603 |
].
|
|
1604 |
].
|
3780
|
1605 |
|
|
1606 |
"/ a check, if multiple menu items have the same action, then choose the first found
|
|
1607 |
checkIfAllMenuItemsDoTheSame :=
|
|
1608 |
[:itemsFound |
|
|
1609 |
|visibleItems|
|
|
1610 |
|
|
1611 |
(itemsFound conform:[:each | each askFor:#isMenuItem]) ifTrue:[
|
|
1612 |
(itemsFound collect:[:item | item itemValue]) asSet size == 1 ifTrue:[
|
|
1613 |
"/ choose one which is visible, if possible
|
3799
|
1614 |
visibleItems := itemsFound select:[:item | item view shown].
|
3780
|
1615 |
visibleItems notEmpty ifTrue:[
|
|
1616 |
^ visibleItems first
|
|
1617 |
].
|
|
1618 |
^ itemsFound first.
|
|
1619 |
].
|
|
1620 |
].
|
|
1621 |
].
|
|
1622 |
|
3727
|
1623 |
foundByName notEmpty ifTrue:[
|
3780
|
1624 |
checkIfAllMenuItemsDoTheSame value:foundByName.
|
3800
|
1625 |
foundByName size > 1 ifTrue:[
|
|
1626 |
|item|
|
|
1627 |
|
|
1628 |
(item := self chooseBestComponentFrom:foundByName) notNil ifTrue:[
|
|
1629 |
^ item
|
|
1630 |
].
|
|
1631 |
].
|
|
1632 |
self assert:(foundByName size == 1) message:('multiple components found by name: %1' bindWith:componentNameOrPath).
|
3727
|
1633 |
^ foundByName first.
|
|
1634 |
].
|
3793
|
1635 |
foundByHelpKey notEmpty ifTrue:[
|
|
1636 |
checkIfAllMenuItemsDoTheSame value:foundByHelpKey.
|
|
1637 |
self assert:(foundByHelpKey size == 1) message:'multiple components found by helpKey'.
|
|
1638 |
^ foundByHelpKey first.
|
|
1639 |
].
|
3727
|
1640 |
foundByTitle notEmpty ifTrue:[
|
3780
|
1641 |
checkIfAllMenuItemsDoTheSame value:foundByTitle.
|
3727
|
1642 |
self assert:(foundByTitle size == 1) message:'multiple components found by title'.
|
|
1643 |
^ foundByTitle first.
|
|
1644 |
].
|
|
1645 |
foundByLabel notEmpty ifTrue:[
|
3780
|
1646 |
checkIfAllMenuItemsDoTheSame value:foundByLabel.
|
3801
|
1647 |
self assert:(foundByLabel size == 1) message:('multiple components found by label: %1' bindWith:componentNameOrPath).
|
3727
|
1648 |
^ foundByLabel first.
|
|
1649 |
].
|
|
1650 |
^ component
|
|
1651 |
|
|
1652 |
"
|
|
1653 |
self basicNew findComponent:'Klassen' in:(Transcript topView)
|
|
1654 |
"
|
|
1655 |
|
|
1656 |
"Created: / 19-07-2019 / 11:36:21 / Claus Gittinger"
|
|
1657 |
"Modified (comment): / 23-07-2019 / 09:31:34 / Claus Gittinger"
|
3700
|
1658 |
!
|
|
1659 |
|
3787
|
1660 |
findComponent:componentName inAllApplications:inAllApplicationsBool ifMultiple:exceptionalValue
|
|
1661 |
"find a component by name - in the active and possibly in any app.
|
|
1662 |
Can return either a view or a menu item"
|
|
1663 |
|
|
1664 |
|component candidates modalGroup|
|
|
1665 |
|
|
1666 |
application notNil ifTrue:[
|
|
1667 |
(component := self findComponent:componentName in:application) notNil ifTrue:[
|
|
1668 |
^ component.
|
|
1669 |
].
|
|
1670 |
].
|
|
1671 |
candidates := OrderedCollection new.
|
|
1672 |
|
|
1673 |
"/ is there a modal dialog open for the app?
|
|
1674 |
(modalGroup := application windowGroup modalGroup) notNil ifTrue:[
|
|
1675 |
modalGroup topViews do:[:eachModalTopView |
|
|
1676 |
component := self findComponent:componentName in:eachModalTopView.
|
|
1677 |
component notNil ifTrue:[
|
|
1678 |
candidates add:component
|
|
1679 |
].
|
|
1680 |
].
|
|
1681 |
candidates size == 1 ifTrue:[
|
|
1682 |
^ candidates first
|
|
1683 |
].
|
|
1684 |
].
|
|
1685 |
inAllApplicationsBool ifTrue:[
|
|
1686 |
"/ search through all current applications
|
|
1687 |
WindowGroup scheduledWindowGroups do:[:eachWG |
|
|
1688 |
|eachApp|
|
|
1689 |
|
|
1690 |
(eachApp := eachWG application) notNil ifTrue:[
|
|
1691 |
component := self findComponent:componentName in:eachApp.
|
|
1692 |
component notNil ifTrue:[
|
|
1693 |
candidates add:component
|
|
1694 |
].
|
|
1695 |
].
|
|
1696 |
].
|
3792
|
1697 |
candidates isEmpty ifTrue:[
|
|
1698 |
Display allTopViews do:[:eachTopView |
|
|
1699 |
component := self findComponent:componentName in:eachTopView.
|
|
1700 |
component notNil ifTrue:[
|
|
1701 |
candidates add:component
|
|
1702 |
].
|
|
1703 |
]
|
|
1704 |
].
|
3787
|
1705 |
|
|
1706 |
candidates size == 1 ifTrue:[
|
|
1707 |
^ candidates first
|
|
1708 |
].
|
|
1709 |
candidates notEmpty ifTrue:[
|
|
1710 |
"/ multiple elements (probably there are multiple topviews open...
|
|
1711 |
"/ check the current windowGroup
|
|
1712 |
^ exceptionalValue value
|
|
1713 |
].
|
|
1714 |
].
|
|
1715 |
|
|
1716 |
^ nil
|
|
1717 |
|
|
1718 |
"
|
|
1719 |
ShowMeHowItWorks basicNew findComponent:'Classes'
|
|
1720 |
ShowMeHowItWorks basicNew findComponent:'Klassen'
|
|
1721 |
"
|
|
1722 |
|
|
1723 |
"Created: / 19-07-2019 / 12:02:30 / Claus Gittinger"
|
|
1724 |
"Modified: / 19-07-2019 / 16:44:30 / Claus Gittinger"
|
|
1725 |
"Modified (comment): / 23-07-2019 / 09:32:44 / Claus Gittinger"
|
|
1726 |
!
|
|
1727 |
|
3799
|
1728 |
pinPOForPin:pinName ofStep:stepName
|
|
1729 |
|diagramEditor pinPO|
|
|
1730 |
|
|
1731 |
(diagramEditor := lastComponent) isScrollWrapper ifTrue:[
|
|
1732 |
diagramEditor := lastComponent scrolledView
|
|
1733 |
].
|
|
1734 |
pinPO := diagramEditor
|
|
1735 |
detectPOForWhich:[:po |
|
|
1736 |
po isPin
|
|
1737 |
and:[ po name = pinName
|
|
1738 |
and:[ po owningStepPO name = stepName ]]
|
|
1739 |
].
|
|
1740 |
^ pinPO
|
|
1741 |
!
|
|
1742 |
|
3796
|
1743 |
screenBoundsOfComponent:aWidgetOrMenuItemOrTab
|
|
1744 |
|itemLayout|
|
|
1745 |
|
|
1746 |
aWidgetOrMenuItemOrTab isView ifTrue:[
|
|
1747 |
^ aWidgetOrMenuItemOrTab screenBounds
|
3780
|
1748 |
].
|
3796
|
1749 |
(aWidgetOrMenuItemOrTab askFor:#isMenuItem) ifTrue:[
|
3780
|
1750 |
|menuPanel menuBounds|
|
3717
|
1751 |
|
3796
|
1752 |
aWidgetOrMenuItemOrTab isVisible ifTrue:[
|
|
1753 |
(itemLayout := aWidgetOrMenuItemOrTab layout) notNil ifTrue:[
|
3798
|
1754 |
menuPanel := aWidgetOrMenuItemOrTab view.
|
3780
|
1755 |
menuPanel shown ifTrue:[
|
|
1756 |
menuBounds := menuPanel screenBounds.
|
3796
|
1757 |
^ itemLayout + menuBounds origin
|
3780
|
1758 |
].
|
|
1759 |
].
|
|
1760 |
].
|
3700
|
1761 |
].
|
3796
|
1762 |
(aWidgetOrMenuItemOrTab askFor:#isNoteBookTab) ifTrue:[
|
|
1763 |
(itemLayout := aWidgetOrMenuItemOrTab layout) notNil ifTrue:[
|
|
1764 |
|notebook notebookBounds|
|
|
1765 |
|
|
1766 |
notebook := aWidgetOrMenuItemOrTab view.
|
|
1767 |
notebook shown ifTrue:[
|
|
1768 |
notebookBounds := notebook screenBounds.
|
|
1769 |
^ itemLayout + notebookBounds origin
|
|
1770 |
].
|
|
1771 |
].
|
|
1772 |
self halt.
|
|
1773 |
].
|
3780
|
1774 |
^ nil.
|
3711
|
1775 |
! !
|
|
1776 |
|
3780
|
1777 |
!ShowMeHowItWorks methodsFor:'helpers - mouse buttons'!
|
3711
|
1778 |
|
|
1779 |
click:buttonNr inComponent:component
|
|
1780 |
"press-release in a component"
|
|
1781 |
|
|
1782 |
|t|
|
|
1783 |
|
|
1784 |
t := self shortClickTime.
|
3795
|
1785 |
((component isKindOf:Button)
|
|
1786 |
or:[(component askFor:#isMenuItem)]
|
|
1787 |
)ifTrue:[
|
3711
|
1788 |
t := self longClickTime
|
|
1789 |
].
|
|
1790 |
self click:buttonNr inComponent:component clickTime:t
|
|
1791 |
|
|
1792 |
"Created: / 19-07-2019 / 13:18:27 / Claus Gittinger"
|
|
1793 |
"Modified: / 19-07-2019 / 15:22:47 / Claus Gittinger"
|
|
1794 |
!
|
|
1795 |
|
3780
|
1796 |
click:buttonNr inComponent:viewOrMenuItem clickTime:clickTime
|
3711
|
1797 |
"press-release in a component"
|
|
1798 |
|
3795
|
1799 |
self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
|
3798
|
1800 |
Display activePointerGrab == Display rootView ifTrue:[
|
|
1801 |
|pos|
|
|
1802 |
|
|
1803 |
pos := Display translatePoint:clickPos fromView:viewToClick toView:nil.
|
|
1804 |
OperatingSystem isOSXlike ifTrue:[
|
|
1805 |
OperatingSystem
|
|
1806 |
generateMouseMoveEventX:pos x y:pos y;
|
|
1807 |
generateButtonEvent:buttonNr down:true x:pos x y:pos y;
|
3800
|
1808 |
yourself.
|
|
1809 |
Delay waitForSeconds:clickTime.
|
|
1810 |
OperatingSystem
|
3798
|
1811 |
generateButtonEvent:buttonNr down:false x:pos x y:pos y;
|
3800
|
1812 |
"/ generateButtonEvent:buttonNr down:true x:pos x y:pos y;
|
|
1813 |
"/ generateButtonEvent:buttonNr down:false x:pos x y:pos y;
|
|
1814 |
yourself.
|
3798
|
1815 |
^ self.
|
|
1816 |
].
|
|
1817 |
Display rootView simulateButtonPress:buttonNr at:pos sendDisplayEvent:true.
|
|
1818 |
Delay waitForSeconds:clickTime.
|
|
1819 |
Display rootView simulateButtonRelease:buttonNr at:pos sendDisplayEvent:true.
|
|
1820 |
] ifFalse:[
|
|
1821 |
viewToClick simulateButtonPress:buttonNr at:clickPos sendDisplayEvent:false.
|
|
1822 |
Delay waitForSeconds:clickTime.
|
|
1823 |
viewToClick simulateButtonRelease:buttonNr at:clickPos sendDisplayEvent:false.
|
|
1824 |
].
|
3795
|
1825 |
].
|
|
1826 |
!
|
|
1827 |
|
|
1828 |
press:buttonNr inComponent:viewOrMenuItem
|
|
1829 |
"press in a component"
|
|
1830 |
|
|
1831 |
self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
|
|
1832 |
viewToClick simulateButtonPress:buttonNr at:clickPos sendDisplayEvent:false.
|
|
1833 |
]
|
|
1834 |
!
|
|
1835 |
|
|
1836 |
release:buttonNr inComponent:viewOrMenuItem
|
|
1837 |
"release in a component"
|
|
1838 |
|
|
1839 |
self withViewAndPositionFor:viewOrMenuItem do:[:viewToClick :clickPos |
|
|
1840 |
viewToClick simulateButtonRelease:buttonNr at:clickPos sendDisplayEvent:false.
|
|
1841 |
]
|
|
1842 |
!
|
|
1843 |
|
|
1844 |
withViewAndPositionFor:viewOrMenuItem do:aBlock
|
|
1845 |
"helper for click, press and release"
|
|
1846 |
|
3780
|
1847 |
|viewToClick clickPos|
|
|
1848 |
|
|
1849 |
self assert:viewOrMenuItem notNil.
|
3775
|
1850 |
verifying ifTrue:[^ self].
|
|
1851 |
|
3798
|
1852 |
(viewOrMenuItem isKindOf:ItemInView) ifTrue:[
|
3797
|
1853 |
viewToClick := viewOrMenuItem view.
|
3780
|
1854 |
clickPos := viewOrMenuItem layout center.
|
|
1855 |
self assert:(clickPos notNil).
|
|
1856 |
] ifFalse:[
|
|
1857 |
viewToClick := viewOrMenuItem.
|
|
1858 |
clickPos := viewToClick extent // 2.
|
|
1859 |
].
|
3795
|
1860 |
aBlock value:viewToClick value:clickPos.
|
3700
|
1861 |
! !
|
|
1862 |
|
3780
|
1863 |
!ShowMeHowItWorks methodsFor:'helpers - mouse movement'!
|
|
1864 |
|
|
1865 |
circlePointerAroundComponent:aWidgetOrMenuItem
|
|
1866 |
"circle around it a few times"
|
|
1867 |
|
|
1868 |
|bounds position|
|
|
1869 |
|
|
1870 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
|
|
1871 |
bounds isNil ifTrue:[
|
|
1872 |
self error:'no bounds found for: ',aWidgetOrMenuItem printString.
|
|
1873 |
].
|
|
1874 |
position := bounds center rounded.
|
|
1875 |
self circlePointerAroundScreenPosition:position
|
|
1876 |
|
|
1877 |
"Created: / 19-07-2019 / 13:12:35 / Claus Gittinger"
|
|
1878 |
"Modified: / 23-07-2019 / 09:38:12 / Claus Gittinger"
|
|
1879 |
!
|
|
1880 |
|
|
1881 |
circlePointerAroundScreenPosition:position
|
|
1882 |
"circle around it a few times"
|
|
1883 |
|
|
1884 |
|screen stepDelayTime numCircles circlingSpeed radius|
|
|
1885 |
|
|
1886 |
verifying ifTrue:[^ self].
|
|
1887 |
|
|
1888 |
screen := Screen current.
|
|
1889 |
|
|
1890 |
circlingSpeed := self circlingSpeed. "/ time per round
|
|
1891 |
numCircles := self circlingCount.
|
|
1892 |
stepDelayTime := self pointerAnimationDelay. "/ update interval
|
|
1893 |
|
|
1894 |
radius := self circlingRadius.
|
|
1895 |
|
|
1896 |
"/ move it around a few times
|
|
1897 |
1 to:numCircles do:[:round |
|
|
1898 |
|n angle|
|
|
1899 |
|
|
1900 |
n := circlingSpeed / stepDelayTime. "/ nr of steps per circle
|
|
1901 |
angle := 360 / n. "/ angle-delta per step
|
|
1902 |
1 to:n do:[:step |
|
|
1903 |
|a x y|
|
|
1904 |
|
|
1905 |
a := angle * step.
|
|
1906 |
"/ clockwise starting above the center
|
|
1907 |
x := position x + (radius * a degreesToRadians sin).
|
|
1908 |
y := position y + (radius * a degreesToRadians cos).
|
|
1909 |
"/ Transcript showCR:(x@y).
|
|
1910 |
screen setPointerPosition:(x@y) rounded.
|
|
1911 |
screen flush.
|
|
1912 |
Delay waitFor:stepDelayTime.
|
|
1913 |
].
|
|
1914 |
"/ and back
|
|
1915 |
screen setPointerPosition:position rounded.
|
|
1916 |
screen flush.
|
|
1917 |
Delay waitFor:stepDelayTime.
|
|
1918 |
].
|
|
1919 |
|
|
1920 |
"Created: / 23-07-2019 / 09:37:46 / Claus Gittinger"
|
|
1921 |
!
|
|
1922 |
|
|
1923 |
fastMovePointerToScreenPosition:position
|
|
1924 |
self movePointerToScreenPosition:position speed:(self pointerMoveSpeedFast).
|
|
1925 |
|
|
1926 |
"Created: / 23-07-2019 / 09:36:20 / Claus Gittinger"
|
|
1927 |
!
|
|
1928 |
|
|
1929 |
movePointerToComponent:aWidgetOrMenuItem
|
|
1930 |
"move the mouse to aWidget's center"
|
|
1931 |
|
|
1932 |
|bounds|
|
|
1933 |
|
|
1934 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
|
|
1935 |
self movePointerToScreenPosition:(bounds center rounded).
|
|
1936 |
|
|
1937 |
"Created: / 19-07-2019 / 13:11:33 / Claus Gittinger"
|
|
1938 |
"Modified: / 23-07-2019 / 09:37:01 / Claus Gittinger"
|
|
1939 |
!
|
|
1940 |
|
|
1941 |
movePointerToComponent:aWidgetOrMenuItem offset:offset
|
|
1942 |
"move the mouse to position inside aWidget's"
|
|
1943 |
|
|
1944 |
|bounds|
|
|
1945 |
|
|
1946 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
|
|
1947 |
self movePointerToScreenPosition:(bounds origin + offset) rounded.
|
|
1948 |
|
|
1949 |
"Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
|
|
1950 |
"Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
|
|
1951 |
!
|
|
1952 |
|
3787
|
1953 |
movePointerToComponent:aWidgetOrMenuItem rightBottomOffset:offset
|
|
1954 |
"move the mouse to position inside aWidget's.
|
|
1955 |
Offset is from the rightBottom"
|
|
1956 |
|
|
1957 |
|bounds|
|
|
1958 |
|
|
1959 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
|
|
1960 |
self movePointerToScreenPosition:(bounds corner - offset) rounded.
|
|
1961 |
|
|
1962 |
"Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
|
|
1963 |
"Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
|
|
1964 |
!
|
|
1965 |
|
|
1966 |
movePointerToComponent:aWidgetOrMenuItem rightOffset:offset
|
|
1967 |
"move the mouse to position inside aWidget's.
|
|
1968 |
Offset is from the rightTop (i.e. x is subtracted, y is added)"
|
|
1969 |
|
|
1970 |
|bounds pos|
|
|
1971 |
|
|
1972 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItem.
|
|
1973 |
pos := (bounds right - offset x) @ (bounds top + offset y).
|
|
1974 |
self movePointerToScreenPosition:pos rounded.
|
|
1975 |
|
|
1976 |
"Created: / 19-07-2019 / 16:18:58 / Claus Gittinger"
|
|
1977 |
"Modified: / 23-07-2019 / 09:36:57 / Claus Gittinger"
|
|
1978 |
!
|
|
1979 |
|
3796
|
1980 |
movePointerToComponent:aWidgetOrMenuItemOrTab speed:pixelsPerSecond
|
3780
|
1981 |
"move the mouse to aWidget's center"
|
|
1982 |
|
|
1983 |
|bounds position|
|
|
1984 |
|
3796
|
1985 |
bounds := self screenBoundsOfComponent:aWidgetOrMenuItemOrTab.
|
3780
|
1986 |
bounds isNil ifTrue:[
|
3799
|
1987 |
self error:('no bounds found for: %1 (%2)' bindWith:lastComponentName with:aWidgetOrMenuItemOrTab printString).
|
3780
|
1988 |
].
|
|
1989 |
position := bounds center rounded.
|
|
1990 |
self movePointerToScreenPosition:position speed:pixelsPerSecond.
|
|
1991 |
|
|
1992 |
"Created: / 20-07-2019 / 08:12:49 / Claus Gittinger"
|
|
1993 |
"Modified: / 23-07-2019 / 09:37:27 / Claus Gittinger"
|
|
1994 |
!
|
|
1995 |
|
|
1996 |
movePointerToScreenPosition:newPosition
|
|
1997 |
"move the mouse to newPosition"
|
|
1998 |
|
|
1999 |
self movePointerToScreenPosition:newPosition speed:(self pointerMoveSpeed)
|
|
2000 |
|
|
2001 |
"Created: / 23-07-2019 / 09:36:39 / Claus Gittinger"
|
|
2002 |
!
|
|
2003 |
|
|
2004 |
movePointerToScreenPosition:newPosition speed:pixelsPerSecond
|
|
2005 |
"move the mouse to newPosition, which is a screen position"
|
|
2006 |
|
|
2007 |
|screen distance start numSteps moveTime stepDelayTime delta|
|
|
2008 |
|
|
2009 |
verifying ifTrue:[^ self].
|
|
2010 |
|
|
2011 |
screen := Screen current.
|
|
2012 |
start := screen pointerPosition.
|
|
2013 |
|
|
2014 |
distance := start dist:newPosition.
|
3798
|
2015 |
distance = 0 ifTrue:[
|
|
2016 |
"/ already there
|
|
2017 |
screen setPointerPosition:newPosition. "/ do it anyway, in case of rounding errors
|
|
2018 |
^ self
|
|
2019 |
].
|
|
2020 |
|
3780
|
2021 |
moveTime := (distance / pixelsPerSecond) seconds. "/ time to move
|
|
2022 |
stepDelayTime := self pointerAnimationDelay. "/ update every 50ms
|
|
2023 |
|
|
2024 |
numSteps := moveTime / stepDelayTime.
|
|
2025 |
numSteps = 0 ifTrue:[
|
|
2026 |
"/ already there
|
3798
|
2027 |
screen setPointerPosition:newPosition. "/ do it anyway, in case of rounding errors
|
3780
|
2028 |
^ self
|
|
2029 |
].
|
|
2030 |
|
|
2031 |
delta := (newPosition - start) / numSteps.
|
|
2032 |
1 to:numSteps do:[:step |
|
|
2033 |
|p|
|
|
2034 |
|
|
2035 |
p := (start + (delta * step)) rounded.
|
|
2036 |
"/ Transcript showCR:p.
|
|
2037 |
screen setPointerPosition:p.
|
|
2038 |
screen flush.
|
|
2039 |
Delay waitFor:stepDelayTime.
|
|
2040 |
].
|
|
2041 |
|
|
2042 |
"Created: / 23-07-2019 / 09:36:45 / Claus Gittinger"
|
3796
|
2043 |
!
|
|
2044 |
|
|
2045 |
where:where inComponent:aComponent
|
|
2046 |
where == #center ifTrue:[
|
|
2047 |
^ aComponent center
|
|
2048 |
].
|
|
2049 |
where == #leftCenter ifTrue:[
|
|
2050 |
^ aComponent leftCenter + (5@0).
|
|
2051 |
].
|
|
2052 |
where == #rightCenter ifTrue:[
|
|
2053 |
^ aComponent rightCenter - (5@0).
|
|
2054 |
].
|
|
2055 |
where == #topLeft ifTrue:[
|
|
2056 |
^ aComponent topLeft + (5@5).
|
|
2057 |
].
|
|
2058 |
where == #topCenter ifTrue:[
|
|
2059 |
^ aComponent topCenter + (0@5).
|
|
2060 |
].
|
|
2061 |
where == #topRight ifTrue:[
|
|
2062 |
^ aComponent topRight - (5@5).
|
|
2063 |
].
|
|
2064 |
where == #bottomCenter ifTrue:[
|
|
2065 |
^ aComponent bottomCenter - (0 @ 5)
|
|
2066 |
].
|
|
2067 |
where == #bottomLeft ifTrue:[
|
|
2068 |
^ aComponent bottomLeft + (5 @ -5)
|
|
2069 |
].
|
|
2070 |
where == #bottomRight ifTrue:[
|
|
2071 |
^ aComponent bottomLeft - (5 @ 5)
|
|
2072 |
].
|
|
2073 |
self error:'where is this'
|
3780
|
2074 |
! !
|
|
2075 |
|
3700
|
2076 |
!ShowMeHowItWorks methodsFor:'running'!
|
|
2077 |
|
3728
|
2078 |
do:specArray
|
|
2079 |
"must run as a separate process;
|
|
2080 |
otherwise - if started by the app itself -
|
|
2081 |
no events will be processed while running"
|
3784
|
2082 |
|
3790
|
2083 |
"/ StartLabel := nil.
|
|
2084 |
"/ StartLabel := 'start'.
|
|
2085 |
self do:specArray from:StartLabel
|
3787
|
2086 |
|
3784
|
2087 |
|
|
2088 |
"
|
|
2089 |
ShowMeHowItWorks do:
|
|
2090 |
#(
|
|
2091 |
(show: 'blah blah')
|
|
2092 |
(moveTo: NameOfComponent)
|
|
2093 |
)
|
|
2094 |
"
|
|
2095 |
|
|
2096 |
"Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
|
|
2097 |
"Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
|
|
2098 |
!
|
|
2099 |
|
3787
|
2100 |
do:specArray from:startLabelOrNil withUI:withUIBoolean
|
|
2101 |
"must run as a separate process;
|
|
2102 |
otherwise - if started by the app itself -
|
|
2103 |
no events will be processed while running"
|
|
2104 |
|
|
2105 |
withUIBoolean ifTrue:[
|
|
2106 |
ui := ShowMeHowItWorksRunner openOn:self.
|
|
2107 |
].
|
|
2108 |
self do:specArray from:startLabelOrNil
|
|
2109 |
|
|
2110 |
"
|
|
2111 |
ShowMeHowItWorks
|
|
2112 |
do:#(
|
|
2113 |
(show: 'blah blah')
|
|
2114 |
(moveTo: NameOfComponent)
|
|
2115 |
)
|
|
2116 |
withUI:true
|
|
2117 |
"
|
|
2118 |
|
|
2119 |
"Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
|
|
2120 |
"Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
|
|
2121 |
!
|
|
2122 |
|
3784
|
2123 |
do:specArray withUI:withUIBoolean
|
|
2124 |
"must run as a separate process;
|
|
2125 |
otherwise - if started by the app itself -
|
|
2126 |
no events will be processed while running"
|
|
2127 |
|
|
2128 |
withUIBoolean ifTrue:[
|
|
2129 |
ui := ShowMeHowItWorksRunner openOn:self.
|
|
2130 |
].
|
3787
|
2131 |
self do:specArray from:nil
|
3784
|
2132 |
|
|
2133 |
"
|
|
2134 |
ShowMeHowItWorks
|
|
2135 |
do:#(
|
|
2136 |
(show: 'blah blah')
|
|
2137 |
(moveTo: NameOfComponent)
|
|
2138 |
)
|
|
2139 |
withUI:true
|
|
2140 |
"
|
|
2141 |
|
|
2142 |
"Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
|
|
2143 |
"Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
|
|
2144 |
!
|
|
2145 |
|
3795
|
2146 |
doShowFile:aFilename
|
|
2147 |
"the file from which the show was loaded"
|
|
2148 |
|
|
2149 |
|spec|
|
|
2150 |
|
|
2151 |
theShowFile := aFilename.
|
|
2152 |
aFilename readingFileWithEncoding:#utf8 do:[:s |
|
|
2153 |
spec := Array readFrom:s.
|
|
2154 |
].
|
|
2155 |
self do:spec.
|
|
2156 |
|
|
2157 |
|
|
2158 |
!
|
|
2159 |
|
3784
|
2160 |
prepare
|
3775
|
2161 |
language isNil ifTrue:[
|
3795
|
2162 |
self setLanguage:(Smalltalk language).
|
3775
|
2163 |
].
|
3728
|
2164 |
translate := false.
|
|
2165 |
|
|
2166 |
application isNil ifTrue:[
|
|
2167 |
application := WindowGroup activeMainApplication.
|
|
2168 |
].
|
3780
|
2169 |
closeApplicationWhenFinished := false.
|
3783
|
2170 |
defaultComponentWaitTime isNil ifTrue:[ defaultComponentWaitTime := 1 ].
|
3775
|
2171 |
|
3784
|
2172 |
"Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
|
|
2173 |
"Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
|
|
2174 |
!
|
|
2175 |
|
|
2176 |
verify:specArray
|
3775
|
2177 |
"/ run in verifying mode
|
|
2178 |
verifying := true.
|
3728
|
2179 |
[
|
|
2180 |
Error handle:[:ex |
|
3784
|
2181 |
Transcript showCR:('Possible error (encountered while verifying):\.... %1' withCRs)
|
|
2182 |
with:ex description withCRs.
|
3776
|
2183 |
Display ctrlDown ifTrue:[ex reject].
|
3728
|
2184 |
] do:[
|
3784
|
2185 |
self show:' '. "/ to avoid an audible disturbance on OSX
|
3728
|
2186 |
self doStream:(specArray readStream)
|
|
2187 |
].
|
3775
|
2188 |
] ensure:[
|
|
2189 |
verifying := false.
|
|
2190 |
].
|
|
2191 |
! !
|
|
2192 |
|
|
2193 |
!ShowMeHowItWorks methodsFor:'running - private'!
|
3728
|
2194 |
|
3787
|
2195 |
do:specArray from:startLabelOrNil
|
|
2196 |
"must run as a separate process;
|
|
2197 |
otherwise - if started by the app itself -
|
|
2198 |
no events will be processed while running"
|
|
2199 |
|
3790
|
2200 |
|wasFlyByActive|
|
3787
|
2201 |
|
3790
|
2202 |
(wasFlyByActive := FlyByHelp isSuspended) ifFalse:[
|
|
2203 |
FlyByHelp suspend.
|
3787
|
2204 |
].
|
3790
|
2205 |
|
3787
|
2206 |
self prepare.
|
|
2207 |
|
|
2208 |
"/ run once in verifying mode
|
|
2209 |
[
|
|
2210 |
self verify:specArray.
|
|
2211 |
] ensure:[
|
3790
|
2212 |
wasFlyByActive ifTrue:[FlyByHelp resume].
|
3787
|
2213 |
].
|
|
2214 |
|
|
2215 |
[
|
3790
|
2216 |
FlyByHelp suspend.
|
|
2217 |
|
3787
|
2218 |
[
|
|
2219 |
Error handle:[:ex |
|
|
2220 |
Dialog warn:(self class classResources
|
|
2221 |
stringWithCRs:'An error was encountered in the show:\\%1'
|
|
2222 |
with:ex description withCRs)
|
|
2223 |
] do:[
|
|
2224 |
self doStream:(specArray readStream) from:startLabelOrNil
|
|
2225 |
].
|
|
2226 |
] ensure:[
|
3790
|
2227 |
wasFlyByActive ifTrue:[FlyByHelp resume].
|
3787
|
2228 |
].
|
|
2229 |
] fork.
|
|
2230 |
|
|
2231 |
"
|
|
2232 |
ShowMeHowItWorks do:
|
|
2233 |
#(
|
|
2234 |
(show: 'blah blah')
|
|
2235 |
(moveTo: NameOfComponent)
|
|
2236 |
)
|
|
2237 |
"
|
|
2238 |
|
|
2239 |
"Created: / 23-07-2019 / 10:24:53 / Claus Gittinger"
|
|
2240 |
"Modified: / 25-07-2019 / 11:48:53 / Claus Gittinger"
|
|
2241 |
!
|
|
2242 |
|
3711
|
2243 |
doCommand:op
|
3727
|
2244 |
"execute a single command"
|
|
2245 |
|
3711
|
2246 |
|numArgs sel args method|
|
|
2247 |
|
|
2248 |
op isArray ifTrue:[
|
|
2249 |
op first isArray ifTrue:[
|
|
2250 |
self doStream:op readStream.
|
|
2251 |
^ self.
|
|
2252 |
].
|
|
2253 |
|
|
2254 |
"/ construct a selector from keyword parts at odd indices
|
|
2255 |
sel := ((op with:(1 to:op size) select:[:el :idx | idx odd]) asStringWith:'') asSymbol.
|
|
2256 |
"/ construct arg vector from parts at even indices
|
|
2257 |
args := op with:(1 to:op size) select:[:el :idx | idx even].
|
|
2258 |
] ifFalse:[
|
|
2259 |
sel := op.
|
|
2260 |
numArgs := sel argumentCount.
|
|
2261 |
args := opStream next:numArgs.
|
|
2262 |
].
|
|
2263 |
|
|
2264 |
(self respondsTo:sel) ifFalse:[
|
|
2265 |
self error:'bad operation: ',sel
|
|
2266 |
].
|
|
2267 |
method := self class lookupMethodFor:sel.
|
|
2268 |
(method hasAnnotation:#action) ifFalse:[self halt].
|
|
2269 |
|
|
2270 |
lastResult := self perform:sel withArguments:args.
|
|
2271 |
^ lastResult
|
|
2272 |
|
|
2273 |
"<<END
|
|
2274 |
ShowMeHowItWorks do:#(
|
|
2275 |
showing: 'Choose the number of arguments'
|
|
2276 |
do: (
|
|
2277 |
moveTo: NumberOfArguments
|
|
2278 |
select: '1'
|
|
2279 |
)
|
|
2280 |
showing: 'Click into the "receiver" field'
|
|
2281 |
do: (
|
|
2282 |
moveTo: ReceiverEditor
|
|
2283 |
click: ReceiverEditor
|
|
2284 |
)
|
|
2285 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2286 |
do: (
|
|
2287 |
enter: '100'
|
|
2288 |
)
|
|
2289 |
showing: 'Click into the "first argument" field'
|
|
2290 |
do: (
|
|
2291 |
moveTo: Arg1Editor
|
|
2292 |
click: ReceiverEditor
|
|
2293 |
)
|
|
2294 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2295 |
do: (
|
|
2296 |
enter: '100'
|
|
2297 |
)
|
|
2298 |
)
|
|
2299 |
END"
|
|
2300 |
|
|
2301 |
"Created: / 19-07-2019 / 15:34:55 / Claus Gittinger"
|
3727
|
2302 |
"Modified: / 23-07-2019 / 09:14:26 / Claus Gittinger"
|
3711
|
2303 |
!
|
|
2304 |
|
3700
|
2305 |
doStream:specStream
|
3787
|
2306 |
self doStream:specStream from:nil
|
|
2307 |
|
|
2308 |
"<<END
|
|
2309 |
ShowMeHowItWorks do:#(
|
|
2310 |
showing: 'Choose the number of arguments'
|
|
2311 |
do: (
|
|
2312 |
moveTo: NumberOfArguments
|
|
2313 |
select: '1'
|
|
2314 |
)
|
|
2315 |
showing: 'Click into the "receiver" field'
|
|
2316 |
do: (
|
|
2317 |
moveTo: ReceiverEditor
|
|
2318 |
click: ReceiverEditor
|
|
2319 |
)
|
|
2320 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2321 |
do: (
|
|
2322 |
enter: '100'
|
|
2323 |
)
|
|
2324 |
showing: 'Click into the "first argument" field'
|
|
2325 |
do: (
|
|
2326 |
moveTo: Arg1Editor
|
|
2327 |
click: ReceiverEditor
|
|
2328 |
)
|
|
2329 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2330 |
do: (
|
|
2331 |
enter: '100'
|
|
2332 |
)
|
|
2333 |
)
|
|
2334 |
END"
|
|
2335 |
|
|
2336 |
"Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
|
|
2337 |
"Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
|
|
2338 |
!
|
|
2339 |
|
|
2340 |
doStream:specStream from:startLabelOrNil
|
3715
|
2341 |
|previousStream resources|
|
3700
|
2342 |
|
3715
|
2343 |
resources := self class classResources.
|
3783
|
2344 |
|
|
2345 |
streamStack isNil ifTrue:[ streamStack := OrderedCollection new ].
|
|
2346 |
streamStack add:opStream.
|
|
2347 |
|
3700
|
2348 |
previousStream := opStream.
|
|
2349 |
[
|
3787
|
2350 |
|nextCommand|
|
|
2351 |
|
3700
|
2352 |
opStream := specStream.
|
3787
|
2353 |
startLabelOrNil notNil ifTrue:[
|
|
2354 |
|found|
|
|
2355 |
|
|
2356 |
"/ skip for that label
|
|
2357 |
found := false.
|
|
2358 |
[ found ] whileFalse:[
|
|
2359 |
|cmd|
|
|
2360 |
|
|
2361 |
cmd := opStream nextOrNil.
|
|
2362 |
cmd isNil ifTrue:[
|
|
2363 |
self proceedableError:'label not found: ',startLabelOrNil.
|
|
2364 |
^ self.
|
|
2365 |
].
|
|
2366 |
(cmd = 'label:') ifTrue:[
|
|
2367 |
found := (opStream next = startLabelOrNil)
|
|
2368 |
].
|
|
2369 |
].
|
|
2370 |
].
|
|
2371 |
|
3700
|
2372 |
[opStream atEnd] whileFalse:[
|
3787
|
2373 |
nextCommand := opStream next.
|
|
2374 |
self doCommand:nextCommand.
|
|
2375 |
|
3700
|
2376 |
Display shiftDown ifTrue:[
|
3728
|
2377 |
(IntroShownCount ? 0) > 3 ifFalse:[
|
3738
|
2378 |
self tell:(self possiblyTranslate:'You pressed the SHIFT key.').
|
3728
|
2379 |
].
|
3738
|
2380 |
self tell:(self possiblyTranslate:'Do you want to stop the show?').
|
3715
|
2381 |
(Dialog confirm:(resources stringWithCRs:'Stop the demonstration?'))
|
3714
|
2382 |
ifTrue:[
|
3738
|
2383 |
self tell:(self possiblyTranslate:'OK,').
|
|
2384 |
self tell:(self possiblyTranslate:(self randomThankYou)).
|
3714
|
2385 |
^ AbortOperationRequest raise
|
|
2386 |
].
|
3700
|
2387 |
].
|
|
2388 |
].
|
|
2389 |
] ensure:[
|
3783
|
2390 |
streamStack removeLast.
|
3700
|
2391 |
opStream := previousStream
|
|
2392 |
].
|
|
2393 |
|
|
2394 |
"<<END
|
|
2395 |
ShowMeHowItWorks do:#(
|
|
2396 |
showing: 'Choose the number of arguments'
|
|
2397 |
do: (
|
|
2398 |
moveTo: NumberOfArguments
|
|
2399 |
select: '1'
|
|
2400 |
)
|
|
2401 |
showing: 'Click into the "receiver" field'
|
|
2402 |
do: (
|
|
2403 |
moveTo: ReceiverEditor
|
|
2404 |
click: ReceiverEditor
|
|
2405 |
)
|
|
2406 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2407 |
do: (
|
|
2408 |
enter: '100'
|
|
2409 |
)
|
|
2410 |
showing: 'Click into the "first argument" field'
|
|
2411 |
do: (
|
|
2412 |
moveTo: Arg1Editor
|
|
2413 |
click: ReceiverEditor
|
|
2414 |
)
|
|
2415 |
showing: 'Enter a value (or expression) into "receiver" field'
|
|
2416 |
do: (
|
|
2417 |
enter: '100'
|
|
2418 |
)
|
|
2419 |
)
|
|
2420 |
END"
|
|
2421 |
|
|
2422 |
"Created: / 19-07-2019 / 10:52:24 / Claus Gittinger"
|
3738
|
2423 |
"Modified: / 23-07-2019 / 11:48:45 / Claus Gittinger"
|
3700
|
2424 |
!
|
|
2425 |
|
3738
|
2426 |
possiblyTranslate:aString
|
|
2427 |
translate ifTrue:[^ self class classResources string:aString].
|
|
2428 |
^ aString
|
|
2429 |
|
|
2430 |
"Created: / 23-07-2019 / 11:48:17 / Claus Gittinger"
|
3700
|
2431 |
! !
|
|
2432 |
|
3796
|
2433 |
!ShowMeHowItWorks::ItemInView class methodsFor:'documentation'!
|
|
2434 |
|
|
2435 |
documentation
|
|
2436 |
"
|
|
2437 |
documentation to be added.
|
|
2438 |
|
|
2439 |
class:
|
|
2440 |
<a short class summary here, describing what instances represent>
|
|
2441 |
|
|
2442 |
responsibilities:
|
|
2443 |
<describing what my main role is>
|
|
2444 |
|
|
2445 |
collaborators:
|
|
2446 |
<describing with whom and how I talk to>
|
|
2447 |
|
|
2448 |
API:
|
|
2449 |
<public api and main messages>
|
|
2450 |
|
|
2451 |
example:
|
|
2452 |
<a one-line examples on how to use - can also be in a separate example method>
|
|
2453 |
|
|
2454 |
implementation:
|
|
2455 |
<implementation points>
|
|
2456 |
|
|
2457 |
[author:]
|
|
2458 |
exept MBP
|
|
2459 |
|
|
2460 |
[instance variables:]
|
|
2461 |
|
|
2462 |
[class variables:]
|
|
2463 |
|
|
2464 |
[see also:]
|
|
2465 |
|
|
2466 |
"
|
|
2467 |
! !
|
|
2468 |
|
|
2469 |
!ShowMeHowItWorks::ItemInView methodsFor:'accessing'!
|
|
2470 |
|
|
2471 |
boundsInView
|
|
2472 |
^ boundsInView
|
|
2473 |
!
|
|
2474 |
|
|
2475 |
item
|
|
2476 |
^ item
|
|
2477 |
!
|
|
2478 |
|
3799
|
2479 |
itemValue
|
|
2480 |
^ item itemValue
|
|
2481 |
!
|
|
2482 |
|
3796
|
2483 |
layout
|
|
2484 |
^ item layout
|
|
2485 |
!
|
|
2486 |
|
|
2487 |
view
|
|
2488 |
^ view
|
|
2489 |
!
|
|
2490 |
|
|
2491 |
view:viewArg item:itemArg boundsInView:boundsInViewArg
|
|
2492 |
view := viewArg.
|
|
2493 |
item := itemArg.
|
|
2494 |
boundsInView := boundsInViewArg.
|
|
2495 |
! !
|
|
2496 |
|
|
2497 |
!ShowMeHowItWorks::ItemInView methodsFor:'testing'!
|
|
2498 |
|
3798
|
2499 |
isItemInView
|
|
2500 |
^ true
|
|
2501 |
!
|
|
2502 |
|
3796
|
2503 |
isMenuItem
|
|
2504 |
^ item askFor:#isMenuItem
|
|
2505 |
!
|
|
2506 |
|
|
2507 |
isNoteBookTab
|
|
2508 |
^ item isKindOf:NoteBookView::Tab
|
3798
|
2509 |
!
|
|
2510 |
|
|
2511 |
isVisible
|
|
2512 |
^ view shown
|
|
2513 |
and:[item isVisible]
|
3796
|
2514 |
! !
|
|
2515 |
|
3700
|
2516 |
!ShowMeHowItWorks class methodsFor:'documentation'!
|
|
2517 |
|
|
2518 |
version_CVS
|
|
2519 |
^ '$Header$'
|
|
2520 |
! !
|
|
2521 |
|