[squeak-dev] The Trunk: MorphicExtras-dtl.216.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Nov 18 03:20:22 UTC 2017


David T. Lewis uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-dtl.216.mcz

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

Name: MorphicExtras-dtl.216
Author: dtl
Time: 17 November 2017, 10:20:14.502303 pm
UUID: 58c41a67-c2cb-4776-9cc3-c9edbf70f443
Ancestors: MorphicExtras-dtl.215

Remove unnecessary references to global World.

=============== Diff against MorphicExtras-dtl.215 ===============

Item was changed:
  ----- Method: AtomMorph class>>example (in category 'examples') -----
  example
  	"
  	AtomMorph example
  	"
+ 	|a world|
+ 	world := Project current world.
- 	|a|
  	a := AtomMorph new openInWorld. 
  	a color: Color random.
+  	[1000 timesRepeat:  [a bounceIn: world bounds.  (Delay forMilliseconds: 50) wait]. 
-  	[1000 timesRepeat:  [a bounceIn: World bounds.  (Delay forMilliseconds: 50) wait]. 
  	 a delete] fork.!

Item was changed:
  ----- Method: InternalThreadNavigationMorph class>>openThreadNamed:atIndex: (in category 'known threads') -----
  openThreadNamed: nameOfThread atIndex: anInteger
  
  	| coll nav |
  
  	coll := self knownThreads at: nameOfThread ifAbsent: [^self].
+ 	nav := Project current world 
- 	nav := World 
  		submorphThat: [ :each | (each isKindOf: self) and: [each threadName = nameOfThread]]
  		ifNone: [
  			nav := self basicNew.
  			nav
  				listOfPages: coll;
  				threadName: nameOfThread index: anInteger;
  				initialize;
  				openInWorld;
  				positionAppropriately.
  			^self
  		].
  	nav
  		listOfPages: coll;
  		threadName: nameOfThread index: anInteger;
  		removeAllMorphs;
  		addButtons.
  
  !

Item was changed:
  ----- Method: InternalThreadNavigationMorph class>>openThreadNamed:atIndex:beKeyboardHandler: (in category 'known threads') -----
  openThreadNamed: nameOfThread atIndex: anInteger beKeyboardHandler: aBoolean
  	"Activate the thread of the given name, from the given index; set it up to be navigated via desktop keys if indicated"
  
  	| coll nav |
  
  	coll := self knownThreads at: nameOfThread ifAbsent: [^self].
+ 	nav := Project current world 
- 	nav := World 
  		submorphThat: [ :each | (each isKindOf: self) and: [each threadName = nameOfThread]]
  		ifNone:
  			[nav := self basicNew.
  			nav
  				listOfPages: coll;
  				threadName: nameOfThread index: anInteger;
  				initialize;
  				openInWorld;
  				positionAppropriately.
  			aBoolean ifTrue: [ActiveWorld keyboardNavigationHandler: nav].
  			^ self].
  	nav
  		listOfPages: coll;
  		threadName: nameOfThread index: anInteger;
  		removeAllMorphs;
  		addButtons.
  	aBoolean ifTrue: [ActiveWorld keyboardNavigationHandler: nav]
  
  !

Item was changed:
  ----- Method: PostscriptCanvas class>>fontSampler (in category 'font mapping') -----
  fontSampler
  	"Produces a Postscript .eps file on disk, returns a Morph."
  	"PostscriptCanvas fontSampler"
  	"PostscriptCanvas fontSampler openInWorld"
  	| morph file |
  	morph := Morph new
  		layoutPolicy: TableLayout new;
  		listDirection: #topToBottom;
  		wrapDirection: #leftToRight;
  		hResizing: #shrinkWrap;
  		vResizing: #shrinkWrap;
  		color: Color white.
  	TextStyle actualTextStyles keysAndValuesDo: [ :styleName :style |
  		{ style fontArray first. style fontArray last } do: [ :baseFont | | info |
  			0 to: 2 do: [ :i | | font string string2 textMorph row |
  				font := baseFont emphasized: i.
  				(i isZero or: [ font ~~ baseFont ]) ifTrue: [
  					string := font fontNameWithPointSize.
  					row := Morph new
  						layoutPolicy: TableLayout new;
  						listDirection: #topToBottom;
  						hResizing: #shrinkWrap;
  						vResizing: #shrinkWrap;
  						cellSpacing: 20 at 0;
  						color: Color white.
  		
  					textMorph := TextMorph new hResizing: #spaceFill; backgroundColor: Color white; beAllFont: font; contentsAsIs: string.
  					row addMorphBack: (textMorph imageForm asMorph).
  
  					info := self postscriptFontInfoForFont: font.
  					string2 := String streamContents: [ :stream |
  						stream nextPutAll: info first; space; print: (font pixelSize * info second) rounded.
  					].
  					textMorph := TextMorph new hResizing: #spaceFill; backgroundColor: Color white; beAllFont: font; contentsAsIs: string2.
  					row addMorphBack: textMorph.
  					
  					morph addMorphBack: row.
  				]
  			]
  		]
  	].
+ 	morph bounds: Project current world bounds.
- 	morph bounds: World bounds.
  	morph layoutChanged; fullBounds.
  	file := (FileDirectory default newFileNamed: 'PSFontSampler.eps').
  	Cursor wait showWhile: [ 
  		file nextPutAll: (EPSCanvas morphAsPostscript: morph) ].
  	^morph!

Item was changed:
  ----- Method: ProjectNavigationMorph>>findAProject (in category 'the actions') -----
  findAProject
  
  	FileList2 
+ 		morphicViewProjectLoader2InWorld: self world
- 		morphicViewProjectLoader2InWorld: World
  		reallyLoad: true
  		dirFilterType: #initialDirectoryList!

Item was changed:
  ----- Method: ProjectSorterMorph>>addControls (in category 'initialization') -----
  addControls
  	"Add the control bar at the top of the tool."
  
  	| b r partsBinButton newButton aWrapper |
+ 	newButton := ImageMorph new image: (self world project makeThumbnail scaledToSize: 48 at 36).
- 	newButton := ImageMorph new image: (World project makeThumbnail scaledToSize: 48 at 36).
  	newButton on: #mouseDown send: #insertNewProject: to: self.
  	newButton setBalloonText: 'Make a new Project' translated.
  	(partsBinButton := UpdatingThreePhaseButtonMorph checkBox)
  		target: self;
  		actionSelector: #togglePartsBinStatus;
  		arguments: #();
  		getSelector: #getPartsBinStatus.
  	(r := AlignmentMorph newRow)
  		color: Color transparent;
  		borderWidth: 0;
  		layoutInset: 0;
  		cellInset: 10 at 0;
  		wrapCentering: #center;
  		cellPositioning: #leftCenter;
  		hResizing: #shrinkWrap;
  		vResizing: #shrinkWrap;
  		extent: 5 at 5.
  	b := SimpleButtonMorph new target: self; color: self defaultColor darker;
  			borderColor: Color black.
  	r addMorphBack: (self wrapperFor: (b label: 'Okay' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #acceptSort)).
  	b := SimpleButtonMorph new target: self; color: self defaultColor darker;
  			borderColor: Color black.
  	r addMorphBack: (self wrapperFor: (b label: 'Cancel' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #delete));
  		addTransparentSpacerOfSize: 8 @ 0;
  		addMorphBack: (self wrapperFor: (newButton));
  		addTransparentSpacerOfSize: 8 @ 0.
  
  	aWrapper := AlignmentMorph newRow beTransparent.
  	aWrapper cellInset: 0; layoutInset: 0; borderWidth: 0.
  	aWrapper
  		addMorphBack: (self wrapperFor: partsBinButton);
  		addMorphBack: (self wrapperFor: (StringMorph contents: 'Parts bin' translated font: ScriptingSystem fontForEToyButtons) lock).
  	r addMorphBack: aWrapper.
  
  	self addMorphFront: r.
  !

Item was changed:
  ----- Method: SqueakPage>>prePurge (in category 'saving') -----
  prePurge
  	"Return self if ready to be purged, or nil if not"
  
  	self isContentsInMemory ifFalse: [^ nil].
  	contentsMorph ifNil: [^ nil].  "out already"
  	url ifNil: [^ nil].	"just to be safe"
+ 	^ (Project current world ~~ nil and: [contentsMorph world == Project current world]) 
- 	^ (Project current world ~~ nil and: [contentsMorph world == World]) 
  		ifTrue: [nil "showing now"] ifFalse: [self]!



More information about the Squeak-dev mailing list