[squeak-dev] The Inbox: Morphic-kfr.724.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Jun 28 11:48:35 UTC 2014
A new version of Morphic was added to project The Inbox:
http://source.squeak.org/inbox/Morphic-kfr.724.mcz
==================== Summary ====================
Name: Morphic-kfr.724
Author: kfr
Time: 28 June 2014, 1:46:47.335 pm
UUID: ff507c56-3511-b446-abab-3e0c573e43c7
Ancestors: Morphic-kfr.723
Add convenience menu options for SketchMorph: encode graphics to a Workspace so graphics can be added in methods and a option to add graphics to Standard Graphics Library
=============== Diff against Morphic-kfr.723 ===============
Item was changed:
----- Method: SketchMorph>>addCustomMenuItems:hand: (in category 'menu') -----
addCustomMenuItems: aCustomMenu hand: aHandMorph
"Add custom menu items"
super addCustomMenuItems: aCustomMenu hand: aHandMorph.
aCustomMenu add: 'restore base graphic' translated target: self action: #restoreBaseGraphicFromMenu.
aCustomMenu add: 'call this my base graphic' translated target: self action: #callThisBaseGraphic.
aCustomMenu add: 'choose new graphic...' translated target: self action: #chooseNewGraphic.
aCustomMenu addLine.
aCustomMenu add: 'set as background' translated target: rotatedForm action: #setAsBackground.
+ aCustomMenu add: 'add to StandardGraphicsLibrary' translated action: #addToStandardGraphicsLibrary.
+ aCustomMenu add: 'encode To Workspace' translated action: #encodeToWorkspace.
self addPaintingItemsTo: aCustomMenu hand: aHandMorph!
Item was added:
+ ----- Method: SketchMorph>>addToStandardGraphicsLibrary (in category 'menu') -----
+ addToStandardGraphicsLibrary
+ | aName |
+ aName := FillInTheBlankMorph
+ request: 'Picture name ?'
+ initialAnswer: self name.
+ ScriptingSystem saveForm: rotatedForm atKey: aName
+ !
Item was added:
+ ----- Method: SketchMorph>>encodeToWorkspace (in category 'menu') -----
+ encodeToWorkspace
+ | stream encodedStream text |
+ stream := RWBinaryOrTextStream on: String new.
+ PNGReadWriter putForm: rotatedForm onStream: stream.
+ encodedStream := stream contents asByteArray base64Encoded.
+ text := Workspace open model.
+ text contents: 'Form fromBinaryStream: (Base64MimeConverter mimeDecodeToBytes: ''' , encodedStream , ''' readStream)'!
More information about the Squeak-dev
mailing list
|