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
|
3799
|
11 |
theShowFile defaultElementTimeout'
|
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
|
|
223 |
"if set, only that application is presented (widget search is limtied to that one)"
|
|
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 |
|
3798
|
237 |
freezePin:pinName ofStep:stepName with:freezeString
|
|
238 |
<action>
|
|
239 |
|
|
240 |
|diagramEditor pinPO|
|
|
241 |
|
|
242 |
(diagramEditor := lastComponent) isScrollWrapper ifTrue:[
|
|
243 |
diagramEditor := lastComponent scrolledView
|
|
244 |
].
|
3799
|
245 |
pinPO := self pinPOForPin:pinName ofStep:stepName.
|
|
246 |
|
3798
|
247 |
diagramEditor selection:{ pinPO }.
|
|
248 |
diagramEditor doubleClickOn:pinPO.
|
|
249 |
self fastMoveTo:(lastComponentName,'/','EditField').
|
|
250 |
self click.
|
3800
|
251 |
self clear.
|
3798
|
252 |
self type:freezeString.
|
|
253 |
self key:#Return.
|
|
254 |
!
|
|
255 |
|
3711
|
256 |
intro
|
|
257 |
<action>
|
3724
|
258 |
|
3775
|
259 |
verifying ifTrue:[^ self].
|
|
260 |
|
|
261 |
IntroShownCount := (IntroShownCount ? 0).
|
|
262 |
|
3728
|
263 |
"/ only say this a few times..
|
|
264 |
IntroShownCount > 3 ifTrue:[^ self].
|
3775
|
265 |
IntroShownCount := IntroShownCount + 1.
|
|
266 |
|
3795
|
267 |
language isNil ifTrue:[
|
|
268 |
self setLanguage:(Smalltalk language).
|
|
269 |
].
|
3724
|
270 |
self tell:(self class classResources
|
3733
|
271 |
string:'You can stop this show, by pressing the SHIFT key').
|
3711
|
272 |
|
|
273 |
"Created: / 19-07-2019 / 15:49:19 / Claus Gittinger"
|
3733
|
274 |
"Modified: / 23-07-2019 / 11:06:13 / Claus Gittinger"
|
3728
|
275 |
!
|
|
276 |
|
3787
|
277 |
label:nameOfLabel
|
|
278 |
<action>
|
|
279 |
|
|
280 |
"/ skipped here; see goto
|
|
281 |
!
|
|
282 |
|
3728
|
283 |
language:lang
|
|
284 |
<action>
|
|
285 |
|
3795
|
286 |
self setLanguage:lang.
|
3728
|
287 |
translate := false.
|
|
288 |
|
|
289 |
"Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
|
3711
|
290 |
!
|
|
291 |
|
3780
|
292 |
open:applicationClassName
|
|
293 |
<action>
|
|
294 |
|
|
295 |
|appClass|
|
|
296 |
|
|
297 |
(appClass := Smalltalk classNamed:applicationClassName) isNil ifTrue:[
|
|
298 |
self error:'no such application class'
|
|
299 |
].
|
|
300 |
verifying ifFalse:[
|
|
301 |
application := appClass new openAndWaitUntilVisible.
|
|
302 |
closeApplicationWhenFinished := true.
|
|
303 |
].
|
|
304 |
|
|
305 |
"Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
|
|
306 |
!
|
|
307 |
|
3700
|
308 |
pause
|
|
309 |
<action>
|
|
310 |
|
3724
|
311 |
Dialog information:(self class classResources
|
|
312 |
stringWithCRs:'Show Paused.\Click on "OK" to proceed')
|
3700
|
313 |
|
|
314 |
"Created: / 19-07-2019 / 15:03:17 / Claus Gittinger"
|
3711
|
315 |
"Modified: / 19-07-2019 / 16:13:33 / Claus Gittinger"
|
3700
|
316 |
!
|
|
317 |
|
3776
|
318 |
raise:what
|
|
319 |
<action>
|
|
320 |
|
|
321 |
verifying ifTrue:[^ self].
|
|
322 |
|
|
323 |
what == #application ifTrue:[
|
|
324 |
application topView raise.
|
|
325 |
^ self
|
|
326 |
].
|
|
327 |
what == #masterApplication ifTrue:[
|
|
328 |
application windowGroup isModal ifTrue:[
|
|
329 |
application windowGroup mainGroup topViews first raise
|
|
330 |
] ifFalse:[
|
|
331 |
(application masterApplication ? application) topViews first raise.
|
|
332 |
].
|
|
333 |
^ self
|
|
334 |
].
|
|
335 |
self halt.
|
|
336 |
!
|
|
337 |
|
3798
|
338 |
selectPin:pinName ofStep:stepName
|
|
339 |
<action>
|
|
340 |
|
3800
|
341 |
|diagramEditor pinPO count|
|
3798
|
342 |
|
|
343 |
(diagramEditor := lastComponent) isScrollWrapper ifTrue:[
|
|
344 |
diagramEditor := lastComponent scrolledView
|
|
345 |
].
|
3800
|
346 |
|
|
347 |
count := 0.
|
|
348 |
[
|
|
349 |
Delay waitForSeconds:0.1.
|
|
350 |
pinPO := self pinPOForPin:pinName ofStep:stepName.
|
|
351 |
] doWhile:[pinPO isNil and:[ (count := count+1) < 20]].
|
|
352 |
|
|
353 |
self movePointerToComponent:diagramEditor offset:(pinPO frame center).
|
3799
|
354 |
diagramEditor selection:{ pinPO }.
|
3798
|
355 |
!
|
|
356 |
|
3711
|
357 |
show:message
|
3714
|
358 |
"showing (and speak) some message."
|
3711
|
359 |
|
|
360 |
<action>
|
|
361 |
|
3776
|
362 |
self showing:message saying:nil do:nil
|
3711
|
363 |
|
|
364 |
"Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
|
3714
|
365 |
"Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
|
|
366 |
!
|
|
367 |
|
|
368 |
show:message for:seconds
|
|
369 |
"showing (and speak) some message and wait for some time."
|
|
370 |
|
|
371 |
<action>
|
3780
|
372 |
|
|
373 |
DebugMode == true ifTrue:[^ self].
|
|
374 |
|
3714
|
375 |
self show:message.
|
|
376 |
self wait:seconds.
|
|
377 |
|
|
378 |
"Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
|
3711
|
379 |
!
|
|
380 |
|
3776
|
381 |
show:message saying:sentenceOrNil
|
|
382 |
"showing (and speak) some message."
|
|
383 |
|
|
384 |
<action>
|
|
385 |
|
|
386 |
self showing:message saying:sentenceOrNil do:nil
|
|
387 |
|
|
388 |
"Created: / 19-07-2019 / 15:59:18 / Claus Gittinger"
|
|
389 |
"Modified (comment): / 19-07-2019 / 18:54:36 / Claus Gittinger"
|
|
390 |
!
|
|
391 |
|
|
392 |
show:message saying:sentenceOrNil for:seconds
|
|
393 |
"showing (and speak) some message and wait for some time."
|
|
394 |
|
|
395 |
<action>
|
|
396 |
|
3780
|
397 |
DebugMode == true ifTrue:[^ self].
|
3776
|
398 |
self show:message saying:sentenceOrNil.
|
|
399 |
self wait:seconds.
|
|
400 |
|
|
401 |
"Created: / 19-07-2019 / 18:54:20 / Claus Gittinger"
|
|
402 |
!
|
|
403 |
|
3711
|
404 |
showing:message do:operationsOrNothing
|
3714
|
405 |
"execute operationsOrNothing while showing (and speaking) some message."
|
3700
|
406 |
|
|
407 |
<action>
|
|
408 |
|
3776
|
409 |
self showing:message saying:nil do:operationsOrNothing
|
|
410 |
!
|
|
411 |
|
|
412 |
showing:message saying:sentenceOrNil do:operationsOrNothing
|
|
413 |
"execute operationsOrNothing while showing (and speaking) some message."
|
|
414 |
|
|
415 |
<action>
|
|
416 |
|
3715
|
417 |
|xLatedMessage messageView talkDone|
|
3700
|
418 |
|
3728
|
419 |
xLatedMessage := (translate and:[application notNil])
|
|
420 |
ifTrue:[application resources string:message]
|
|
421 |
ifFalse:[message].
|
|
422 |
|
3711
|
423 |
self assert:(operationsOrNothing isNil or:[operationsOrNothing isSequenceable]).
|
3700
|
424 |
|
3715
|
425 |
messageView := ActiveHelpView for:xLatedMessage.
|
3700
|
426 |
"/ messageView shapeStyle:#cartoon.
|
|
427 |
[
|
3780
|
428 |
messageView origin:(Screen current pointerPosition + (0 @ 20)).
|
|
429 |
messageView makeFullyVisible.
|
3700
|
430 |
messageView realize.
|
|
431 |
|
|
432 |
self talking ifTrue:[
|
|
433 |
talkDone := Semaphore new.
|
|
434 |
[
|
3776
|
435 |
self tell:(sentenceOrNil ? xLatedMessage).
|
3700
|
436 |
talkDone signal
|
|
437 |
] fork.
|
|
438 |
|
|
439 |
"/
|
|
440 |
"/ allow speaker some headoff
|
3775
|
441 |
verifying ifFalse:[
|
|
442 |
Delay waitForSeconds:(xLatedMessage size / 15)+0.5.
|
|
443 |
].
|
3700
|
444 |
].
|
|
445 |
|
3711
|
446 |
operationsOrNothing notEmptyOrNil ifTrue:[
|
|
447 |
self doStream:(operationsOrNothing readStream).
|
|
448 |
].
|
3700
|
449 |
] ensure:[
|
|
450 |
messageView destroy
|
|
451 |
].
|
|
452 |
self talking ifTrue:[
|
|
453 |
talkDone wait.
|
|
454 |
].
|
|
455 |
|
|
456 |
"Created: / 19-07-2019 / 11:19:27 / Claus Gittinger"
|
3728
|
457 |
"Modified: / 23-07-2019 / 10:52:30 / Claus Gittinger"
|
|
458 |
!
|
|
459 |
|
|
460 |
thankyou
|
|
461 |
<action>
|
|
462 |
|
|
463 |
self show:(self randomThankYou).
|
|
464 |
|
|
465 |
"Created: / 23-07-2019 / 10:50:43 / Claus Gittinger"
|
3700
|
466 |
!
|
|
467 |
|
3799
|
468 |
timeout:seconds
|
|
469 |
<action>
|
|
470 |
|
|
471 |
defaultElementTimeout := seconds.
|
|
472 |
|
|
473 |
"Created: / 23-07-2019 / 10:27:02 / Claus Gittinger"
|
|
474 |
!
|
|
475 |
|
3700
|
476 |
wait:seconds
|
|
477 |
<action>
|
|
478 |
|
3775
|
479 |
verifying ifTrue:[^ self].
|
3780
|
480 |
DebugMode == true ifTrue:[^ self].
|
3776
|
481 |
Display ctrlDown ifTrue:[^ self].
|
|
482 |
|
3700
|
483 |
Delay waitForSeconds:seconds
|
|
484 |
|
|
485 |
"Created: / 19-07-2019 / 15:09:45 / Claus Gittinger"
|
3780
|
486 |
!
|
|
487 |
|
|
488 |
waitFor:componentName timeout:seconds
|
|
489 |
<action>
|
|
490 |
|
3799
|
491 |
|endTime component|
|
3780
|
492 |
|
3781
|
493 |
verifying ifTrue:[^ self].
|
|
494 |
|
3799
|
495 |
lastComponentName := componentName.
|
3780
|
496 |
endTime := Timestamp now + seconds.
|
3787
|
497 |
[
|
3799
|
498 |
(component := self findComponent:componentName inAllApplications:true ifMultiple:nil) notNil ifTrue:[
|
|
499 |
lastComponent := component.
|
3780
|
500 |
^ self
|
|
501 |
].
|
3799
|
502 |
Delay waitForSeconds:0.1.
|
3780
|
503 |
Timestamp now > endTime ifTrue:[
|
|
504 |
self error:('component %1 not present after %2' bindWith:componentName with:seconds)
|
|
505 |
]
|
|
506 |
] loop
|
3700
|
507 |
! !
|
|
508 |
|
3711
|
509 |
!ShowMeHowItWorks methodsFor:'commands - checking'!
|
|
510 |
|
|
511 |
isEmpty:componentName
|
3799
|
512 |
"true if the addressed textview/field is empty.
|
|
513 |
Leaves component in lastComponent"
|
|
514 |
|
3711
|
515 |
<action>
|
|
516 |
|
|
517 |
|component|
|
|
518 |
|
|
519 |
component := self componentNamed:componentName.
|
|
520 |
component isScrollWrapper ifTrue:[ component := component scrolledView ].
|
|
521 |
component isTextView ifTrue:[
|
|
522 |
^ component contents isEmptyOrNil
|
|
523 |
].
|
3799
|
524 |
self error:'isEmpty: unhandled (non-text) component type: ',component displayString.
|
3711
|
525 |
|
|
526 |
"Created: / 19-07-2019 / 15:33:47 / Claus Gittinger"
|
|
527 |
!
|
|
528 |
|
|
529 |
unless:query do:actions
|
|
530 |
<action>
|
|
531 |
|
|
532 |
|result|
|
|
533 |
|
|
534 |
result := self doCommand:query.
|
|
535 |
result ifFalse:[
|
|
536 |
self doCommand:actions
|
|
537 |
].
|
|
538 |
|
|
539 |
"Created: / 19-07-2019 / 15:33:32 / Claus Gittinger"
|
|
540 |
! !
|
|
541 |
|
|
542 |
!ShowMeHowItWorks methodsFor:'commands - mouse & keyboard'!
|
|
543 |
|
3798
|
544 |
clear
|
3799
|
545 |
"clear entry fields of last component"
|
3798
|
546 |
|
|
547 |
<action>
|
|
548 |
|
|
549 |
verifying ifTrue:[^ self].
|
|
550 |
|
|
551 |
lastComponent contents:nil
|
|
552 |
!
|
|
553 |
|
3711
|
554 |
click
|
3799
|
555 |
"press-release in last component"
|
3711
|
556 |
|
|
557 |
<action>
|
|
558 |
|
|
559 |
^ self click:1 inComponent:lastComponent
|
|
560 |
|
|
561 |
"Created: / 19-07-2019 / 16:11:03 / Claus Gittinger"
|
|
562 |
!
|
3700
|
563 |
|
|
564 |
click:buttonNr
|
3799
|
565 |
"press-release in last component"
|
3700
|
566 |
|
|
567 |
<action>
|
|
568 |
|
3711
|
569 |
self assert:(buttonNr isInteger).
|
|
570 |
^ self click:buttonNr inComponent:lastComponent
|
3700
|
571 |
|
|
572 |
"Created: / 19-07-2019 / 13:21:20 / Claus Gittinger"
|
3711
|
573 |
"Modified: / 19-07-2019 / 16:10:19 / Claus Gittinger"
|
3700
|
574 |
!
|
|
575 |
|
3800
|
576 |
click:buttonNr clickTime:t
|
|
577 |
"press-release in last component"
|
|
578 |
|
|
579 |
<action>
|
|
580 |
|
|
581 |
self assert:(buttonNr isInteger).
|
|
582 |
^ self click:buttonNr inComponent:lastComponent clickTime:t
|
|
583 |
!
|
|
584 |
|
3711
|
585 |
clickIn:componentName
|
3799
|
586 |
"press-release.
|
|
587 |
Leaves component in lastComponent"
|
3711
|
588 |
|
|
589 |
<action>
|
|
590 |
|
|
591 |
^ self click:1 inComponent:(self componentNamed:componentName)
|
|
592 |
|
|
593 |
"Created: / 19-07-2019 / 16:09:58 / Claus Gittinger"
|
|
594 |
!
|
|
595 |
|
3787
|
596 |
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where
|
|
597 |
"drag an item (by index or label) from the current treeView,
|
|
598 |
into another component.
|
|
599 |
where is one of: #top, #center or #bottom.
|
|
600 |
allowed after moving to:
|
|
601 |
aSelectionInHierarchyView
|
|
602 |
"
|
|
603 |
|
|
604 |
<action>
|
|
605 |
|
3790
|
606 |
self drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:nil
|
|
607 |
!
|
|
608 |
|
|
609 |
drag:itemsIndexOrLabelOrPattern toComponent:targetComponentName dropAt:where show:textWhenDroppingOrNil
|
|
610 |
"drag an item (by index or label) from the current treeView,
|
|
611 |
into another component.
|
|
612 |
where is one of: #top, #center or #bottom.
|
|
613 |
allowed after moving to:
|
|
614 |
aSelectionInHierarchyView
|
|
615 |
"
|
|
616 |
|
|
617 |
<action>
|
|
618 |
|
3787
|
619 |
|sourceComponent targetComponent idx yPos sourcePos sourcePosOnScreen
|
3790
|
620 |
targetPos targetPosOnScreen targetPosInSource dNdMgr|
|
3787
|
621 |
|
|
622 |
verifying ifTrue:[^ self].
|
|
623 |
|
|
624 |
targetComponent := self findComponent:targetComponentName.
|
|
625 |
self assert:targetComponent notNil.
|
|
626 |
|
|
627 |
((sourceComponent := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
628 |
sourceComponent := sourceComponent scrolledView.
|
|
629 |
].
|
|
630 |
|
3796
|
631 |
targetPos := self where:where inComponent:targetComponent.
|
3790
|
632 |
|
|
633 |
(sourceComponent isKindOf:HierarchicalListView) ifTrue:[
|
3787
|
634 |
|
|
635 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
636 |
idx := itemsIndexOrLabelOrPattern
|
|
637 |
] ifFalse:[
|
|
638 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
639 |
idx := sourceComponent indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
640 |
] ifFalse:[
|
|
641 |
idx := sourceComponent indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
|
642 |
].
|
|
643 |
idx == 0 ifTrue:[
|
|
644 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
645 |
].
|
|
646 |
].
|
3796
|
647 |
|
3787
|
648 |
yPos := sourceComponent yVisibleOfLine:idx.
|
|
649 |
self movePointerToComponent:sourceComponent rightOffset:(10 @ (yPos + 3)).
|
|
650 |
Delay waitForSeconds:0.5.
|
|
651 |
sourcePosOnScreen := Display pointerPosition.
|
3796
|
652 |
sourcePos := Display translatePoint:sourcePosOnScreen fromView:nil toView:sourceComponent.
|
|
653 |
|
|
654 |
targetPosOnScreen := Display translatePoint:targetPos fromView:targetComponent toView:nil.
|
|
655 |
targetPosInSource := Display translatePoint:targetPosOnScreen fromView:nil toView:sourceComponent.
|
3787
|
656 |
|
3796
|
657 |
sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:false.
|
|
658 |
sourceComponent simulateButtonPress:1 at:sourcePos sendDisplayEvent:true.
|
|
659 |
Delay waitForSeconds:0.2.
|
3787
|
660 |
|
3790
|
661 |
dNdMgr := sourceComponent startDragAt:sourcePos.
|
|
662 |
|
|
663 |
textWhenDroppingOrNil notNil ifTrue:[
|
|
664 |
self show:textWhenDroppingOrNil.
|
|
665 |
].
|
|
666 |
|
|
667 |
Delay waitForSeconds:1.
|
3787
|
668 |
self movePointerToComponent:targetComponent offset:targetPos.
|
3790
|
669 |
Delay waitForSeconds:1.
|
|
670 |
dNdMgr buttonMotion:1 x:targetPos x y:targetPos y view:targetComponent.
|
3787
|
671 |
|
3790
|
672 |
dNdMgr buttonRelease:1 x:targetPos x y:targetPos y view:targetComponent.
|
3796
|
673 |
sourceComponent simulateButtonRelease:1 at:targetPos sendDisplayEvent:false.
|
3787
|
674 |
^ self
|
|
675 |
].
|
|
676 |
|
|
677 |
self error:'cannot expand in this component'
|
|
678 |
|
|
679 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
680 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
681 |
!
|
|
682 |
|
|
683 |
expand:itemsIndexOrLabelOrPattern
|
|
684 |
"expand an item in a treeView by label,
|
|
685 |
allowed after moving to:
|
|
686 |
aSelectionInHierarchyView
|
|
687 |
"
|
|
688 |
|
|
689 |
<action>
|
|
690 |
|
|
691 |
|component|
|
|
692 |
|
|
693 |
verifying ifTrue:[^ self].
|
|
694 |
|
|
695 |
((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
696 |
component := component scrolledView.
|
|
697 |
].
|
|
698 |
|
|
699 |
(component isKindOf:HierarchicalListView) ifTrue:[
|
|
700 |
|idx yPos|
|
|
701 |
|
|
702 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
703 |
idx := itemsIndexOrLabelOrPattern
|
|
704 |
] ifFalse:[
|
|
705 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
706 |
idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
707 |
] ifFalse:[
|
|
708 |
idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
|
709 |
].
|
|
710 |
idx == 0 ifTrue:[
|
|
711 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
712 |
].
|
|
713 |
].
|
|
714 |
yPos := component yVisibleOfLine:idx.
|
|
715 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
716 |
Delay waitForSeconds:0.5.
|
|
717 |
(component listAt:idx) expand.
|
|
718 |
^ self
|
|
719 |
].
|
|
720 |
|
|
721 |
self error:'cannot expand in this component'
|
|
722 |
|
|
723 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
724 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
725 |
!
|
|
726 |
|
3798
|
727 |
fastMoveRelativeX:dX y:dY
|
|
728 |
"move the mouse to a new relative position"
|
|
729 |
|
|
730 |
<action>
|
|
731 |
|
|
732 |
|screen newPos currentPos|
|
|
733 |
|
|
734 |
verifying ifTrue:[^ self].
|
|
735 |
|
|
736 |
screen := Screen current.
|
|
737 |
currentPos := screen pointerPosition.
|
|
738 |
newPos := currentPos + (dX @ dY).
|
|
739 |
self fastMovePointerToScreenPosition:newPos
|
|
740 |
!
|
|
741 |
|
3711
|
742 |
fastMoveTo:componentName
|
3799
|
743 |
"move the mouse to componentName without circling.
|
|
744 |
Leaves component in lastComponent"
|
3700
|
745 |
|
|
746 |
<action>
|
|
747 |
|
3711
|
748 |
|component|
|
3700
|
749 |
|
3711
|
750 |
component := self componentNamed:componentName.
|
3717
|
751 |
self movePointerToComponent:component speed:(self pointerMoveSpeedFast).
|
3711
|
752 |
|
3727
|
753 |
"
|
|
754 |
ShowMeHowItWorks basicNew fastMoveTo:'Classes'
|
|
755 |
ShowMeHowItWorks basicNew fastMoveTo:'Klassen'
|
|
756 |
"
|
|
757 |
|
3711
|
758 |
"Created: / 19-07-2019 / 15:39:23 / Claus Gittinger"
|
3717
|
759 |
"Modified: / 20-07-2019 / 08:14:16 / Claus Gittinger"
|
3727
|
760 |
"Modified (comment): / 23-07-2019 / 09:33:31 / Claus Gittinger"
|
3700
|
761 |
!
|
|
762 |
|
3798
|
763 |
key:aKeySymbol
|
3799
|
764 |
"press/release a key in last component"
|
3798
|
765 |
|
|
766 |
<action>
|
|
767 |
|
|
768 |
|t|
|
|
769 |
|
|
770 |
verifying ifTrue:[^ self].
|
|
771 |
|
|
772 |
t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
|
|
773 |
lastComponent
|
|
774 |
simulateKey:aKeySymbol at:(lastComponent extent // 2) sendDisplayEvent:false keyPressTime:t
|
|
775 |
|
|
776 |
"Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
|
|
777 |
!
|
|
778 |
|
3700
|
779 |
moveTo:componentName
|
|
780 |
"move the mouse to componentName,
|
3799
|
781 |
then circle around it a few times.
|
|
782 |
Leaves component in lastComponent"
|
3700
|
783 |
|
|
784 |
<action>
|
|
785 |
|
|
786 |
|component|
|
|
787 |
|
3711
|
788 |
component := self componentNamed:componentName.
|
3700
|
789 |
self movePointerToComponent:component.
|
3776
|
790 |
Display ctrlDown ifTrue:[^ self].
|
3700
|
791 |
self circlePointerAroundComponent:component.
|
|
792 |
|
|
793 |
"Created: / 19-07-2019 / 11:20:42 / Claus Gittinger"
|
3711
|
794 |
"Modified: / 19-07-2019 / 15:38:11 / Claus Gittinger"
|
3700
|
795 |
!
|
|
796 |
|
3795
|
797 |
press:buttonNr
|
|
798 |
<action>
|
|
799 |
|
3799
|
800 |
"press at the current position in last component"
|
3795
|
801 |
|
|
802 |
self assert:(buttonNr isInteger).
|
|
803 |
^ self press:buttonNr inComponent:lastComponent.
|
|
804 |
|
|
805 |
"/ "press at the current position"
|
|
806 |
"/
|
|
807 |
"/ |position screen x y|
|
|
808 |
"/
|
|
809 |
"/ verifying ifTrue:[^ self].
|
|
810 |
"/
|
|
811 |
"/ screen := Screen current.
|
|
812 |
"/ position := screen pointerPosition.
|
|
813 |
"/ x := position x.
|
|
814 |
"/ y := position y.
|
|
815 |
"/
|
|
816 |
"/ "/ self movePointerToScreenPosition:position.
|
|
817 |
"/
|
|
818 |
"/ false "OperatingSystem isOSXlike" ifTrue:[
|
|
819 |
"/ |osxPos|
|
|
820 |
"/
|
|
821 |
"/ osxPos := OperatingSystem getMousePosition.
|
|
822 |
"/ x := osxPos x rounded.
|
|
823 |
"/ y := osxPos y rounded.
|
|
824 |
"/ OperatingSystem generateButtonEvent:buttonNr down:true x:x y:y.
|
|
825 |
"/ ^ self.
|
|
826 |
"/ ].
|
|
827 |
"/
|
|
828 |
"/ screen sendKeyOrButtonEvent:#buttonPress x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
|
|
829 |
"/ screen flush.
|
|
830 |
"/
|
|
831 |
"/ "Created: / 19-07-2019 / 13:52:38 / Claus Gittinger"
|
|
832 |
"/ "Modified: / 23-07-2019 / 09:38:31 / Claus Gittinger"
|
|
833 |
!
|
|
834 |
|
|
835 |
release:buttonNr
|
|
836 |
<action>
|
|
837 |
|
3799
|
838 |
"release at the current position in last component"
|
3795
|
839 |
|
|
840 |
<action>
|
|
841 |
|
|
842 |
self assert:(buttonNr isInteger).
|
|
843 |
^ self press:buttonNr inComponent:lastComponent.
|
|
844 |
"/ |position screen x y|
|
|
845 |
"/
|
|
846 |
"/ verifying ifTrue:[^ self].
|
|
847 |
"/
|
|
848 |
"/ screen := Screen current.
|
|
849 |
"/ position := screen pointerPosition.
|
|
850 |
"/ x := position x.
|
|
851 |
"/ y := position y.
|
|
852 |
"/
|
|
853 |
"/ self movePointerToScreenPosition:position.
|
|
854 |
"/
|
|
855 |
"/ false "OperatingSystem isOSXlike" ifTrue:[
|
|
856 |
"/ |osxPos|
|
|
857 |
"/
|
|
858 |
"/ osxPos := OperatingSystem getMousePosition.
|
|
859 |
"/ x := osxPos x rounded.
|
|
860 |
"/ y := osxPos y rounded.
|
|
861 |
"/ OperatingSystem generateButtonEvent:buttonNr down:false x:x y:y.
|
|
862 |
"/ ^ self.
|
|
863 |
"/ ].
|
|
864 |
"/
|
|
865 |
"/ screen sendKeyOrButtonEvent:#buttonRelease x:x y:y keyOrButton:buttonNr state:0 toViewId:(screen rootWindowId).
|
|
866 |
"/ screen flush.
|
|
867 |
|
|
868 |
"Created: / 19-07-2019 / 13:53:05 / Claus Gittinger"
|
|
869 |
"Modified: / 23-07-2019 / 09:38:38 / Claus Gittinger"
|
|
870 |
!
|
|
871 |
|
3787
|
872 |
select:itemsIndexOrLabelOrPattern
|
3700
|
873 |
"select an item by label,
|
|
874 |
allowed after moving to:
|
|
875 |
aComboBox
|
|
876 |
aSelectionInListView
|
|
877 |
"
|
|
878 |
|
|
879 |
<action>
|
|
880 |
|
3783
|
881 |
|idx component|
|
3775
|
882 |
|
|
883 |
verifying ifTrue:[^ self].
|
|
884 |
|
3783
|
885 |
((component := lastComponent) isKindOf:ScrollableView) ifTrue:[
|
|
886 |
component := component scrolledView.
|
|
887 |
].
|
|
888 |
|
|
889 |
(component isKindOf:ComboView) ifTrue:[
|
3700
|
890 |
"/ click on the menubutton
|
3783
|
891 |
self movePointerToComponent:component menuButton.
|
|
892 |
self click:1 inComponent:component menuButton.
|
3700
|
893 |
Delay waitForSeconds:0.3.
|
3787
|
894 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
895 |
idx := itemsIndexOrLabelOrPattern
|
|
896 |
] ifFalse:[
|
|
897 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
898 |
idx := component list findFirst:[:lbl | itemsIndexOrLabelOrPattern match:lbl]
|
|
899 |
] ifFalse:[
|
|
900 |
idx := component list indexOf:itemsIndexOrLabelOrPattern.
|
|
901 |
].
|
|
902 |
idx == 0 ifTrue:[
|
|
903 |
self error:'no such item in comboList: ',itemsIndexOrLabelOrPattern
|
|
904 |
].
|
3700
|
905 |
].
|
3783
|
906 |
component select:idx.
|
3700
|
907 |
Delay waitForSeconds:0.3.
|
3783
|
908 |
component shownMenu notNil ifTrue:[
|
|
909 |
component shownMenu hide.
|
3700
|
910 |
].
|
|
911 |
^ self
|
|
912 |
].
|
3783
|
913 |
(component isKindOf:HierarchicalListView) ifTrue:[
|
3787
|
914 |
|idx yPos|
|
|
915 |
|
|
916 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
917 |
idx := itemsIndexOrLabelOrPattern
|
|
918 |
] ifFalse:[
|
|
919 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
920 |
idx := component indexOfElementForWhich:[:el | itemsIndexOrLabelOrPattern match:el label string].
|
|
921 |
] ifFalse:[
|
|
922 |
idx := component indexOfElementForWhich:[:el | el label string = itemsIndexOrLabelOrPattern].
|
3783
|
923 |
].
|
3787
|
924 |
idx == 0 ifTrue:[
|
|
925 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
926 |
].
|
|
927 |
].
|
|
928 |
yPos := component yVisibleOfLine:idx.
|
|
929 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
930 |
component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
931 |
Delay waitForSeconds:0.1.
|
|
932 |
component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
933 |
"/ component selection:idx.
|
3783
|
934 |
^ self
|
|
935 |
].
|
3798
|
936 |
(component isKindOf:SelectionInListModelView) ifTrue:[
|
|
937 |
|idx yPos|
|
3783
|
938 |
|
3798
|
939 |
itemsIndexOrLabelOrPattern isInteger ifTrue:[
|
|
940 |
idx := itemsIndexOrLabelOrPattern
|
|
941 |
] ifFalse:[
|
|
942 |
itemsIndexOrLabelOrPattern includesMatchCharacters ifTrue:[
|
|
943 |
idx := component indexOfElementForWhich:[:el | el notNil and:[itemsIndexOrLabelOrPattern match:el string]].
|
|
944 |
] ifFalse:[
|
|
945 |
idx := component indexOfElementForWhich:[:el | el notNil and:[el string = itemsIndexOrLabelOrPattern]].
|
|
946 |
].
|
|
947 |
idx == 0 ifTrue:[
|
|
948 |
self error:'no such item in hierarchicalList: ',itemsIndexOrLabelOrPattern
|
|
949 |
].
|
|
950 |
].
|
|
951 |
yPos := component yVisibleOfLine:idx.
|
|
952 |
self movePointerToComponent:component offset:(0 @ (yPos + 3)).
|
|
953 |
component simulateButtonPress:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
954 |
Delay waitForSeconds:0.1.
|
|
955 |
component simulateButtonRelease:1 at:(0 @ (yPos + 3)) sendDisplayEvent:false.
|
|
956 |
"/ component selection:idx.
|
|
957 |
^ self
|
|
958 |
].
|
|
959 |
|
|
960 |
(component isKindOf:ItemInView) ifTrue:[
|
|
961 |
component isMenuItem ifTrue:[
|
|
962 |
self movePointerToComponent:component.
|
|
963 |
self halt.
|
|
964 |
].
|
|
965 |
].
|
|
966 |
|
|
967 |
self error:('cannot select this component: %1' bindWith:component className)
|
3700
|
968 |
|
|
969 |
"Created: / 19-07-2019 / 12:34:25 / Claus Gittinger"
|
|
970 |
"Modified (format): / 19-07-2019 / 14:55:34 / Claus Gittinger"
|
|
971 |
!
|
|
972 |
|
|
973 |
selectIndex:itemsIndex
|
|
974 |
"select an item by index,
|
|
975 |
allowed after moving to:
|
|
976 |
aComboBox
|
|
977 |
aSelectionInListView
|
|
978 |
"
|
|
979 |
|
|
980 |
<action>
|
|
981 |
|
3716
|
982 |
self selectIndex:itemsIndex in:lastComponent
|
|
983 |
|
|
984 |
"Created: / 19-07-2019 / 14:20:11 / Claus Gittinger"
|
|
985 |
"Modified: / 19-07-2019 / 21:59:36 / Claus Gittinger"
|
|
986 |
!
|
3711
|
987 |
|
3716
|
988 |
selectIndex:itemsIndex in:widgetArg
|
|
989 |
"select an item by index,
|
|
990 |
allowed after moving to:
|
|
991 |
aComboBox
|
|
992 |
aSelectionInListView
|
|
993 |
"
|
|
994 |
|
|
995 |
<action>
|
|
996 |
|
|
997 |
|widget y offset possibleWidgets|
|
|
998 |
|
3775
|
999 |
verifying ifTrue:[^ self].
|
|
1000 |
|
3716
|
1001 |
(widget := widgetArg) isScrollWrapper ifTrue:[
|
3711
|
1002 |
widget := widget scrolledView
|
|
1003 |
].
|
|
1004 |
|
|
1005 |
(widget isKindOf:ComboView) ifTrue:[
|
3700
|
1006 |
"/ click on the menubutton
|
3711
|
1007 |
self movePointerToComponent:widget menuButton.
|
|
1008 |
self click:1 inComponent:widget menuButton.
|
3700
|
1009 |
Delay waitForSeconds:0.5.
|
3711
|
1010 |
widget select:itemsIndex.
|
3700
|
1011 |
Delay waitForSeconds:0.5.
|
|
1012 |
^ self
|
|
1013 |
].
|
3711
|
1014 |
(widget isKindOf:SelectionInListView) ifTrue:[
|
3716
|
1015 |
(widget isLineVisible:itemsIndex) ifFalse:[
|
|
1016 |
widget scrollToLine:itemsIndex
|
|
1017 |
].
|
3711
|
1018 |
"/ click on the item
|
|
1019 |
y := widget yOfLine:itemsIndex.
|
|
1020 |
offset := (widget width // 2) @ y.
|
|
1021 |
self movePointerToComponent:widget offset:offset.
|
|
1022 |
widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
|
|
1023 |
Delay waitForSeconds:(self clickTime).
|
|
1024 |
widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
|
|
1025 |
Delay waitForSeconds:0.5.
|
|
1026 |
^ self
|
3716
|
1027 |
].
|
|
1028 |
(widget isKindOf:SelectionInListModelView) ifTrue:[
|
|
1029 |
(widget isLineVisible:itemsIndex) ifFalse:[
|
|
1030 |
widget scrollToLine:itemsIndex
|
|
1031 |
].
|
|
1032 |
y := widget yVisibleOfLine:itemsIndex.
|
|
1033 |
offset := (widget width // 2) @ y.
|
|
1034 |
self movePointerToComponent:widget offset:offset.
|
|
1035 |
widget simulateButtonPress:1 at:offset sendDisplayEvent:false.
|
|
1036 |
Delay waitForSeconds:(self clickTime).
|
|
1037 |
widget simulateButtonRelease:1 at:offset sendDisplayEvent:false.
|
|
1038 |
Delay waitForSeconds:0.5.
|
|
1039 |
^ self
|
|
1040 |
].
|
|
1041 |
|
|
1042 |
"/ none of it - see what is in there
|
|
1043 |
possibleWidgets := OrderedCollection new.
|
|
1044 |
widget allSubViewsDo:[:each |
|
|
1045 |
((each isKindOf:ComboView)
|
|
1046 |
or:[(each isKindOf:SelectionInListView)
|
|
1047 |
or:[(each isKindOf:SelectionInListModelView)
|
|
1048 |
]]) ifTrue:[
|
|
1049 |
possibleWidgets add:each
|
|
1050 |
]
|
|
1051 |
].
|
|
1052 |
possibleWidgets size == 1 ifTrue:[
|
|
1053 |
self selectIndex:itemsIndex in:(possibleWidgets first).
|
|
1054 |
^ self
|
3711
|
1055 |
].
|
3716
|
1056 |
|
3700
|
1057 |
self error:'cannot select this component'
|
|
1058 |
|
3716
|
1059 |
"Created: / 19-07-2019 / 21:59:15 / Claus Gittinger"
|
|
1060 |
"Modified: / 20-07-2019 / 07:57:41 / Claus Gittinger"
|
3711
|
1061 |
!
|
|
1062 |
|
|
1063 |
type:aString
|
|
1064 |
"enter text into the last component"
|
|
1065 |
|
|
1066 |
<action>
|
|
1067 |
|
3776
|
1068 |
|t|
|
|
1069 |
|
3775
|
1070 |
verifying ifTrue:[^ self].
|
|
1071 |
|
3776
|
1072 |
t := Display ctrlDown ifTrue:[0.05] ifFalse:[0.1].
|
|
1073 |
lastComponent
|
|
1074 |
simulateTextInput:aString at:(lastComponent extent // 2)
|
|
1075 |
sendDisplayEvent:false keyPressTime:t
|
3711
|
1076 |
|
|
1077 |
"Created: / 19-07-2019 / 15:50:40 / Claus Gittinger"
|
3700
|
1078 |
! !
|
|
1079 |
|
|
1080 |
!ShowMeHowItWorks methodsFor:'defaults'!
|
|
1081 |
|
|
1082 |
circlingCount
|
|
1083 |
"circle around move-end position that many times"
|
|
1084 |
|
|
1085 |
^ 3
|
|
1086 |
|
|
1087 |
"Created: / 19-07-2019 / 13:03:45 / Claus Gittinger"
|
|
1088 |
!
|
|
1089 |
|
|
1090 |
circlingRadius
|
|
1091 |
"radius when circling"
|
|
1092 |
|
|
1093 |
^ 30 "/ pixels
|
|
1094 |
|
|
1095 |
"Created: / 19-07-2019 / 13:07:59 / Claus Gittinger"
|
|
1096 |
!
|
|
1097 |
|
|
1098 |
circlingSpeed
|
|
1099 |
"time per round when circling"
|
|
1100 |
|
|
1101 |
^ 0.3 seconds. "/ time per round
|
|
1102 |
|
|
1103 |
"Created: / 19-07-2019 / 13:02:34 / Claus Gittinger"
|
|
1104 |
!
|
|
1105 |
|
|
1106 |
clickTime
|
|
1107 |
"when clicking"
|
|
1108 |
|
3711
|
1109 |
^ self shortClickTime
|
3700
|
1110 |
|
|
1111 |
"Created: / 19-07-2019 / 13:17:20 / Claus Gittinger"
|
3711
|
1112 |
"Modified: / 19-07-2019 / 15:21:51 / Claus Gittinger"
|
|
1113 |
!
|
|
1114 |
|
|
1115 |
longClickTime
|
|
1116 |
"when clicking buttons"
|
|
1117 |
|
|
1118 |
^ 500 milliseconds
|
|
1119 |
|
|
1120 |
"Created: / 19-07-2019 / 15:21:42 / Claus Gittinger"
|
3700
|
1121 |
!
|
|
1122 |
|
|
1123 |
pointerAnimationDelay
|
|
1124 |
^ 50 milliseconds. "/ 20 updates per second
|
|
1125 |
|
|
1126 |
"Created: / 19-07-2019 / 13:04:45 / Claus Gittinger"
|
|
1127 |
!
|
|
1128 |
|
|
1129 |
pointerMoveSpeed
|
|
1130 |
^ 400. "/ pixels per second
|
|
1131 |
|
|
1132 |
"Created: / 19-07-2019 / 13:05:40 / Claus Gittinger"
|
|
1133 |
!
|
|
1134 |
|
3717
|
1135 |
pointerMoveSpeedFast
|
|
1136 |
^ 600. "/ pixels per second
|
|
1137 |
|
|
1138 |
"Created: / 20-07-2019 / 08:13:58 / Claus Gittinger"
|
|
1139 |
!
|
|
1140 |
|
3711
|
1141 |
shortClickTime
|
|
1142 |
"when clicking"
|
|
1143 |
|
|
1144 |
^ 100 milliseconds
|
|
1145 |
|
|
1146 |
"Created: / 19-07-2019 / 15:21:29 / Claus Gittinger"
|
|
1147 |
!
|
|
1148 |
|
3700
|
1149 |
talking
|
3780
|
1150 |
"/ DebugMode := true
|
3775
|
1151 |
verifying ifTrue:[^ false].
|
3780
|
1152 |
DebugMode == true ifTrue:[^ false].
|
3775
|
1153 |
|
3727
|
1154 |
"/ ^ Expecco::ExpeccoPreferences current speechEffectsEnabled
|
3700
|
1155 |
^ true
|
|
1156 |
|
|
1157 |
"Created: / 19-07-2019 / 14:31:14 / Claus Gittinger"
|
3727
|
1158 |
"Modified (comment): / 23-07-2019 / 09:45:35 / Claus Gittinger"
|
3700
|
1159 |
! !
|
|
1160 |
|
|
1161 |
!ShowMeHowItWorks methodsFor:'helper'!
|
|
1162 |
|
3715
|
1163 |
randomThankYou
|
|
1164 |
^ #(
|
|
1165 |
'thank you, for watching'
|
|
1166 |
'thank you for watching'
|
|
1167 |
'thank you'
|
3775
|
1168 |
'thanks'
|
3715
|
1169 |
'have a good day'
|
3775
|
1170 |
'have a nice day'
|
3715
|
1171 |
'have fun'
|
|
1172 |
'have fun with expecco'
|
|
1173 |
'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: "to sin"'
|
|
1174 |
'happy hacking'
|
|
1175 |
'happy hacking, I hope you liked what you saw'
|
|
1176 |
'hope you liked it'
|
|
1177 |
'see you again'
|
3775
|
1178 |
'be the source with you'
|
|
1179 |
'be the force with you'
|
|
1180 |
'may the force be with you'
|
|
1181 |
'may the source be with you'
|
3715
|
1182 |
'please give feedback, and let us know, if you liked it'
|
|
1183 |
'if you have any questions, please contact exept'
|
|
1184 |
'if you need more information, please take a look at the wiki'
|
|
1185 |
) atRandom
|
|
1186 |
|
|
1187 |
"
|
3775
|
1188 |
OperatingSystem speak:'may the source be with you'
|
3715
|
1189 |
OperatingSystem speak:'have fun with expecco'
|
3716
|
1190 |
OperatingSystem speak:'have fun with expecco, by the way: expecco comes from the latin word: peccare, which means: to sin'
|
3715
|
1191 |
OperatingSystem speak:'happy hacking, I hope you liked what you saw'
|
|
1192 |
OperatingSystem speak:'please give feedback, and let us know, if you liked it'
|
|
1193 |
OperatingSystem speak:'if you have any questions, please contact exept'
|
|
1194 |
OperatingSystem speak:'if you need more information, please take a look at the wiki'
|
|
1195 |
"
|
|
1196 |
|
|
1197 |
"Created: / 19-07-2019 / 21:39:18 / Claus Gittinger"
|
|
1198 |
!
|
|
1199 |
|
3700
|
1200 |
tell:message
|
|
1201 |
self talking ifTrue:[
|
3728
|
1202 |
OperatingSystem speak:message voiceName:voice.
|
3700
|
1203 |
].
|
|
1204 |
|
|
1205 |
"Created: / 19-07-2019 / 14:57:50 / Claus Gittinger"
|
3728
|
1206 |
"Modified: / 23-07-2019 / 10:28:02 / Claus Gittinger"
|
3700
|
1207 |
! !
|
|
1208 |
|
|
1209 |
!ShowMeHowItWorks methodsFor:'helpers - broken'!
|
|
1210 |
|
|
1211 |
click:buttonNr atPosition:position
|
|
1212 |
"press-release at position"
|
|
1213 |
|
|
|