Why a workspace instead of compiling straight to a method with a specified selector?
On Sat, Jun 28, 2014 at 6:47 AM, commits@source.squeak.org wrote:
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)'!
I used the existing edit: method in CustomHelp. The help browser is hooked up in a little unusual way so editing is very indirect. But I will look at accepting changes directly from the text pane, that is a much nicer solution.
Also since one can do HelpBrowser openOn: SystemReference, editing comments everywhere will be a bigger task to handle.
Karl
On Sun, Jun 29, 2014 at 6:31 PM, Chris Muller asqueaker@gmail.com wrote:
Why a workspace instead of compiling straight to a method with a specified selector?
On Sat, Jun 28, 2014 at 6:47 AM, commits@source.squeak.org wrote:
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)'!
squeak-dev@lists.squeakfoundation.org