[squeak-dev] The Trunk: MorphicExtras-fbs.109.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 13 20:27:06 UTC 2013


Frank Shearar uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-fbs.109.mcz

==================== Summary ====================

Name: MorphicExtras-fbs.109
Author: fbs
Time: 13 June 2013, 9:26:34.254 pm
UUID: 348890fc-98b1-47f2-affb-d1a21031a8ba
Ancestors: MorphicExtras-fbs.108

ScrapBook holds the global state formerly stored in Utilities' ScrapsBook class var.

=============== Diff against MorphicExtras-fbs.108 ===============

Item was added:
+ Object subclass: #ScrapBook
+ 	instanceVariableNames: 'book'
+ 	classVariableNames: 'Default'
+ 	poolDictionaries: ''
+ 	category: 'MorphicExtras-Support'!
+ 
+ !ScrapBook commentStamp: 'fbs 5/18/2013 23:01' prior: 0!
+ I provide a holding place for Morphs deleted through the pink halo button or being dragged onto the trashcan.!

Item was added:
+ ----- Method: ScrapBook class>>cleanUp: (in category 'initialize-release') -----
+ cleanUp: aggressive
+ 	"Nuke the scraps book when cleaning aggressively"
+ 
+ 	aggressive ifTrue: [Default := nil].!

Item was added:
+ ----- Method: ScrapBook class>>default (in category 'accessing') -----
+ default
+ 	^ Default ifNil: [Default := ScrapBook new].!

Item was added:
+ ----- Method: ScrapBook>>addToTrash: (in category 'scraps') -----
+ addToTrash: aMorph
+ 	"Paste the object onto a page of the system Trash book, unless the preference is set to empty the trash immediately."
+ 
+ 	| aPage |
+ 	Preferences preserveTrash ifFalse: [^ self].
+ 
+ 	aMorph position: book pages first position + (0 at 40).
+ 	book pages do: [:pp | 
+ 		(pp submorphs size = 1 and: [pp hasProperty: #trash]) ifTrue:  "perhaps remove that property here"
+ 			["page is blank"
+ 			^ pp addMorph: aMorph]].
+ 	aPage := book insertPageLabel: Time dateAndTimeNow printString
+ 		morphs: (Array with: aMorph).
+ 	aPage setProperty: #trash toValue: true!

Item was added:
+ ----- Method: ScrapBook>>emptyScrapBook (in category 'scraps') -----
+ emptyScrapBook
+ 	| oldScraps |
+ 	oldScraps := book.
+ 	book := nil. "Creates it afresh"
+ 	book := self scrapBook.
+ 	(oldScraps notNil and: [oldScraps owner notNil])
+ 		ifTrue:
+ 			[book position: oldScraps position.
+ 			oldScraps owner replaceSubmorph: oldScraps by: book.
+ 			book changed; layoutChanged]!

Item was added:
+ ----- Method: ScrapBook>>initialize (in category 'initialize-release') -----
+ initialize
+ 	super initialize.
+ 	book := self scrapBook.!

Item was added:
+ ----- Method: ScrapBook>>maybeEmptyTrash (in category 'scraps') -----
+ maybeEmptyTrash
+ 	(self confirm: 'Do you really want to empty the trash?' translated)
+ 		ifTrue: [self emptyScrapBook]!

Item was added:
+ ----- Method: ScrapBook>>scrapBook (in category 'scraps') -----
+ scrapBook
+ 	| header aButton label |
+ 	^ book ifNil: [
+ 		book := BookMorph new pageSize: 200 at 300; setNameTo: 'scraps' translated.
+ 		book color: Color yellow muchLighter.
+ 		book borderColor: Color darkGray; borderWidth: 2.
+ 		book removeEverything; showPageControls; insertPage.
+ 		header := AlignmentMorph newRow wrapCentering: #center; cellPositioning: #leftCenter.
+ 		header setProperty: #header toValue: true.
+ 		header addMorph: (aButton := SimpleButtonMorph new label: 'O' font: Preferences standardButtonFont).
+ 		aButton target: book;
+ 			color:  Color tan;
+ 			actionSelector: #delete;
+ 			setBalloonText: 'Close the trashcan.\(to view again later, click on any trashcan).' withCRs translated.
+ 
+ 		header addMorphBack: AlignmentMorph newVariableTransparentSpacer beSticky.
+ 		header addMorphBack: 	(label := UpdatingStringMorph new target: self) beSticky.
+ 		label getSelector: #trashTitle; useStringFormat; step.
+ 		header addMorphBack: AlignmentMorph newVariableTransparentSpacer beSticky.
+ 		header addMorphBack: (aButton := SimpleButtonMorph new label: 'E' translated font: Preferences standardButtonFont).
+ 		aButton target: Utilities; color:  Color veryLightGray; actionSelector: #maybeEmptyTrash;
+ 			setBalloonText: 'Click here to empty the trash.' translated.
+ 		book currentPage addMorph: (TextMorph new contents: 'Objects you drag into the trash will automatically be saved here, one object per page, in case you need them later.  To disable this feature set the "preserveTrash" Preference to false.\\You can individually expunge objects by hitting the - control, and you can empty out all the objects in the trash can by hitting the "E" button at top right.' withCRs translated
+ 		wrappedTo: 190).
+ 
+ 		book addMorphFront: header.
+ 		book setProperty: #scraps toValue: true].!

Item was added:
+ ----- Method: ScrapBook>>trashTitle (in category 'scraps') -----
+ trashTitle
+ 	| label pgs |
+ 	label := 'T R A S H' translated.
+ 	^ (pgs := book pages size) < 2
+ 		ifTrue:
+ 			[label]
+ 		ifFalse:
+ 			[label, ('  ({1} pages)' translated format:{pgs})]!



More information about the Squeak-dev mailing list