[squeak-dev] The Trunk: Morphic-bf.553.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu Jun 30 22:01:16 UTC 2011
Bert Freudenberg uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-bf.553.mcz
==================== Summary ====================
Name: Morphic-bf.553
Author: bf
Time: 30 June 2011, 11:59:55.988 pm
UUID: d9302a11-c4d7-4f5a-be1a-61eb94c07684
Ancestors: Morphic-bf.552, Morphic-yo.520
merge "Button for it" feature
=============== Diff against Morphic-bf.552 ===============
Item was added:
+ ----- Method: PluggableTextMorph>>buttonForIt (in category 'menu commands') -----
+ buttonForIt
+ self handleEdit: [textMorph editor buttonForIt]!
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
|