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