author | Claus Gittinger <cg@exept.de> |
Tue, 03 Feb 2009 11:41:37 +0100 | |
changeset 8530 | 10e17ee2b59c |
parent 8089 | 9ddb90f56334 |
child 8583 | 1ba96eea53a8 |
permissions | -rw-r--r-- |
52 | 1 |
" |
2 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2805 | 12 |
"{ Package: 'stx:libtool' }" |
13 |
||
6520 | 14 |
ApplicationModel subclass:#EventMonitor |
15 |
instanceVariableNames:'outputSelector' |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
16 |
classVariableNames:'' |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
17 |
poolDictionaries:'' |
1053 | 18 |
category:'Monitors-ST/X' |
19 | 19 |
! |
20 |
||
6520 | 21 |
View subclass:#EventMonitorView |
7354 | 22 |
instanceVariableNames:'outputStream labelHolder showButtonMotion showFocusEvents |
23 |
showTimestamp' |
|
6520 | 24 |
classVariableNames:'' |
25 |
poolDictionaries:'' |
|
26 |
privateIn:EventMonitor |
|
27 |
! |
|
28 |
||
1021 | 29 |
!EventMonitor class methodsFor:'documentation'! |
52 | 30 |
|
31 |
copyright |
|
32 |
" |
|
33 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
34 |
All Rights Reserved |
|
19 | 35 |
|
52 | 36 |
This software is furnished under a license and may be used |
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
45 |
documentation |
|
46 |
" |
|
47 |
like xev - show events. |
|
6520 | 48 |
|
52 | 49 |
You can use this to check your keyboard mappings, for example. |
50 |
start with: |
|
6520 | 51 |
EventMonitor open |
52 |
and watch the output on the xterm/console. |
|
52 | 53 |
" |
54 |
! ! |
|
19 | 55 |
|
1021 | 56 |
!EventMonitor class methodsFor:'defaults'! |
19 | 57 |
|
58 |
defaultExtent |
|
59 |
^ 200 @ 200 |
|
60 |
! |
|
61 |
||
62 |
defaultLabel |
|
63 |
^ 'Event Monitor' |
|
64 |
! ! |
|
65 |
||
6520 | 66 |
!EventMonitor class methodsFor:'interface specs'! |
67 |
||
68 |
windowSpec |
|
69 |
"This resource specification was automatically generated |
|
70 |
by the UIPainter of ST/X." |
|
71 |
||
72 |
"Do not manually edit this!! If it is corrupted, |
|
73 |
the UIPainter may not be able to read the specification." |
|
74 |
||
75 |
" |
|
76 |
UIPainter new openOnClass:EventMonitor andSelector:#windowSpec |
|
77 |
EventMonitor new openInterface:#windowSpec |
|
78 |
EventMonitor open |
|
79 |
" |
|
80 |
||
81 |
<resource: #canvas> |
|
82 |
||
83 |
^ |
|
84 |
#(FullSpec |
|
85 |
name: windowSpec |
|
86 |
window: |
|
87 |
(WindowSpec |
|
88 |
label: 'EventMonitor' |
|
89 |
name: 'EventMonitor' |
|
8089 | 90 |
min: (Point 100 100) |
6520 | 91 |
bounds: (Rectangle 0 0 300 300) |
92 |
menu: mainMenu |
|
93 |
) |
|
94 |
component: |
|
95 |
(SpecCollection |
|
96 |
collection: ( |
|
97 |
(NonScrollableArbitraryComponentSpec |
|
98 |
name: 'eventMonitorView' |
|
99 |
layout: (LayoutFrame 0 0 0 0 0 1 0 1) |
|
100 |
component: EventMonitorView |
|
101 |
) |
|
102 |
) |
|
103 |
||
104 |
) |
|
105 |
) |
|
106 |
! ! |
|
107 |
||
108 |
!EventMonitor class methodsFor:'menu specs'! |
|
109 |
||
110 |
mainMenu |
|
111 |
"This resource specification was automatically generated |
|
112 |
by the MenuEditor of ST/X." |
|
113 |
||
114 |
"Do not manually edit this!! If it is corrupted, |
|
115 |
the MenuEditor may not be able to read the specification." |
|
116 |
||
117 |
" |
|
118 |
MenuEditor new openOnClass:EventMonitor andSelector:#mainMenu |
|
119 |
(Menu new fromLiteralArrayEncoding:(EventMonitor mainMenu)) startUp |
|
120 |
" |
|
121 |
||
122 |
<resource: #menu> |
|
123 |
||
124 |
^ |
|
125 |
#(Menu |
|
126 |
( |
|
127 |
(MenuItem |
|
128 |
label: 'File' |
|
129 |
translateLabel: true |
|
130 |
submenu: |
|
131 |
(Menu |
|
132 |
( |
|
133 |
(MenuItem |
|
134 |
label: 'Exit' |
|
135 |
itemValue: closeRequest |
|
136 |
translateLabel: true |
|
137 |
) |
|
138 |
) |
|
139 |
nil |
|
140 |
nil |
|
141 |
) |
|
142 |
) |
|
143 |
(MenuItem |
|
6582 | 144 |
label: 'Filter' |
145 |
translateLabel: true |
|
146 |
submenu: |
|
147 |
(Menu |
|
148 |
( |
|
149 |
(MenuItem |
|
7353 | 150 |
label: 'Show ButtonMotion Events' |
6582 | 151 |
itemValue: showButtonMotion: |
152 |
translateLabel: true |
|
153 |
indication: showButtonMotion |
|
154 |
) |
|
7353 | 155 |
(MenuItem |
156 |
label: 'Show Focus Events' |
|
157 |
itemValue: showFocusEvents: |
|
158 |
translateLabel: true |
|
159 |
indication: showFocusEvents |
|
160 |
) |
|
6582 | 161 |
) |
162 |
nil |
|
163 |
nil |
|
164 |
) |
|
165 |
) |
|
166 |
(MenuItem |
|
6520 | 167 |
label: 'Output' |
168 |
translateLabel: true |
|
169 |
submenu: |
|
170 |
(Menu |
|
171 |
( |
|
172 |
(MenuItem |
|
173 |
label: 'Stdout' |
|
174 |
translateLabel: true |
|
175 |
choice: outputSelector |
|
176 |
choiceValue: stdout |
|
177 |
) |
|
178 |
(MenuItem |
|
179 |
label: 'Transcript' |
|
180 |
translateLabel: true |
|
181 |
choice: outputSelector |
|
182 |
choiceValue: transcript |
|
183 |
) |
|
7354 | 184 |
(MenuItem |
185 |
label: '-' |
|
186 |
) |
|
187 |
(MenuItem |
|
188 |
label: 'Show Timestamp' |
|
189 |
itemValue: showTimestamp: |
|
190 |
translateLabel: true |
|
191 |
indication: showTimestamp |
|
192 |
) |
|
6520 | 193 |
) |
194 |
nil |
|
195 |
nil |
|
196 |
) |
|
197 |
) |
|
198 |
(MenuItem |
|
199 |
label: 'Help' |
|
200 |
translateLabel: true |
|
201 |
startGroup: right |
|
202 |
submenu: |
|
203 |
(Menu |
|
204 |
( |
|
205 |
(MenuItem |
|
206 |
label: 'Documentation' |
|
207 |
itemValue: openDocumentation |
|
208 |
translateLabel: true |
|
209 |
) |
|
210 |
(MenuItem |
|
211 |
label: '-' |
|
212 |
) |
|
213 |
(MenuItem |
|
214 |
label: 'About this Application' |
|
215 |
itemValue: openAboutThisApplication |
|
216 |
translateLabel: true |
|
217 |
) |
|
218 |
) |
|
219 |
nil |
|
220 |
nil |
|
221 |
) |
|
222 |
) |
|
223 |
) |
|
224 |
nil |
|
225 |
nil |
|
226 |
) |
|
7353 | 227 |
|
7354 | 228 |
"Modified: / 04-10-2006 / 13:15:11 / cg" |
6520 | 229 |
! ! |
230 |
||
231 |
!EventMonitor methodsFor:'aspects'! |
|
232 |
||
6582 | 233 |
eventMonitorView |
234 |
^ (self builder componentAt:#eventMonitorView) |
|
235 |
! |
|
236 |
||
6520 | 237 |
outputSelector |
238 |
outputSelector isNil ifTrue:[ |
|
6759
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
239 |
outputSelector := #transcript asValue. |
6520 | 240 |
outputSelector onChangeEvaluate:[ self outputSelectorChanged ]. |
241 |
]. |
|
242 |
^ outputSelector |
|
243 |
! |
|
244 |
||
245 |
outputSelectorChanged |
|
246 |
|stream| |
|
247 |
||
248 |
stream := self outputSelector value == #transcript ifTrue:[Transcript] ifFalse:[Stdout]. |
|
6582 | 249 |
self eventMonitorView outputStream:stream. |
250 |
! |
|
251 |
||
6759
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
252 |
postBuildWith:aBuilder |
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
253 |
super postBuildWith:aBuilder. |
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
254 |
self outputSelectorChanged. |
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
255 |
! |
72791b0658d6
start initially with Transcript as output
Claus Gittinger <cg@exept.de>
parents:
6582
diff
changeset
|
256 |
|
6582 | 257 |
showButtonMotion |
258 |
^ self eventMonitorView showButtonMotion |
|
259 |
! |
|
260 |
||
261 |
showButtonMotion:aBoolean |
|
262 |
^ self eventMonitorView showButtonMotion:aBoolean |
|
7353 | 263 |
! |
264 |
||
265 |
showFocusEvents |
|
266 |
^ self eventMonitorView showFocusEvents |
|
267 |
||
268 |
"Created: / 04-10-2006 / 13:05:16 / cg" |
|
269 |
! |
|
270 |
||
271 |
showFocusEvents:aBoolean |
|
272 |
^ self eventMonitorView showFocusEvents:aBoolean |
|
273 |
||
274 |
"Created: / 04-10-2006 / 13:05:19 / cg" |
|
7354 | 275 |
! |
276 |
||
277 |
showTimestamp |
|
278 |
^ self eventMonitorView showTimestamp |
|
279 |
||
280 |
"Created: / 04-10-2006 / 13:14:49 / cg" |
|
281 |
! |
|
282 |
||
283 |
showTimestamp:aBoolean |
|
284 |
^ self eventMonitorView showTimestamp:aBoolean |
|
285 |
||
286 |
"Created: / 04-10-2006 / 13:14:53 / cg" |
|
6520 | 287 |
! ! |
288 |
||
289 |
!EventMonitor methodsFor:'menu actions'! |
|
290 |
||
291 |
openAboutThisApplication |
|
292 |
"This method was generated by the Browser. |
|
293 |
It will be invoked when the menu-item 'help-about' is selected." |
|
294 |
||
295 |
"/ could open a customized aboutBox here ... |
|
296 |
super openAboutThisApplication |
|
297 |
! |
|
298 |
||
299 |
openDocumentation |
|
300 |
HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#EVENTMONITOR'. |
|
301 |
! ! |
|
302 |
||
303 |
!EventMonitor::EventMonitorView class methodsFor:'defaults'! |
|
304 |
||
305 |
defaultExtent |
|
306 |
^ 200 @ 200 |
|
307 |
! |
|
308 |
||
309 |
defaultLabel |
|
310 |
^ 'Event Monitor' |
|
311 |
! ! |
|
312 |
||
313 |
!EventMonitor::EventMonitorView class methodsFor:'documentation'! |
|
314 |
||
315 |
documentation |
|
316 |
" |
|
317 |
like xev - show events. |
|
318 |
You can use this to check your keyboard mappings, for example. |
|
319 |
start with: |
|
320 |
EventMonitorView open |
|
321 |
and watch the output on xterm. |
|
322 |
" |
|
323 |
! ! |
|
324 |
||
325 |
!EventMonitor::EventMonitorView class methodsFor:'startup'! |
|
1822 | 326 |
|
327 |
isVisualStartable |
|
328 |
^ true |
|
329 |
||
330 |
"Created: / 10.8.1998 / 16:03:13 / cg" |
|
331 |
! ! |
|
332 |
||
6520 | 333 |
!EventMonitor::EventMonitorView methodsFor:'accessing'! |
334 |
||
7353 | 335 |
outputStream:aStream |
336 |
outputStream := aStream. |
|
6520 | 337 |
|
338 |
labelHolder value:nil. |
|
339 |
outputStream == Stdout ifTrue:[ |
|
340 |
labelHolder value: 'See event trace\on the standard output' withCRs. |
|
341 |
]. |
|
342 |
outputStream == Transcript ifTrue:[ |
|
343 |
labelHolder value: 'See event trace\on the Transcript' withCRs. |
|
344 |
]. |
|
6582 | 345 |
self invalidate. |
7353 | 346 |
|
347 |
"Modified: / 04-10-2006 / 13:04:16 / cg" |
|
6582 | 348 |
! |
349 |
||
350 |
showButtonMotion |
|
7353 | 351 |
^ showButtonMotion ? false |
352 |
||
353 |
"Modified: / 04-10-2006 / 13:03:31 / cg" |
|
354 |
! |
|
355 |
||
356 |
showButtonMotion:aBoolean |
|
357 |
showButtonMotion := aBoolean. |
|
358 |
||
359 |
"Modified: / 04-10-2006 / 13:04:08 / cg" |
|
6582 | 360 |
! |
361 |
||
7353 | 362 |
showFocusEvents |
363 |
^ showFocusEvents ? true |
|
364 |
||
365 |
"Created: / 04-10-2006 / 13:03:48 / cg" |
|
366 |
! |
|
367 |
||
368 |
showFocusEvents:aBoolean |
|
369 |
showFocusEvents := aBoolean. |
|
370 |
||
371 |
"Created: / 04-10-2006 / 13:04:04 / cg" |
|
7354 | 372 |
! |
373 |
||
374 |
showTimestamp |
|
375 |
^ showTimestamp ? false |
|
376 |
||
377 |
"Created: / 04-10-2006 / 13:06:57 / cg" |
|
378 |
! |
|
379 |
||
380 |
showTimestamp:aBoolean |
|
381 |
showTimestamp := aBoolean. |
|
382 |
||
383 |
"Created: / 04-10-2006 / 13:07:02 / cg" |
|
6520 | 384 |
! ! |
385 |
||
386 |
!EventMonitor::EventMonitorView methodsFor:'drawing'! |
|
387 |
||
388 |
redraw |
|
389 |
|y p lines| |
|
390 |
||
391 |
self clear. |
|
392 |
lines := labelHolder value asCollectionOfLines. |
|
393 |
||
394 |
y := (self height - ((font heightOf:'A') * lines size)) // 2. |
|
395 |
lines do:[:eachLine | |
|
396 |
p := (self center x - ((font widthOf:eachLine) // 2)) @ y. |
|
397 |
self displayString:eachLine value x:(p x) y:(p y). |
|
398 |
y := y + (font heightOf:eachLine). |
|
399 |
] |
|
7354 | 400 |
! |
401 |
||
402 |
showEventTime |
|
403 |
self showTimestamp ifTrue:[ |
|
404 |
Transcript show:(Timestamp now); show:' '. |
|
405 |
] |
|
406 |
||
407 |
"Created: / 04-10-2006 / 13:08:27 / cg" |
|
6520 | 408 |
! ! |
409 |
||
410 |
!EventMonitor::EventMonitorView methodsFor:'events'! |
|
19 | 411 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
412 |
buttonMotion:state x:x y:y |
6582 | 413 |
self showButtonMotion ifFalse:[^ self]. |
414 |
||
7354 | 415 |
self showEventTime. |
6520 | 416 |
outputStream nextPutAll:'buttonMotion x:'. |
417 |
x printOn:outputStream. |
|
418 |
outputStream nextPutAll:' y:'. |
|
419 |
y printOn:outputStream. |
|
420 |
outputStream nextPutAll:' state:'. |
|
421 |
state printOn:outputStream. |
|
422 |
outputStream cr. |
|
1117 | 423 |
|
7354 | 424 |
"Modified: / 04-10-2006 / 13:07:53 / cg" |
19 | 425 |
! |
426 |
||
2159 | 427 |
buttonMultiPress:button x:x y:y |
7354 | 428 |
self showEventTime. |
429 |
||
6520 | 430 |
outputStream nextPutAll:'buttonMultiPress x:'. |
431 |
x printOn:outputStream. |
|
432 |
outputStream nextPutAll:' y:'. |
|
433 |
y printOn:outputStream. |
|
434 |
outputStream nextPutAll:' button:'. |
|
435 |
button printOn:outputStream. |
|
436 |
outputStream cr. |
|
2159 | 437 |
|
7354 | 438 |
"Created: / 19-05-1999 / 09:40:40 / cg" |
439 |
"Modified: / 04-10-2006 / 13:08:36 / cg" |
|
2159 | 440 |
! |
441 |
||
19 | 442 |
buttonPress:button x:x y:y |
7354 | 443 |
self showEventTime. |
444 |
||
6520 | 445 |
outputStream nextPutAll:'buttonPress x:'. |
446 |
x printOn:outputStream. |
|
447 |
outputStream nextPutAll:' y:'. |
|
448 |
y printOn:outputStream. |
|
449 |
outputStream nextPutAll:' button:'. |
|
450 |
button printOn:outputStream. |
|
451 |
outputStream cr. |
|
452 |
outputStream flush. |
|
1117 | 453 |
|
7354 | 454 |
"Modified: / 04-10-2006 / 13:08:43 / cg" |
19 | 455 |
! |
456 |
||
457 |
buttonRelease:button x:x y:y |
|
7354 | 458 |
self showEventTime. |
459 |
||
6520 | 460 |
outputStream nextPutAll:'buttonRelease x:'. |
461 |
x printOn:outputStream. |
|
462 |
outputStream nextPutAll:' y:'. |
|
463 |
y printOn:outputStream. |
|
464 |
outputStream nextPutAll:' button:'. |
|
465 |
button printOn:outputStream. |
|
466 |
outputStream cr. |
|
1117 | 467 |
|
7354 | 468 |
"Modified: / 04-10-2006 / 13:08:46 / cg" |
19 | 469 |
! |
470 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
471 |
configureX:x y:y width:newWidth height:newHeight |
7354 | 472 |
self showEventTime. |
473 |
||
6520 | 474 |
outputStream nextPutAll:'configure x:'. |
475 |
x printOn:outputStream. |
|
476 |
outputStream nextPutAll:' y:'. |
|
477 |
y printOn:outputStream. |
|
478 |
outputStream nextPutAll:' width:'. |
|
479 |
newWidth printOn:outputStream. |
|
480 |
outputStream nextPutAll:' height:'. |
|
481 |
newHeight printOn:outputStream. |
|
482 |
outputStream nextPutAll:' button:'. |
|
483 |
outputStream cr. |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
484 |
|
6520 | 485 |
super configureX:x y:y width:newWidth height:newHeight. |
486 |
||
487 |
self invalidate. |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
488 |
|
7354 | 489 |
"Modified: / 04-10-2006 / 13:08:49 / cg" |
1117 | 490 |
! |
491 |
||
7320 | 492 |
dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate |
493 |
event isButtonMotionEvent ifTrue:[ |
|
494 |
self showButtonMotion ifFalse:[^ self]. |
|
495 |
]. |
|
496 |
||
497 |
"/ Timestamp now printOn:outputStream. |
|
498 |
"/ outputStream nextPutAll:' '. |
|
499 |
||
500 |
super dispatchEvent:event withFocusOn:focusViewOrNil delegate:doDelegate. |
|
501 |
||
502 |
"Created: / 20-09-2006 / 10:29:38 / cg" |
|
503 |
! |
|
504 |
||
1117 | 505 |
dropMessage:dropType data:dropData |
7354 | 506 |
self showEventTime. |
507 |
||
6520 | 508 |
outputStream nextPutAll:'drop '. |
509 |
dropType printOn:outputStream. |
|
510 |
outputStream nextPutAll:' data:'. |
|
511 |
dropData printOn:outputStream. |
|
512 |
outputStream cr. |
|
1117 | 513 |
|
7354 | 514 |
"Modified: / 04-10-2006 / 13:09:13 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
515 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
516 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
517 |
focusIn |
7353 | 518 |
self showFocusEvents ifFalse:[^ self]. |
519 |
||
7354 | 520 |
self showEventTime. |
521 |
||
6520 | 522 |
outputStream nextPutLine:'focusIn '. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
523 |
|
7353 | 524 |
"Created: / 07-03-1996 / 15:06:18 / cg" |
7354 | 525 |
"Modified: / 04-10-2006 / 13:09:17 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
526 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
527 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
528 |
focusOut |
7353 | 529 |
self showFocusEvents ifFalse:[^ self]. |
530 |
||
7354 | 531 |
self showEventTime. |
532 |
||
6520 | 533 |
outputStream nextPutLine:'focusOut '. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
534 |
|
7353 | 535 |
"Created: / 07-03-1996 / 15:06:21 / cg" |
7354 | 536 |
"Modified: / 04-10-2006 / 13:09:20 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
537 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
538 |
|
2159 | 539 |
hasKeyboardFocus:aBoolen |
7353 | 540 |
self showFocusEvents ifFalse:[^ self]. |
541 |
||
7354 | 542 |
self showEventTime. |
543 |
||
6520 | 544 |
outputStream nextPutAll:'hasKeyboardFocus:'. |
545 |
aBoolen printOn:outputStream. |
|
546 |
outputStream cr. |
|
2159 | 547 |
|
7354 | 548 |
"Modified: / 04-10-2006 / 13:09:23 / cg" |
2159 | 549 |
! |
550 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
551 |
keyPress:key x:x y:y |
6344 | 552 |
|s rawKey untranslatedKey| |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
553 |
|
7354 | 554 |
self showEventTime. |
555 |
||
2805 | 556 |
s := 'KeyPress x:' , x printString , ' y:' , y printString. |
6520 | 557 |
s printOn:outputStream. |
6344 | 558 |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
559 |
(key isMemberOf:Character) ifTrue:[ |
6582 | 560 |
s := ' character key:' , key storeString |
2805 | 561 |
, ' (' , key asciiValue printString , ')'. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
562 |
] ifFalse:[ |
2805 | 563 |
s := ' symbolic key:' , key storeString. |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
564 |
untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
565 |
untranslatedKey ~~ key ifTrue:[ |
6582 | 566 |
s := s , ' untranslated key:' , untranslatedKey storeString |
2805 | 567 |
]. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
568 |
]. |
6344 | 569 |
rawKey := (WindowGroup lastEventQuerySignal query) rawKey. |
6582 | 570 |
s := s , ' rawKey:' , rawKey storeString. |
6344 | 571 |
|
6520 | 572 |
s printOn:outputStream. |
7354 | 573 |
|
574 |
key isCharacter ifTrue:[ |
|
575 |
outputStream nextPutAll:' '''. |
|
576 |
key asString printOn:outputStream. |
|
577 |
outputStream nextPutAll:''''. |
|
578 |
]. |
|
6520 | 579 |
outputStream cr. |
7354 | 580 |
|
581 |
"Modified: / 04-10-2006 / 13:12:07 / cg" |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
582 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
583 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
584 |
keyRelease:key x:x y:y |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
585 |
|untranslatedKey| |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
586 |
|
7354 | 587 |
self showEventTime. |
588 |
||
6520 | 589 |
'KeyRelease x:' printOn:outputStream. |
590 |
x printOn:outputStream. |
|
591 |
' y:' printOn:outputStream. |
|
592 |
y printOn:outputStream. |
|
593 |
||
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
594 |
(key isMemberOf:Character) ifTrue:[ |
6187 | 595 |
key codePoint <= 16rFF ifTrue:[ |
6520 | 596 |
' character key:' printOn:outputStream. |
6582 | 597 |
key storeString printOn:outputStream. |
6187 | 598 |
] ifFalse:[ |
6520 | 599 |
' unicode character utf8:' printOn:outputStream. |
600 |
key asString utf8Encoded asByteArray hexPrintOn:outputStream. |
|
6187 | 601 |
]. |
6520 | 602 |
' (' printOn:outputStream. key asciiValue printOn:outputStream. ')' printOn:outputStream |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
603 |
] ifFalse:[ |
6582 | 604 |
' symbolic key:' print. key storeString printOn:outputStream. |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
605 |
untranslatedKey := device keyboardMap keyAtValue:key ifAbsent:key. |
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
606 |
untranslatedKey ~~ key ifTrue:[ |
6582 | 607 |
' untranslated key:' printOn:outputStream. untranslatedKey storeString printOn:outputStream |
640
7608b07af7bb
show untranslated key as well
Claus Gittinger <cg@exept.de>
parents:
433
diff
changeset
|
608 |
] |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
609 |
]. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
610 |
|
6520 | 611 |
outputStream cr |
7354 | 612 |
|
613 |
"Modified: / 04-10-2006 / 13:09:27 / cg" |
|
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
614 |
! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
615 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
616 |
mapped |
7354 | 617 |
self showEventTime. |
618 |
||
6520 | 619 |
outputStream nextPutLine:'mapped '. |
620 |
||
1977 | 621 |
super mapped. |
1117 | 622 |
|
7354 | 623 |
"Modified: / 04-10-2006 / 13:09:31 / cg" |
45 | 624 |
! |
625 |
||
52 | 626 |
pointerEnter:state x:x y:y |
7354 | 627 |
self showEventTime. |
628 |
||
6520 | 629 |
outputStream nextPutAll:'pointerEnter x:'. |
630 |
x printOn:outputStream. |
|
631 |
outputStream nextPutAll:' y:'. |
|
632 |
y printOn:outputStream. |
|
633 |
outputStream nextPutAll:' state:'. |
|
634 |
state printOn:outputStream. |
|
635 |
outputStream cr. |
|
1117 | 636 |
|
7354 | 637 |
"Modified: / 04-10-2006 / 13:09:34 / cg" |
52 | 638 |
! |
639 |
||
640 |
pointerLeave:state |
|
7354 | 641 |
self showEventTime. |
642 |
||
6520 | 643 |
outputStream nextPutAll:'pointerLeave state:'. |
644 |
state storeString printOn:outputStream. |
|
645 |
outputStream cr. |
|
1117 | 646 |
|
7354 | 647 |
"Modified: / 04-10-2006 / 13:09:36 / cg" |
52 | 648 |
! |
649 |
||
6582 | 650 |
sizeChanged:how |
8089 | 651 |
outputStream nextPutAll:'sizeChanged how:'. |
652 |
how printOn:outputStream. |
|
653 |
outputStream cr. |
|
654 |
||
6582 | 655 |
super sizeChanged:how. |
656 |
self invalidate |
|
7354 | 657 |
|
658 |
"Modified: / 04-10-2006 / 13:17:46 / cg" |
|
6582 | 659 |
! |
660 |
||
45 | 661 |
unmapped |
7354 | 662 |
self showEventTime. |
663 |
||
6520 | 664 |
outputStream nextPutLine:'unmapped '. |
665 |
||
1977 | 666 |
super unmapped. |
1117 | 667 |
|
7354 | 668 |
"Modified: / 04-10-2006 / 13:09:41 / cg" |
45 | 669 |
! |
670 |
||
671 |
visibilityChange:how |
|
7354 | 672 |
self showEventTime. |
673 |
||
6520 | 674 |
outputStream nextPutAll:'visibilityChange:'. |
675 |
how storeString printOn:outputStream. |
|
676 |
outputStream cr. |
|
677 |
||
1977 | 678 |
super visibilityChange:how |
1117 | 679 |
|
7354 | 680 |
"Modified: / 04-10-2006 / 13:09:43 / cg" |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
681 |
! ! |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
682 |
|
6520 | 683 |
!EventMonitor::EventMonitorView methodsFor:'initialization'! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
684 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
685 |
initialize |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
686 |
super initialize. |
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
687 |
|
6520 | 688 |
labelHolder := '' asValue. |
689 |
self outputStream:Stdout. |
|
19 | 690 |
! ! |
691 |
||
6520 | 692 |
!EventMonitor::EventMonitorView methodsFor:'realization'! |
19 | 693 |
|
694 |
initEvents |
|
695 |
self enableMotionEvents. |
|
45 | 696 |
self enableKeyReleaseEvents. |
52 | 697 |
self enableEnterLeaveEvents. |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
698 |
self enableFocusEvents. |
45 | 699 |
self enableEvent:#visibilityChange |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
700 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
701 |
"Modified: 7.3.1996 / 15:06:42 / cg" |
19 | 702 |
! ! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
703 |
|
1021 | 704 |
!EventMonitor class methodsFor:'documentation'! |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
705 |
|
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
706 |
version |
8089 | 707 |
^ '$Header: /cvs/stx/stx/libtool/EventMonitor.st,v 1.29 2008-05-01 21:05:31 stefan Exp $' |
433
703d84558f6f
also show config & focus events
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
708 |
! ! |