'From Squeak3.2gamma of 15 January 2002 [latest update: #4913] on 11 July 2002 at 7:48:51 am'! "Change Set: dupKeys-nk Date: 11 July 2002 Author: Ned Konz A persuasive argument was made by David Farber to allow duplication of Ctrl and Alt keys. This adds a preference called 'duplicateControlAndAltKeys' that does just that. You can still just swap the keys if you want. Per Doug Way's suggestion, this also changes the default keys to swap to be: $c . $x . $v . $a . $s . $f . $g . $z x (cut) c (copy) v (paste) a (select all) s (save) f (find) g (find again) z (undo) And (unlike the original change set) this will maintain existing Preference settings when installed. The two preferences are mutually exclusive; setting one will reset the other. One small manual correction made in the Postscript by Scott Wallace 7/11/02. "! !InputSensor class methodsFor: 'public' stamp: 'nk 7/11/2002 07:14'! duplicateControlAndAltKeys: aBoolean "InputSensor duplicateControlAndAltKeys: true" Preferences setPreference: #duplicateControlAndAltKeys toValue: aBoolean. self installKeyDecodeTable ! ! !InputSensor class methodsFor: 'public' stamp: 'nk 7/11/2002 07:09'! installDuplicateKeyEntryFor: c | key | key _ c asInteger. "first do control->alt key" KeyDecodeTable at: { key bitAnd: 16r9F . 2 } put: { key . 8 }. "then alt->alt key" KeyDecodeTable at: { key . 8 } put: { key . 8 } ! ! !InputSensor class methodsFor: 'class initialization' stamp: 'nk 7/11/2002 07:41'! defaultCrossPlatformKeys "Answer a list of key letters that are used for common editing operations on different platforms." ^{ $c . $x . $v . $a . $s . $f . $g . $z } ! ! !InputSensor class methodsFor: 'class initialization' stamp: 'nk 7/11/2002 07:41'! installKeyDecodeTable "Create a decode table that swaps some keys if Preferences swapControlAndAltKeys is set" KeyDecodeTable _ Dictionary new. Preferences duplicateControlAndAltKeys ifTrue: [ self defaultCrossPlatformKeys do: [ :c | self installDuplicateKeyEntryFor: c ] ]. Preferences swapControlAndAltKeys ifTrue: [ self defaultCrossPlatformKeys do: [ :c | self installSwappedKeyEntryFor: c ] ]. ! ! !InputSensor class methodsFor: 'preference change notification' stamp: 'nk 7/11/2002 07:32'! duplicateControlAndAltKeysChanged "The Preference for duplicateControlAndAltKeys has changed." (Preferences valueOfFlag: #swapControlAndAltKeys ifAbsent: [false]) ifTrue: [ self inform: 'Resetting swapControlAndAltKeys preference'. (Preferences preferenceAt: #swapControlAndAltKeys) rawValue: false. ]. self installKeyDecodeTable. ! ! !InputSensor class methodsFor: 'preference change notification' stamp: 'nk 7/11/2002 07:32'! swapControlAndAltKeysChanged "The Preference for swapControlAndAltKeys has changed." (Preferences valueOfFlag: #duplicateControlAndAltKeys ifAbsent: [false]) ifTrue: [ self inform: 'Resetting duplicateControlAndAltKeys preference'. (Preferences preferenceAt: #duplicateControlAndAltKeys) rawValue: false. ]. self installKeyDecodeTable. ! ! !Preferences class methodsFor: 'standard queries'! duplicateControlAndAltKeys ^ self valueOfFlag: #duplicateControlAndAltKeys ifAbsent: [true]! ! "Postscript: Add the preference properly, then initialize the InputSensor class. Maintain existing preference if any. " Preferences addPreference: #swapMouseButtons categories: #(general) default: (Preferences valueOfFlag: #swapMouseButtons ifAbsent: [false]) balloonHelp: 'if true, swaps mouse buttons 2 and 3' projectLocal: false changeInformee: InputSensor changeSelector: #installMouseDecodeTable . Preferences addPreference: #swapControlAndAltKeys categories: #(general) default: (Preferences valueOfFlag: #swapControlAndAltKeys ifAbsent: [false]) balloonHelp: 'if true, swaps some control- and alt-keys (making ctrl-c be copy instead of alt-c.) Cannot be true if duplicateControlAndAltKeys is true.' projectLocal: false changeInformee: InputSensor changeSelector: #swapControlAndAltKeysChanged . Preferences addPreference: #duplicateControlAndAltKeys categories: #(general) default: (Preferences valueOfFlag: #duplicateControlAndAltKeys ifAbsent: [false]) balloonHelp: 'if true, duplicates some alt- keys as ctrl-keys (making ctrl-c be copy as well as alt-c) Cannot be true if swapControlAndAltKeys is true.' projectLocal: false changeInformee: InputSensor changeSelector: #duplicateControlAndAltKeysChanged . InputSensor startUp. !