[squeak-dev] The Inbox: Morphic-tcj.1482.mcz

Tim Johnson digit at sonic.net
Sat Mar 2 23:46:32 UTC 2019


Hi,

In preparing this, I noticed that #addPaintingItemsTo:hand: lives in Morph but is only sent by SketchMorph.  I thought about moving it to SketchMorph, but didn't want to step to far out of what this contribution is meant to achieve.

Thanks,
Tim

ps - thanks to Eliot and Karl for encouragement!


> On Mar 2, 2019, at 3:35 PM, commits at source.squeak.org wrote:
> 
> A new version of Morphic was added to project The Inbox:
> http://source.squeak.org/inbox/Morphic-tcj.1482.mcz
> 
> ==================== Summary ====================
> 
> Name: Morphic-tcj.1482
> Author: tcj
> Time: 2 March 2019, 3:35:41.130915 pm
> UUID: 78f4a7bc-b74c-408c-bbd9-4729d1d8404e
> Ancestors: Morphic-ul.1481
> 
> Add a menu item to copy a SketchMorph's form as code, thus allowing it to be easily reproduced elsewhere.
> 
> =============== Diff against Morphic-ul.1481 ===============
> 
> Item was changed:
>  ----- Method: Morph>>addPaintingItemsTo:hand: (in category 'menus') -----
>  addPaintingItemsTo: aMenu hand: aHandMorph 
>  	| subMenu movies |
>  	subMenu := MenuMorph new defaultTarget: self.
>  	subMenu
>  		add: 'repaint' translated action: #editDrawing;
>  		add: 'set rotation center' translated action: #setRotationCenter;
>  		add: 'reset forward-direction' translated action: #resetForwardDirection;
>  		add: 'set rotation style' translated action: #setRotationStyle;
>  		add: 'erase pixels of color' translated action: #erasePixelsUsing:;
>  		add: 'recolor pixels of color' translated action: #recolorPixelsUsing:;
> + 		add: 'copy as code' translated action: #copyAsCode;
>  		add: 'reduce color palette' translated action: #reduceColorPalette:;
>  		add: 'detect edges' translated action: #edgeDetect;
>  		add: 'sharpen' translated action: #sharpen;
>  		add: 'blur' translated action: #blur;
>  		add: 'emboss' translated action: #emboss;
>  		add: 'add a border around this shape...' translated action: #addBorderToShape:.
>  	movies := (self world rootMorphsAt: aHandMorph targetPoint) 
>  				select: [:m | (m isKindOf: MovieMorph) or: [m isSketchMorph]].
>  	movies size > 1 
>  		ifTrue: 
>  			[subMenu add: 'insert into movie' translated action: #insertIntoMovie:].
>  	aMenu add: 'painting...' translated subMenu: subMenu!
> 
> Item was added:
> + ----- Method: SketchMorph>>copyAsCode (in category 'menu') -----
> + copyAsCode
> + 	| s | 
> + 	"Copy a textual representation of my form to the clipboard, which can be used to easily recreate it.  
> + 	Choosing to reduce colors can create a much smaller string."
> + 	s := String new writeStream.
> + 	( ( self confirm: 'reduce colors?' )
> + 		ifTrue: [ self form colorReduced ]
> + 		ifFalse: [ self form ] ) storeOn: s.
> + 	Clipboard clipboardText: s close contents.
> + 	!
> 
> 
> 



More information about the Squeak-dev mailing list