KeyboardMap.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 09 Feb 2017 00:17:19 +0000
branchjv
changeset 8036 e248f3b96260
parent 8035 8bbd397fe321
child 8037 d01faa4c1b02
permissions -rw-r--r--
Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound ...to some other shortcut. This is mainly to having too many shortcuts for same thing. If one really needs to define an alias, use #bindAlias:to: to explicitly say this is an alias.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
48194c26a46c Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
5280
77ce8475efed category change
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
    12
"{ Package: 'stx:libview' }"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    14
"{ NameSpace: Smalltalk }"
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    15
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    16
Object subclass:#KeyboardMap
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    17
	instanceVariableNames:'parent current bindings aliases'
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    18
	classVariableNames:''
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    19
	poolDictionaries:''
5280
77ce8475efed category change
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
    20
	category:'Interface-Support-UI'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    21
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    22
46
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    23
!KeyboardMap class methodsFor:'documentation'!
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    24
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    25
copyright
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    26
"
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    27
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 54
diff changeset
    28
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    29
46
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    30
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    31
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    33
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    34
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    35
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    36
"
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    37
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    38
46
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    39
documentation
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
    40
"
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    41
    Instances of KeyboardMap are used for mapping keystrokes AND sequences
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    42
    of keystrokes to a logical function which is used by UI code. For
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    43
    example, it maps #Ctrls to #Accept logical function which is then
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    44
    used menu items and so on.
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    45
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    46
    This allows for changing a shortcut without changing the code.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    47
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    48
    Keyboard maps may chained together, if a mapping is not found in
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    49
    a particular key map, lookup continues in its parent map (if any).
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    50
    Usually the grand-parent is device's standard map, see
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    51
    DeviceWorkstation >> keyboardMap (but not necessarily!!)
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    52
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    53
    The setup of device's map is done in the 'smalltalk.rc' or one of the
6663
a3d11f506f57 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
    54
    'keyboard.rc' files during startup.
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
    55
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    56
    To add a mapping (for example, to attach the logical function 'DoIt' to
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    57
    the key-combination Cmd-'d'):
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    58
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    59
        |m|
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    60
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    61
        m := Display keyboardMap.
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    62
        m bindValue:#DoIt to:#Cmdd.
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    63
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    64
    Key sequences can also be defined (hey emacs fans ;-) as in:
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    65
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    66
        |m|
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    67
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    68
        m := Display keyboardMap.
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    69
        m bindValue:#DoIt to:#Ctrlx followedBy:#Ctrld
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    70
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    71
    Key prefixes are defined in the DeviceWorkstation>>translateKey: method.
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    72
    Typical prefixes are Cmd (for Alt or Meta), Ctrl etc.
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    73
    Some keyboards offer both Alt and Meta keys - on those, the first has a
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    74
    prefix of Alt, the second has Cmd as prefix. Keyboards with only an Alt
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    75
    key will will create prefix codes of Cmd for that.
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    76
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    77
    To remove a mapping, use the same value for both logical and physical key,
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    78
    as in:
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    79
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    80
        |m|
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
    81
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    82
        m := Display keyboardMap.
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    83
        m bindValue:#Cmdd to:#Cmdd.
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    84
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    85
    In addition to (primary) shortcut mapping (defined by #bindValue:to:) one may also
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    86
    define an alias, kind of secondary mapping. This is to support users coming from other
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    87
    environments with other default shortcuts so 'their' shortcuts just work without need
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    88
    to manually customize Smalltalk/X. Just to be a little friendly to foreigners.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    89
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    90
    To define an alias, use #bindAlias:to: as in:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    91
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    92
        |m|
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    93
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    94
        m := Display keyboardMap.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    95
        m bindAlias:#Paste to:#Shiftnsert.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
    96
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    97
    [see also:]
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    98
        WindowEvent WindowSensor WindowGroup
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
    99
        View DeviceWorkstation
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   100
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   101
    [author:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   102
        Claus Gittinger
46
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
   103
"
7b331e9012fd *** empty log message ***
claus
parents: 5
diff changeset
   104
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   105
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   106
!KeyboardMap class methodsFor:'instance creation'!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   107
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   108
new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   109
    "return an initialized instance"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   110
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   111
    ^ self basicNew initialize.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   112
! !
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   113
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   114
!KeyboardMap methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   115
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   116
mappedKeys
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   117
    "Return a set of all raw keys which are mapped to a logical key.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   118
     This method consult both - (primary) bindings and (secondary) aliases."
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   119
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   120
    ^ bindings keys , aliases keys , (parent isNil ifTrue:[ #() ] ifFalse:[ parent mappedKeys ])
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   121
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   122
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   123
    Screen current keyboardMap mappedKeys
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   124
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   125
    KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   126
        parent: Screen current keyboardMap mappedKeys;
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   127
        mappedKeys    
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   128
        
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   129
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   130
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   131
    "Created: / 17-05-2017 / 15:37:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   132
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   133
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   134
mappingFor:rawKey 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   135
    "Given a `rawKey` return coresponding logical key. This method
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   136
     consults both - (primary) bindings and (secondary) aliaes.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   137
     Example:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   138
        #Ctrlx -> #Cut
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   139
        #F13 -> F13 (no mapping)"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   140
    
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   141
    | value |
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   142
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   143
    current notNil ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   144
        value := current mappingFor: rawKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   145
        value isKeyboardMap ifTrue:[ 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   146
            current := value.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   147
            ^ nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   148
        ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   149
    ].        
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   150
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   151
    value := bindings at:rawKey ifAbsent:[ nil ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   152
    value isKeyboardMap ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   153
        current := value.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   154
        ^ nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   155
    ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   156
    (value isNil) ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   157
        value := aliases at:rawKey ifAbsent:[ nil ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   158
        value isKeyboardMap ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   159
            current := value.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   160
            ^ nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   161
        ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   162
    ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   163
    current := nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   164
    value isNil ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   165
        parent notNil ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   166
            value := parent mappingFor:rawKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   167
            (value notNil and:[ value ~= rawKey ]) ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   168
                "/ Parent defines mapping for given rawKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   169
                "/ We need to check whether the action is not
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   170
                "/ redefined here under different binding / alias,
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   171
                "/ if so, don't use parent's mapping!!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   172
                ((bindings includes:value) or:[ aliases includes:value ]) ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   173
                    "/ Treat this as mo mapping for given key, return it unmapped
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   174
                    ^ rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   175
                ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   176
            ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   177
            ^ value
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   178
        ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   179
         
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   180
        "/ No mapping for given key, return it unmapped
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   181
        
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   182
        ^ rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   183
    ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   184
    ^ value
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   185
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   186
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   187
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   188
        bindValue: #Rename to: #F2;
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   189
        valueFor: #F10
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   190
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   191
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   192
        parent: (KeyboardMap new bindValue: #Rename to: #F2; yourself);
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   193
        valueFor: #F2"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   194
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   195
    "Created: / 15-05-2017 / 21:35:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   196
    "Modified: / 17-05-2017 / 16:02:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   197
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   198
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   199
parent
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   200
    ^ parent
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   201
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   202
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   203
parent:aKeyboardMap
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   204
    parent := aKeyboardMap.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   205
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   206
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   207
valueFor:rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   208
    <resource: #obsolete>
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   209
    "Given a `rawKey` return coresponding logical key. This method
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   210
     consults both - (primary) binding and aliaes.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   211
     Example:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   212
        #Ctrlx -> #Cut
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   213
        #F13 -> F13 (no mapping)
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   214
    "  
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   215
    self obsoleteMethodWarning: 'Use #mappingFor: instead'.  
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   216
    ^ self mappingFor:rawKey.  
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   217
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   218
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   219
    KeyboardMap new 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   220
        bindValue: #Rename to: #F2; 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   221
        valueFor: #F2
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   222
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   223
    KeyboardMap new 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   224
        parent: (KeyboardMap new bindValue: #Rename to: #F2; yourself);
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   225
        valueFor: #F2
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   226
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   227
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   228
    "Modified: / 23-04-1996 / 21:55:22 / cg"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   229
    "Modified: / 17-05-2017 / 16:32:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   230
! !
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   231
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   232
!KeyboardMap methodsFor:'copying'!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   233
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   234
postCopy
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   235
    current := nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   236
    bindings := bindings copy.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   237
    aliases := aliases copy.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   238
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   239
    "Created: / 12-05-2017 / 22:46:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   240
! !
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   241
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   242
!KeyboardMap methodsFor:'initialization'!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   243
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   244
initialize
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   245
    "Invoked when a new instance is created."
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   246
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   247
    bindings := IdentityDictionary new.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   248
    aliases := IdentityDictionary new.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   249
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   250
    "/ super initialize.   -- commented since inherited method does nothing
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   251
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   252
    "Modified: / 11-05-2017 / 21:44:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   253
! !
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   254
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   255
!KeyboardMap methodsFor:'mapping'!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   256
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   257
bindAlias:logicalKey to:rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   258
    "Bind shortcut alias to logical action. For example, to bind
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   259
     copy action to Alt-C, do
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   260
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   261
     keyboardMap bindAlias: #Copy to: #Altc
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   262
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   263
     Use this one only if you're sure you want to bind an alternative
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   264
     shortcut (alias). For primary shortcuts, please use
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   265
     #bindValue:to:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   266
    "
8036
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   267
    (aliases includesKey: rawKey) ifTrue:[ 
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   268
         Logger warning:'Trying to bind alias (%1) to a logical action (%2) which is already bound (to %3). Removing old alias.' with: rawKey with: logicalKey with: (aliases at: rawKey).
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   269
    ]. 
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   270
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   271
    rawKey == logicalKey ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   272
        aliases removeKey:rawKey ifAbsent:nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   273
    ] ifFalse:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   274
        aliases at:rawKey put:logicalKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   275
    ]
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   276
8036
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   277
    "Modified: / 12-05-2017 / 23:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   278
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   279
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   280
bindValue:logicalKey to:rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   281
    "Bind shortcut alias to logical action. For example, to bind
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   282
     copy action to Alt-C, do
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   283
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   284
     The event mechanism uses this to pass logical keyboard events
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   285
     to the application (such as #Copy, #Cut etc.) 
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   286
     instead of physical ones (such as #AltC, #AltX)"
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   287
8036
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   288
    "/ Issue a warning if logical key is already bound to a shortcut
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   289
    "/ to track possibly unwanted aliases. If you really want to
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   290
    "/ bind an alias, use #bindAlias:to:
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   291
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   292
    | binding |
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   293
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   294
    binding := bindings keyAtValue: logicalKey.
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   295
    binding notNil ifTrue:[ 
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   296
        Logger warning:'Trying to bind shortcut (%1) to a logical action (%2) which is already bound (to %3). Removing old shortcut,' with: rawKey with: logicalKey with: binding.
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   297
    ]. 
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   298
    bindings removeKey: binding ifAbsent: nil.
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   299
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   300
    rawKey == logicalKey ifTrue:[
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   301
        bindings removeKey:rawKey ifAbsent:nil
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
   302
    ] ifFalse:[
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   303
        bindings at:rawKey put:logicalKey
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
   304
    ]
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   305
8036
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   306
    "Modified: / 12-11-1996 / 10:30:56 / cg"
e248f3b96260 Keyboard mapping: issue warning if one attempts to bind a shortcut to an action which already bound
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 8035
diff changeset
   307
    "Modified: / 12-05-2017 / 23:39:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   308
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   309
89
ea2bf46eb669 *** empty log message ***
claus
parents: 72
diff changeset
   310
bindValue:logicalKey to:key1 followedBy:key2
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   311
    "bind aLogicalKey to a sequence of two rawKeys.
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   312
     The event mechanism uses this to pass logical keyboard events
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   313
     to the application (such as #Copy, #Cut etc.) 
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   314
     instead of physical ones (such as #AltC, #AltX)"
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   315
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   316
    |submap|
48194c26a46c Initial revision
claus
parents:
diff changeset
   317
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   318
    submap := bindings at:key1 ifAbsent:[].
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   319
    submap isNil ifTrue:[
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   320
        submap := KeyboardMap new.
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   321
        bindings at:key1 put:submap.
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   322
    ].
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   323
    submap bindValue:logicalKey to: key2
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   324
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   325
    "Modified: / 23-04-1996 / 21:55:04 / cg"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   326
    "Modified: / 11-05-2017 / 21:46:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   327
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   328
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   329
unbindAlias: rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   330
    "Remove (secondary) alias for given `rawKey`. If `rawKey` is not bound
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   331
     calling #unbindAlias: is noop."
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   332
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   333
    bindings removeKey: rawKey ifAbsent: nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   334
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   335
    "Created: / 17-05-2017 / 15:57:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   336
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   337
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   338
unbindValue: rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   339
    "Remove (primary) binding for given `rawKey`. If `rawKey` is not bound
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   340
     calling #unbindValue: is noop."
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   341
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   342
    bindings removeKey: rawKey ifAbsent: nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   343
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   344
    "Created: / 17-05-2017 / 15:56:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   345
! !
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   346
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   347
!KeyboardMap methodsFor:'queries'!
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   348
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   349
aliasesForLogical: logicalKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   350
    "Return all aliases for given (possibly) logical key.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   351
     Example:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   352
       #Copy -> #(Altc CtrlInsert) - depending on mappings
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   353
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   354
    | rawKeys |
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   355
    rawKeys := #().
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   356
    aliases keysAndValuesDo:[:raw :logical |
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   357
        (logicalKey == logical) ifTrue:[ 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   358
            rawKeys := rawKeys copyWith: raw.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   359
        ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   360
    ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   361
    parent notNil ifTrue:[ 
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   362
        rawKeys := rawKeys , (parent aliasesForLogical: logicalKey)
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   363
    ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   364
    ^ rawKeys
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   365
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   366
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   367
    "/ First, search for primary bindings...
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   368
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   369
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   370
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   371
    Screen current keyboardMap rawKeysForLogical: #Copy
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   372
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   373
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   374
    "Created: / 15-05-2017 / 21:27:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   375
!
48194c26a46c Initial revision
claus
parents:
diff changeset
   376
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   377
bindingForLogical: logicalKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   378
    "Return binding for given (possibly) logical key.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   379
     If no binding is defined, returns nil.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   380
     Example:
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   381
       #Copy -> #Ctrlc - depending on mappings
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   382
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   383
    | rawKey |
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   384
    rawKey := bindings keyAtValue: logicalKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   385
    rawKey notNil ifTrue:[ ^ rawKey ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   386
    parent notNil ifTrue:[ ^ parent bindingForLogical: logicalKey ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   387
    ^ nil
6556
f2418ba5d1c5 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
   388
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   389
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   390
    Screen current keyboardMap bindingForLogical: #Copy
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   391
    Screen current keyboardMap bindingForLogical: #Bogus
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   392
    "
6556
f2418ba5d1c5 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
   393
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   394
    "Created: / 15-05-2017 / 21:14:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   395
    "Modified (comment): / 17-05-2017 / 16:06:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   396
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   397
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   398
hasBindingFor:rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   399
    <resource: #obsolete>
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   400
    self obsoleteMethodWarning:'Use #hasMappingFor: instead'.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   401
    ^ self hasMappingFor: rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   402
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   403
    "Created: / 17-05-2017 / 15:40:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
   404
!
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
   405
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   406
hasMappingFor:rawKey
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   407
    "Return true if receiver maps given rawKey into a logical key,
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   408
     false otheriwse. Thic method consults both - (primary) bindings
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   409
     and (secondary) aliases."
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   410
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   411
    | logicalKey |
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   412
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   413
    logicalKey := self mappingFor:rawKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   414
    ^ logicalKey notNil and:[ logicalKey ~= rawKey ]
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   415
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   416
    "
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   417
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   418
        bindValue: #Rename to: #F2;
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   419
        hasMappingFor: #F2
7856
7c52e7a9a087 Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 6663
diff changeset
   420
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   421
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   422
        bindValue: #Rename to: #F2;
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   423
        hasMappingFor: #F10
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   424
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   425
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   426
        parent: (KeyboardMap new bindValue: #Rename to: #F2; yourself);
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   427
        hasMappingFor: #F2
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   428
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   429
     KeyboardMap new
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   430
        parent: (KeyboardMap new bindValue: #Rename to: #F2; yourself);
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   431
        hasMappingFor: #F10
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   432
"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   433
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   434
    "Modified: / 15-05-2017 / 21:35:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   435
    "Modified (comment): / 17-05-2017 / 15:40:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6556
f2418ba5d1c5 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
   436
!
f2418ba5d1c5 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
   437
7969
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   438
rawKeysForLogical: logicalKey
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   439
    <resource: #obsolete>
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   440
    "Return all raw keys for given (possibly) logical key.
7969
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   441
     Example:
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   442
       #Copy -> #(Ctrlc CtrlInsert) - depending on mappings
7969
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   443
    "
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   444
    | rawKey rawKeys |
7969
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   445
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   446
    self obsoleteMethodWarning:'Use #bindingForLogical: and/or #aliasesForLogical:'.  
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   447
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   448
    rawKey := self bindingForLogical: logicalKey.
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   449
    rawKeys := rawKey notNil ifTrue:[ Array with: rawKey ] ifFalse:[ #() ].
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   450
    ^ rawKeys , (self aliasesForLogical: logicalKey)
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   451
7969
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   452
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   453
    "
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   454
    Screen current keyboardMap rawKeysForLogical: #Copy
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   455
    "
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   456
2bac4f32553f Allow individual applications to define their own shortcut mapping
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7856
diff changeset
   457
    "Created: / 08-02-2017 / 23:43:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   458
    "Modified: / 15-05-2017 / 21:29:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   459
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   460
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   461
!KeyboardMap methodsFor:'testing'!
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   462
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   463
isKeyboardMap
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   464
    ^ true
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   465
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 219
diff changeset
   466
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   467
!KeyboardMap class methodsFor:'documentation'!
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   468
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   469
version
6663
a3d11f506f57 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 6556
diff changeset
   470
    ^ '$Header: /cvs/stx/stx/libview/KeyboardMap.st,v 1.15 2014-12-18 16:13:06 cg Exp $'
8035
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   471
!
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   472
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   473
version_HG
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   474
8bbd397fe321 Keyboard mapping: refactored `KeyboardMap` to distinguish between a binding and an alias(es)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7969
diff changeset
   475
    ^ '$Changeset: <not expanded> $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
   476
! !
6556
f2418ba5d1c5 class: KeyboardMap
Claus Gittinger <cg@exept.de>
parents: 5280
diff changeset
   477