# HG changeset patch # User Claus Gittinger # Date 1311257087 -7200 # Node ID 9416217f347ad9e9d534e09754c77de23fc0d4ff # Parent 8a5b6ccd547637abe5aac0a2e75bf3dbaf47f6e1 added: #shortKeyPrefixSeparator changed: #shortKeyStringFor: diff -r 8a5b6ccd5476 -r 9416217f347a DeviceWorkstation.st --- a/DeviceWorkstation.st Wed Jul 20 17:10:11 2011 +0200 +++ b/DeviceWorkstation.st Thu Jul 21 16:04:47 2011 +0200 @@ -2711,6 +2711,16 @@ keyboardMap := aMap ! +shortKeyPrefixSeparator + "the saparator shown between the shortcut modified (CTRL, CMD etc.) + and the actual character. I.e. makes a Ctrl+A" + + "/ used to be '-' + ^ '+' + + "Created: / 21-07-2011 / 16:04:22 / cg" +! + shortKeyStringFor:aSymbolicKey |untranslatedKeys untranslatedKey prefix| @@ -2721,54 +2731,54 @@ untranslatedKeys := OrderedCollection new. self keyboardMap keysAndValuesDo:[:k :v | v == aSymbolicKey ifTrue:[untranslatedKeys add:k]]. untranslatedKeys size == 0 ifTrue:[ - "/ if its not an explicit command key (Ctrl-*, Alt-* or Cmd-*), - "/ but a symbolic key, return nil. - (aSymbolicKey startsWith:'Cmd') ifFalse:[ - (aSymbolicKey startsWith:'Ctrl') ifFalse:[ - (aSymbolicKey startsWith:'Alt') ifFalse:[ - (aSymbolicKey startsWith:'Meta') ifFalse:[ - (aSymbolicKey startsWith:'Shift') ifFalse:[ - ^ nil - ]. - ]. - ]. - ]. - ]. - untranslatedKey := aSymbolicKey. + "/ if its not an explicit command key (Ctrl-*, Alt-* or Cmd-*), + "/ but a symbolic key, return nil. + (aSymbolicKey startsWith:'Cmd') ifFalse:[ + (aSymbolicKey startsWith:'Ctrl') ifFalse:[ + (aSymbolicKey startsWith:'Alt') ifFalse:[ + (aSymbolicKey startsWith:'Meta') ifFalse:[ + (aSymbolicKey startsWith:'Shift') ifFalse:[ + ^ nil + ]. + ]. + ]. + ]. + ]. + untranslatedKey := aSymbolicKey. ] ifFalse:[ - untranslatedKeys size == 1 ifTrue:[ - untranslatedKey := untranslatedKeys first. - ] ifFalse:[ - "if there are multiple mappings, show the Ctrl or the F-key mapping" - untranslatedKey := untranslatedKeys - detect:[:k |k startsWith:'Ctrl'] - ifNone:[ - untranslatedKeys - detect:[:k |k startsWith:'F'] - ifNone:[untranslatedKeys first]]. - ]. + untranslatedKeys size == 1 ifTrue:[ + untranslatedKey := untranslatedKeys first. + ] ifFalse:[ + "if there are multiple mappings, show the Ctrl or the F-key mapping" + untranslatedKey := untranslatedKeys + detect:[:k |k startsWith:'Ctrl'] + ifNone:[ + untranslatedKeys + detect:[:k |k startsWith:'F'] + ifNone:[untranslatedKeys first]]. + ]. ]. "/ "/ some modifier-key combination ? "/ (untranslatedKey startsWith:#Cmd) ifTrue:[ - prefix := #Cmd. + prefix := #Cmd. ] ifFalse:[(untranslatedKey startsWith:#Alt) ifTrue:[ - prefix := #Alt. + prefix := #Alt. ] ifFalse:[(untranslatedKey startsWith:#Meta) ifTrue:[ - prefix := #Meta. + prefix := #Meta. ] ifFalse:[(untranslatedKey startsWith:#Ctrl) ifTrue:[ - prefix := #Ctrl. + prefix := #Ctrl. ]]]]. prefix notNil ifTrue:[ - |modifier| - - modifier := self modifierKeyTopFor:prefix. - modifier := (modifier ? prefix) , '-'. - - ^ modifier , (untranslatedKey copyFrom:(prefix size + 1)) + |modifier| + + modifier := self modifierKeyTopFor:prefix. + modifier := (modifier ? prefix) , (self shortKeyPrefixSeparator). + + ^ modifier , (untranslatedKey copyFrom:(prefix size + 1)) ]. ^ untranslatedKey @@ -8095,11 +8105,11 @@ !DeviceWorkstation class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.559 2011-03-24 12:43:06 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.560 2011-07-21 14:04:47 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.559 2011-03-24 12:43:06 stefan Exp $' + ^ '$Header: /cvs/stx/stx/libview/DeviceWorkstation.st,v 1.560 2011-07-21 14:04:47 cg Exp $' ! ! DeviceWorkstation initialize!