[FIX?] [Modules] Closing project windows

Henrik Gedenryd h.gedenryd at open.ac.uk
Mon Mar 25 09:01:55 UTC 2002


I've taken a stab at the bug preventing us from closing project windows. The
problem is that the last ifNotNil: block was dealing with Environments and I
don't quite understand what it was trying to do, so I can't figure out what
it would translate to in the modules world.

Here I've simply commented it out and it sorta works on the surface but
probably something eToy-related breaks because of this.

Henrik


-------------- next part --------------
'From Squeak3.3alpha of 30 January 2002 [latest update: #4769] on 24 March 2002 at 7:37:10 pm'!
"Change Set:		closingProjectSemiFix
Date:			24 March 2002
Author:			Henrik Gedenryd

This makes Project windows closable but simply comments out a chunk of Environments-related code that I translated into something equivalent for modules, but really couldn't make sense of."!


!ImageSegment methodsFor: 'read/write segment' stamp: 'hg 3/24/2002 19:29'!
rootsIncludingPlayers
	"Return a new roots array with more objects.  (Caller should store into rootArray.) Player (non-systemDefined) gets its class and metaclass put into the Roots array.  Then ask for the segment again."

	| extras havePresenter players morphs mod existing |
	userRootCnt ifNil: [userRootCnt _ arrayOfRoots size].
	extras _ OrderedCollection new.
	arrayOfRoots do: [:root | 
		(root isKindOf: Presenter) ifTrue: [havePresenter _ root].
		(root isKindOf: PasteUpMorph) ifTrue: [
				root isWorldMorph ifTrue: [havePresenter _ root presenter]].
		(root isKindOf: Project) ifTrue: [havePresenter _ root world presenter]].
	havePresenter ifNotNil: [
		havePresenter flushPlayerListCache.		"old and outside guys"
		morphs _ IdentitySet new: 400.
		havePresenter associatedMorph allMorphsAndBookPagesInto: morphs.
		players _ (morphs select: [:m | m player ~~ nil] 
					thenCollect: [:m | m player]) asArray.
		players _ players select: [:ap | (arrayOfRoots includes: ap class) not
			& (ap class isSystemDefined not)].
		extras addAll: (players collect: [:each | each class]).
		(mod _ havePresenter world project module) ifNil: [
			extras addAll: (players collect: [:each | each class class])].
		extras addAll: morphs.	"Make then ALL roots!!"
		].
	existing _ arrayOfRoots asIdentitySet.
	extras _ extras reject: [ :each | existing includes: each].
	extras isEmpty ifTrue: [^ nil].	"no change"
	mod 
		ifNotNil: [
			"this code is meaningless with modules, don't know what it should correspond to
			mod definesName: #Object ifTrue: [:a |self error: 'only look in local mod, not up chain']. "
				"If get error, use a message other than includesKey:"
			"extras reject: [:cls | 
				mod definesName: cls name ifTrue: [:a | ]].
			ModuleRefactorer new 
				transferBindingsNamedIn: (extras collect: [:c | c name])
				from: Module smalltalk to: mod."
			].
	havePresenter _ players _ morphs _ nil.
	^ arrayOfRoots, extras! !



More information about the Squeak-dev mailing list