KeyboardMap.st
changeset 598 1a2339e902d4
parent 251 915de9a65169
child 612 8758d0c9933e
--- a/KeyboardMap.st	Tue Apr 23 21:41:54 1996 +0200
+++ b/KeyboardMap.st	Tue Apr 23 21:57:07 1996 +0200
@@ -11,10 +11,10 @@
 "
 
 IdentityDictionary subclass:#KeyboardMap
-	 instanceVariableNames:'current'
-	 classVariableNames:''
-	 poolDictionaries:''
-	 category:'Interface-Support'
+	instanceVariableNames:'current'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Support'
 !
 
 !KeyboardMap class methodsFor:'documentation'!
@@ -45,17 +45,17 @@
     To add a mapping (for example, to attach the logical function 'DoIt' to
     the key-combination Cmd-'d'):
 
-	|m|
+        |m|
 
-	m := Display keyboardMap.
-	m bindValue:#DoIt to:#Cmdd.
+        m := Display keyboardMap.
+        m bindValue:#DoIt to:#Cmdd.
 
     Key sequences can also be defined (hey emacs fans ;-) as in:
 
-	|m|
+        |m|
 
-	m := Display keyboardMap.
-	m bindValue:#DoIt to:#Ctrlx followedBy:#Ctrld
+        m := Display keyboardMap.
+        m bindValue:#DoIt to:#Ctrlx followedBy:#Ctrld
 
     Key prefixes are defined in the DeviceWorkstation>>translateKey: method.
     Typical prefixes are Cmd (for Alt or Meta), Ctrl etc.
@@ -66,50 +66,72 @@
     To remove a mapping, use the same value for both logical and physical key,
     as in:
 
-	|m|
+        |m|
 
-	m := Display keyboardMap.
-	m bindValue:#Cmdd to:#Cmdd.
+        m := Display keyboardMap.
+        m bindValue:#Cmdd to:#Cmdd.
+
+    [see also:]
+        WindowEvent WindowSensor WindowGroup
+        View DeviceWorkstation
 "
 ! !
 
 !KeyboardMap methodsFor:'accessing'!
 
 bindValue:logicalKey to:aKey
+    "bind aLogicalKey to a rawKey.
+     The event mechanism uses this to pass logical keyboard events
+     to the application (such as #Copy, #Cut etc.) 
+     instead of physical ones (such as #AltC, #AltX)"
+
     aKey == logicalKey ifTrue:[
-	self removeKey:aKey
+        self removeKey:aKey
     ] ifFalse:[
-	self at:aKey put:logicalKey
+        self at:aKey put:logicalKey
     ]
+
+    "Modified: 23.4.1996 / 21:54:45 / cg"
 !
 
 bindValue:logicalKey to:key1 followedBy:key2
+    "bind aLogicalKey to a sequence of two rawKeys.
+     The event mechanism uses this to pass logical keyboard events
+     to the application (such as #Copy, #Cut etc.) 
+     instead of physical ones (such as #AltC, #AltX)"
+
     |submap|
 
     submap := self at:key1 ifAbsent:[].
     submap isNil ifTrue:[
-	submap := KeyboardMap new.
-	self at:key1 put:submap.
+        submap := KeyboardMap new.
+        self at:key1 put:submap.
     ].
     submap at:key2 put:logicalKey
+
+    "Modified: 23.4.1996 / 21:55:04 / cg"
 !
 
 valueFor:aKey
+    "retrieve a logical key"
+
     |where value|
 
     where := (current notNil ifTrue:[current] ifFalse:[self]).
 
     value := where at:aKey ifAbsent:aKey.
     (value isMemberOf:KeyboardMap) ifTrue:[
-	current := value.
-	^ nil.
+        current := value.
+        ^ nil.
     ].
     current := nil.
     ^ value
+
+    "Modified: 23.4.1996 / 21:55:22 / cg"
 ! !
 
 !KeyboardMap class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/KeyboardMap.st,v 1.9 1995-11-23 17:45:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/KeyboardMap.st,v 1.10 1996-04-23 19:56:52 cg Exp $'
 ! !