DeviceWorkstation.st
branchjv
changeset 7970 43c6888f5f92
parent 7969 2bac4f32553f
child 8035 8bbd397fe321
child 8073 fd95fdcb8533
equal deleted inserted replaced
7969:2bac4f32553f 7970:43c6888f5f92
  2916 shortKeyPrefixSeparator
  2916 shortKeyPrefixSeparator
  2917     "the saparator shown between the shortcut modified (CTRL, CMD etc.)
  2917     "the saparator shown between the shortcut modified (CTRL, CMD etc.)
  2918      and the actual character. I.e. makes a Ctrl+A"
  2918      and the actual character. I.e. makes a Ctrl+A"
  2919 
  2919 
  2920     "/ used to be '-'
  2920     "/ used to be '-'
  2921     ^ '+'
  2921     ^ ' + '
  2922 
  2922 
  2923     "Created: / 21-07-2011 / 16:04:22 / cg"
  2923     "Created: / 21-07-2011 / 16:04:22 / cg"
       
  2924     "Modified: / 09-02-2017 / 11:57:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  2924 !
  2925 !
  2925 
  2926 
  2926 shortKeyStringFor:symbolicOrRawKey
  2927 shortKeyStringFor:symbolicOrRawKey
  2927     "Obsolete: For given symbolic or raw key, return a user-friendly shortcut description string.
  2928     "Obsolete: For given symbolic or raw key, return a user-friendly shortcut description string.
  2928      Examples:
  2929      Examples:
  3008         modifier := self modifierKeyTopFor:prefix.
  3009         modifier := self modifierKeyTopFor:prefix.
  3009         modifier := (modifier ? prefix).
  3010         modifier := (modifier ? prefix).
  3010         rest := (untranslatedKey copyFrom:(prefix size + 1)).
  3011         rest := (untranslatedKey copyFrom:(prefix size + 1)).
  3011         rest isEmpty ifTrue:[^ modifier ].
  3012         rest isEmpty ifTrue:[^ modifier ].
  3012         modifier := modifier , (self shortKeyPrefixSeparator).
  3013         modifier := modifier , (self shortKeyPrefixSeparator).
       
  3014         rest size == 1 ifTrue:[ 
       
  3015             rest first isUppercase ifTrue:[ 
       
  3016                 ^ modifier , (self modifierKeyTopFor:#Shift) , self shortKeyPrefixSeparator , rest
       
  3017             ] ifFalse:[ 
       
  3018                 ^ modifier , rest first asUppercase
       
  3019             ].
       
  3020         ].
  3013         ^ modifier , rest
  3021         ^ modifier , rest
  3014     ].
  3022     ].
  3015     ^ untranslatedKey
  3023     ^ untranslatedKey
  3016 
  3024 
  3017     "
  3025     "
  3018     Screen current shortKeyStringFor: #Find
  3026     Screen current shortKeyStringFor: #CmdBackSpace usingMap: Screen current keyboardMap
  3019     Screen current shortKeyStringFor: #CtrlX
  3027     Screen current shortKeyStringFor: #Find usingMap: Screen current keyboardMap
  3020     Screen current shortKeyStringFor: #CursorLeft
  3028     Screen current shortKeyStringFor: #CtrlX usingMap: Screen current keyboardMap
       
  3029     Screen current shortKeyStringFor: #CursorLeft usingMap: Screen current keyboardMap
  3021     "
  3030     "
  3022 
  3031 
  3023     "Created: / 08-02-2017 / 23:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3032     "Created: / 08-02-2017 / 23:28:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  3033     "Modified: / 09-02-2017 / 12:01:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3024 ! !
  3034 ! !
  3025 
  3035 
  3026 !DeviceWorkstation methodsFor:'accessing-misc'!
  3036 !DeviceWorkstation methodsFor:'accessing-misc'!
  3027 
  3037 
  3028 defaultEventMask
  3038 defaultEventMask
  6898      (i.e. to get the keyTop from a modifier)"
  6908      (i.e. to get the keyTop from a modifier)"
  6899 
  6909 
  6900     |t modifiers|
  6910     |t modifiers|
  6901 
  6911 
  6902     key == #Alt ifTrue:[
  6912     key == #Alt ifTrue:[
  6903 	modifiers := altModifiers
  6913         modifiers := altModifiers
  6904     ] ifFalse:[
  6914     ] ifFalse:[
  6905 	key == #Cmd ifTrue:[
  6915         key == #Cmd ifTrue:[
  6906 	    modifiers := metaModifiers
  6916             modifiers := metaModifiers
  6907 	]
  6917         ]
  6908     ].
  6918     ].
  6909 
  6919 
  6910     "/ temporary kludge ...
  6920     "/ temporary kludge ...
  6911     (modifiers size > 0) ifTrue:[
  6921     (modifiers size > 0) ifTrue:[
  6912 	(modifiers includes:'Num_Lock') ifTrue:[
  6922         (modifiers includes:'Num_Lock') ifTrue:[
  6913 	    modifiers := modifiers copyWithout:'Num_Lock'
  6923             modifiers := modifiers copyWithout:'Num_Lock'
  6914 	]
  6924         ]
  6915     ].
  6925     ].
  6916 
  6926 
  6917     (modifiers size > 0) ifTrue:[
  6927     (modifiers size > 0) ifTrue:[
  6918 	t := modifiers first.
  6928         t := modifiers first.
  6919 	(t includes:$_) ifTrue:[
  6929         (t includes:$_) ifTrue:[
  6920 	    t := t copyTo:(t indexOf:$_)-1
  6930             t := t copyTo:(t indexOf:$_)-1
  6921 	].
  6931         ].
  6922 	^ t
  6932         ^ t
  6923     ].
  6933     ].
  6924     ^ key
  6934     ^ key
  6925 
  6935 
  6926     "Created: / 28.2.1996 / 17:07:08 / cg"
  6936     "Created: / 28-02-1996 / 17:07:08 / cg"
  6927     "Modified: / 7.2.1998 / 16:18:17 / cg"
  6937     "Modified: / 07-02-1998 / 16:18:17 / cg"
       
  6938     "Modified: / 09-02-2017 / 11:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  6928 !
  6939 !
  6929 
  6940 
  6930 modifierKeyTranslationFor:untranslatedKey
  6941 modifierKeyTranslationFor:untranslatedKey
  6931     "map possible modifiers to a smaller set of common symbols.
  6942     "map possible modifiers to a smaller set of common symbols.
  6932      Especially, left/right keys are mapped to a common one."
  6943      Especially, left/right keys are mapped to a common one."