DeviceWorkstation.st
changeset 4552 ff6d09e621c7
parent 4507 90a6e223d3ee
child 4629 2cd474170180
equal deleted inserted replaced
4551:0c2850f05e68 4552:ff6d09e621c7
  2604 
  2604 
  2605 keyboardMap
  2605 keyboardMap
  2606     "return the keyboard map"
  2606     "return the keyboard map"
  2607 
  2607 
  2608     ^ keyboardMap
  2608     ^ keyboardMap
       
  2609 
       
  2610     "
       
  2611      Screen current keyboardMap
       
  2612     "
       
  2613 
       
  2614     "Modified: / 08-08-2006 / 15:00:35 / cg"
  2609 !
  2615 !
  2610 
  2616 
  2611 keyboardMap:aMap
  2617 keyboardMap:aMap
  2612     "set the keyboard map"
  2618     "set the keyboard map"
  2613 
  2619 
  2614     keyboardMap := aMap
  2620     keyboardMap := aMap
       
  2621 !
       
  2622 
       
  2623 shortKeyStringFor:aSymbolicKey
       
  2624     |untranslatedKeys untranslatedKey prefix pref|
       
  2625 
       
  2626     "/ this is somewhat complicated: we have the symbolic key at hand,
       
  2627     "/ but want to know the untranslated (inverse keyBoardMapped) key & modifier
       
  2628     "/ this is used in the menu, to show the shortCut key beside the items.
       
  2629 
       
  2630     untranslatedKeys := OrderedCollection new.
       
  2631     self keyboardMap keysAndValuesDo:[:k :v | v == aSymbolicKey ifTrue:[untranslatedKeys add:k]].
       
  2632     untranslatedKeys size == 0 ifTrue:[
       
  2633         untranslatedKey := aSymbolicKey.
       
  2634     ] ifFalse:[
       
  2635         untranslatedKeys size == 1 ifTrue:[
       
  2636             untranslatedKey := untranslatedKeys first.
       
  2637         ] ifFalse:[
       
  2638             "if there are multiple mappings, show the Ctrl or the F-key mapping"
       
  2639             untranslatedKey := untranslatedKeys 
       
  2640                                 detect:[:k |k startsWith:'Ctrl'] 
       
  2641                                 ifNone:[
       
  2642                                     untranslatedKeys 
       
  2643                                         detect:[:k |k startsWith:'F']
       
  2644                                         ifNone:[untranslatedKeys first]].
       
  2645         ].
       
  2646     ].
       
  2647 
       
  2648     "/
       
  2649     "/ some modifier-key combination ?
       
  2650     "/
       
  2651     (untranslatedKey startsWith:#Cmd) ifTrue:[
       
  2652         prefix := #Cmd.
       
  2653     ] ifFalse:[(untranslatedKey startsWith:#Alt) ifTrue:[
       
  2654         prefix := #Alt.
       
  2655     ] ifFalse:[(untranslatedKey startsWith:#Meta) ifTrue:[
       
  2656         prefix := #Meta.
       
  2657     ] ifFalse:[(untranslatedKey startsWith:#Ctrl) ifTrue:[
       
  2658         prefix := #Ctrl.
       
  2659     ]]]].
       
  2660 
       
  2661     prefix notNil ifTrue:[
       
  2662         |modifier|
       
  2663 
       
  2664         modifier := self modifierKeyTopFor:prefix.
       
  2665         modifier := (modifier ? prefix) , '-'.
       
  2666 
       
  2667         ^ modifier , (untranslatedKey copyFrom:(prefix size + 1))
       
  2668     ].
       
  2669     ^ untranslatedKey
       
  2670 
       
  2671     "Created: / 08-08-2006 / 15:45:38 / cg"
  2615 ! !
  2672 ! !
  2616 
  2673 
  2617 !DeviceWorkstation methodsFor:'accessing-misc'!
  2674 !DeviceWorkstation methodsFor:'accessing-misc'!
  2618 
  2675 
  2619 defaultEventMask
  2676 defaultEventMask
  7564 ! !
  7621 ! !
  7565 
  7622 
  7566 !DeviceWorkstation class methodsFor:'documentation'!
  7623 !DeviceWorkstation class methodsFor:'documentation'!
  7567 
  7624 
  7568 version
  7625 version
  7569     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.500 2006-03-06 08:52:50 cg Exp $'
  7626     ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.501 2006-08-08 13:59:51 cg Exp $'
  7570 ! !
  7627 ! !
  7571 
  7628 
  7572 DeviceWorkstation initialize!
  7629 DeviceWorkstation initialize!