[squeak-dev] The Inbox: MorphicExtras-fbs.108.mcz

commits at source.squeak.org commits at source.squeak.org
Mon May 20 18:43:17 UTC 2013


A new version of MorphicExtras was added to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-fbs.108.mcz

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

Name: MorphicExtras-fbs.108
Author: fbs
Time: 20 May 2013, 7:42:41.076 pm
UUID: ff1de6e0-6c3a-4322-9c1a-ce0bed2406df
Ancestors: MorphicExtras-fbs.107

A ScrapBook uses a BookMorph to store Morphs. It replaces Utilities' scrapsBook.

=============== Diff against MorphicExtras-fbs.107 ===============

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})]!

Item was added:
+ ----- Method: Utilities class>>addToTrash: (in category '*MorphicExtras-scraps') -----
+ addToTrash: aMorph
+ 	ScrapBook default addToTrash: aMorph.!

Item was added:
+ ----- Method: Utilities class>>emptyScrapsBook (in category '*MorphicExtras-scraps') -----
+ emptyScrapsBook
+ 	ScrapBook default emptyScrapBook!

Item was added:
+ ----- Method: Utilities class>>maybeEmptyTrash (in category '*MorphicExtras-scraps') -----
+ maybeEmptyTrash
+ 	ScrapBook default maybeEmptyTrash.!

Item was changed:
+ ----- Method: Utilities class>>scrapsBook (in category '*MorphicExtras-scraps') -----
- ----- Method: Utilities class>>scrapsBook (in category '*MorphicExtras') -----
  scrapsBook
+ 	^ ScrapBook default scrapBook!
- 	| header aButton label |
- 	ScrapsBook ifNil:
- 		[ScrapsBook := BookMorph new pageSize: 200 at 300; setNameTo: 'scraps' translated.
- 		ScrapsBook color: Color yellow muchLighter.
- 		ScrapsBook borderColor: Color darkGray; borderWidth: 2.
- 		ScrapsBook 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: ScrapsBook; color:  Color tan; actionSelector: #delete;
- 				setBalloonText: 'Close the trashcan.
- (to view again later, click on any trashcan).' 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.
- 		ScrapsBook 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.' translated
- 			wrappedTo: 190).
- 
- 		ScrapsBook addMorphFront: header.
- 		ScrapsBook setProperty: #scraps toValue: true].
- 	^ ScrapsBook
- 
- 	"Utilities emptyScrapsBook"
- !



More information about the Squeak-dev mailing list