[squeak-dev] The Inbox: Morphic-yo.519.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jun 30 21:42:23 UTC 2011
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-yo.519.mcz
==================== Summary ====================
Name: Morphic-yo.519
Author: yo
Time: 30 June 2011, 2:41:06.841 pm
UUID: ae729cff-3598-439c-a437-e24c79d87993
Ancestors: Morphic-mtf.518
Implements "Button for it" feature.
=============== Diff against Morphic-mtf.518 ===============
Item was added:
+ ----- Method: SmalltalkEditor>>buttonForIt (in category 'do-its') -----
+ buttonForIt
+
+ ^ self doItButtonFromSelection ifNotNilDo: [:e | e openInHand]!
Item was added:
+ ----- Method: SmalltalkEditor>>doItButtonFromSelection (in category 'do-its') -----
+ doItButtonFromSelection
+
+ | button string cm |
+ self lineSelectAndEmptyCheck: [^ nil].
+ button := SimpleButtonMorph new.
+ string := self selection.
+ (model respondsTo: #doItReceiver)
+ ifTrue: [
+ button setProperty: #rcvr toValue: model doItReceiver.
+ button setProperty: #ctxt toValue: model doItContext].
+
+ cm := (button valueOfProperty: #rcvr) class compilerClass new
+ compiledMethodFor: string readStream
+ in: (button valueOfProperty: #ctxt)
+ to: (button valueOfProperty: #rcvr)
+ notifying: nil
+ ifFail: [^ nil]
+ logged: false.
+ button setProperty: #cm toValue: cm.
+ button target: [:b |
+ [(b valueOfProperty: #cm) valueWithReceiver: (b valueOfProperty: #rcvr) arguments:
+ ((b valueOfProperty: #ctxt) ifNotNil: [{(b valueOfProperty: #ctxt) }] ifNil: [#()])]
+ on: OutOfScopeNotification
+ do: [ :ex | ex resume: true]];
+ actionSelector: #value:;
+ arguments: {button}.
+ button label: string.
+ ^ button.
+ !
More information about the Squeak-dev
mailing list
|