DeviceWorkstation.st
changeset 6168 1c9707cfaa48
parent 6164 1860d4131349
child 6171 cb82f8fa9cd0
equal deleted inserted replaced
6167:baa4c9ec056a 6168:1c9707cfaa48
  4477         untranslatedKey := untranslatedKeyArg
  4477         untranslatedKey := untranslatedKeyArg
  4478     ].
  4478     ].
  4479 
  4479 
  4480     "/ Timestamp now print. 'X: ' print. untranslatedKey printCR.
  4480     "/ Timestamp now print. 'X: ' print. untranslatedKey printCR.
  4481 
  4481 
  4482     "/
  4482     "/ ctrl/meta-ESC give up focus
  4483     "/ ctrl-Esc gives up focus
  4483     "/ ESC escapes an activePointerGrab
  4484     "/
       
  4485     untranslatedKey == #Escape ifTrue:[
  4484     untranslatedKey == #Escape ifTrue:[
  4486         (ctrlDown or:[metaDown]) ifTrue:[
  4485         (activePointerGrab notNil 
       
  4486         or:[ctrlDown or:[metaDown]]) ifTrue:[
  4487             self ungrabPointer.
  4487             self ungrabPointer.
  4488             self ungrabKeyboard.
  4488             self ungrabKeyboard.
  4489             self setInputFocusTo:nil
  4489             self setInputFocusTo:nil
  4490         ]
  4490         ]
  4491     ].
  4491     ].
  6337 
  6337 
  6338     "let user specify a point on the screen (by pressing leftButton).
  6338     "let user specify a point on the screen (by pressing leftButton).
  6339      Show aCursor while waiting. Pressing shift or ctrl cancels the operation,
  6339      Show aCursor while waiting. Pressing shift or ctrl cancels the operation,
  6340      and aborts"
  6340      and aborts"
  6341 
  6341 
  6342     |p prevGrab|
  6342     |p prevGrab prevKbdGrab|
  6343 
  6343 
  6344     prevGrab := activePointerGrab.
  6344     prevGrab := activePointerGrab.
       
  6345     prevKbdGrab := activeKeyboardGrab.
       
  6346 
  6345     self ungrabPointer.
  6347     self ungrabPointer.
  6346     self grabPointerInView:(self rootView) withCursor:(aCursor onDevice:self).
  6348     self grabPointerInView:(self rootView) withCursor:(aCursor onDevice:self).
  6347 
  6349 
  6348     "
  6350     "
  6349      wait for no leftButton...
  6351      wait for no leftButton...
  6351     [self leftButtonPressed] whileTrue:[
  6353     [self leftButtonPressed] whileTrue:[
  6352         Delay waitForSeconds:0.05.
  6354         Delay waitForSeconds:0.05.
  6353     ].
  6355     ].
  6354 
  6356 
  6355     [
  6357     [
       
  6358         self grabKeyboardInView:(self rootView).
       
  6359 
  6356         "
  6360         "
  6357          wait for leftButton...
  6361          wait for leftButton...
       
  6362          ctrl, shift or escape terminate that operation
  6358         "
  6363         "
  6359         [self leftButtonPressed] whileFalse:[
  6364         [self leftButtonPressed] whileFalse:[
  6360             (self ctrlDown or:[self shiftDown]) ifTrue:[
  6365             (self ctrlDown or:[self shiftDown or:[activePointerGrab == nil]]) ifTrue:[
  6361                 AbortOperationRequest raise.
  6366                 AbortOperationRequest raise.
  6362                 ^ nil
  6367                 ^ nil
  6363             ].
  6368             ].
  6364             feedbackBlockOrNil notNil ifTrue:[
  6369             feedbackBlockOrNil notNil ifTrue:[
  6365                 feedbackBlockOrNil value:(self pointerPosition)
  6370                 feedbackBlockOrNil value:(self pointerPosition)
  6367             Delay waitForSeconds:0.05.
  6372             Delay waitForSeconds:0.05.
  6368         ].
  6373         ].
  6369 
  6374 
  6370         p := self pointerPosition.
  6375         p := self pointerPosition.
  6371     ] ensure:[
  6376     ] ensure:[
       
  6377         self ungrabKeyboard.
       
  6378         prevKbdGrab notNil ifTrue:[
       
  6379             self grabKeyboardInView:prevKbdGrab
       
  6380         ].
  6372         self ungrabPointer.
  6381         self ungrabPointer.
  6373         prevGrab notNil ifTrue:[
  6382         prevGrab notNil ifTrue:[
  6374             self grabPointerInView:prevGrab
  6383             self grabPointerInView:prevGrab
  6375         ].
  6384         ].
  6376         "flush all events pending on myself"
  6385         "flush all events pending on myself"
  6390 !
  6399 !
  6391 
  6400 
  6392 rectangleFromUser
  6401 rectangleFromUser
  6393     "{ Pragma: +optSpace }"
  6402     "{ Pragma: +optSpace }"
  6394 
  6403 
  6395     "let user specify a rectangle in the screen, return the rectangle"
  6404     "let user specify a rectangle in the screen, return the rectangle.
       
  6405      If the user presses ESC, an AbortSignal is raised."
  6396 
  6406 
  6397     |origin|
  6407     |origin|
  6398 
  6408 
  6399     "
  6409     "
  6400      get origin
  6410      get origin
  8274 ! !
  8284 ! !
  8275 
  8285 
  8276 !DeviceWorkstation class methodsFor:'documentation'!
  8286 !DeviceWorkstation class methodsFor:'documentation'!
  8277 
  8287 
  8278 version
  8288 version
  8279     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.596 2013-11-25 16:45:15 stefan Exp $'
  8289     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.597 2013-12-04 09:55:10 cg Exp $'
  8280 !
  8290 !
  8281 
  8291 
  8282 version_CVS
  8292 version_CVS
  8283     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.596 2013-11-25 16:45:15 stefan Exp $'
  8293     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.597 2013-12-04 09:55:10 cg Exp $'
  8284 ! !
  8294 ! !
  8285 
  8295 
  8286 
  8296 
  8287 DeviceWorkstation initialize!
  8297 DeviceWorkstation initialize!