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