The Trunk: Morphic-cmm.342.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-cmm.342.mcz

commits-2
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.342.mcz

==================== Summary ====================

Name: Morphic-cmm.342
Author: cmm
Time: 13 February 2010, 2:56:02.867 pm
UUID: e675c8ff-c0b1-4172-bb5d-6587df8d9c8b
Ancestors: Morphic-nice.341

- Added four useful hot-keys to SmalltalkEditor.  Cmd+1 - Cmd+4 will paste that method argument into the method.

Rationale:  Productivity.  When typing method source, you almost always need to utilize the incoming arguments, it is therefore very convenient to be able to do so with one hot-key.

=============== Diff against Morphic-nice.341 ===============

Item was added:
+ ----- Method: SmalltalkEditor>>methodArgument: (in category 'private') -----
+ methodArgument: anInteger
+ ^ (ReadStream on: self text asString) nextLine substrings
+ at: 2*anInteger
+ ifAbsent: [ String empty ]!

Item was added:
+ ----- Method: SmalltalkEditor>>typeMethodArgument: (in category 'private') -----
+ typeMethodArgument: characterStream
+ "Replace the current text selection with the name of the method argument represented by the keyCode."
+ | keyCode |
+ keyCode := ('1234'
+ indexOf: sensor keyboard
+ ifAbsent: [1]).
+ characterStream nextPutAll: (self methodArgument: keyCode).
+ ^ false!

Item was changed:
  ----- Method: SmalltalkEditor class>>initializeCmdKeyShortcuts (in category 'keyboard shortcut tables') -----
  initializeCmdKeyShortcuts
  "Initialize the (unshifted) command-key (or alt-key) shortcut table."
-
  "NOTE: if you don't know what your keyboard generates, use Sensor kbdTest"
-
  "SmalltalkEditor initialize"
-
  | cmds |
  super initializeCmdKeyShortcuts.
-
  cmds := #($b #browseIt: $d #doIt: $i #inspectIt: $j #doAgainOnce: $l #cancel: $m #implementorsOfIt: $n #sendersOfIt: $o #spawnIt: $p #printIt: $q #querySymbol: $s #save: ).
  1 to: cmds size
  by: 2
+ do: [ : i | cmdActions at: (cmds at: i) asciiValue + 1 put: (cmds at: i + 1)].
+ "Set up type-method argument hot keys, 1-4.."
+ '1234' do:
+ [ : eachKeyboardChar |
+ cmdActions
+ at: eachKeyboardChar asciiValue + 1
+ put: #typeMethodArgument: ]!
- do: [:i | cmdActions at: (cmds at: i) asciiValue + 1 put: (cmds at: i + 1)]!