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

commits at source.squeak.org commits at source.squeak.org
Sat Mar 2 23:35:45 UTC 2019


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