'From etoys3.0 of 28 February 2008 [latest update: #2014] on 16 June 2008 at 8:21:35 pm'! "Change Set: abandonUnsituated-sw Date: 16 June 2008 Author: Scott Wallace Re: TRAC 7147 Provides a remedy for bloated projects which have chains of unsituated players which refer to each other in player-valued instance variables. At user request, via a new item 'abandon unsituated players', in the authoring-tools menu, the user can now request that all such references be transformed into references to the 'Dot' standard player."! !PasteUpMorph methodsFor: 'menu' stamp: 'sw 6/16/2008 20:21'! abandonUnsituatedPlayers "If any objects in the project have references, in player-valued variables, to other objects otherwise not present in the project, abandon them and replace former references to them by references to Dot" | aList dot slotInfo varName ref allPlayers count | count := 0. allPlayers := ActiveWorld presenter reallyAllExtantPlayersNoSort. aList := allPlayers select: [:m | m belongsToUniClass]. dot := self presenter standardPlayer. aList do: [:p | p class slotInfo associationsDo: [:assoc | slotInfo := assoc value. varName := assoc key. (slotInfo type = #Player) ifTrue: [ref := p instVarNamed: varName. (allPlayers includes: ref) ifFalse: [p instVarNamed: varName put: dot. count := count + 1. Transcript cr; show: 'Variable named' translated, ' "', varName, '" ', 'in' translated, ' player named' translated, ' "', ref externalName, '" ', 'changed to point to Dot']]]]. aList := nil. "Increases chance of the next line having desired effect." self inform: count printString, ' item(s) fixed up' translated. WorldState addDeferredUIMessage: [Smalltalk garbageCollect]! ! !Presenter methodsFor: 'playerList' stamp: 'sw 6/16/2008 20:20'! reportPlayersAndScripts "Open a window which contains a report on players and their scripts" | aList aString | self flushPlayerListCache. "Just to be certain we get everything" Smalltalk garbageCollect. (aList _ self uniclassesAndCounts) ifEmpty: [^ self inform: 'there are no scripted players' translated]. aString _ String streamContents: [:aStream | aList do: [:aPair | aStream nextPutAll: aPair first name, ' -- ', aPair second printString. aStream nextPutAll: ' ', (aPair second > 1 ifTrue: ['instances'] ifFalse: ['instance']) translated, ', '. aStream nextPutAll: 'named' translated. aPair first allInstancesDo: [:inst | aStream space; nextPutAll: inst externalName]. aStream cr]. aStream cr. aList do: [:aPair | aStream cr. aStream nextPutAll: '--------------------------------------------------------------------------------------------'. aStream cr; nextPutAll: aPair first typicalInstanceName. aStream nextPutAll: '''s' translated. aStream nextPutAll: ' scripts:' translated. aPair first addDocumentationForScriptsTo: aStream]]. (StringHolder new contents: aString) openLabel: 'All scripts in this project' translated "self currentWorld presenter reportPlayersAndScripts"! ! !TheWorldMenu methodsFor: '*flexibleVocabularies-construction' stamp: 'sw 6/16/2008 19:06'! fullScriptingMenu "Build the authoring-tools menu for the world. This method offeres all the item historically offered in the full etoy system; when eToyFriendly is on, most of the items are suppressed." ^ self fillIn: (self menu: 'authoring tools...' translatedNoop) from: { { 'objects (o)' translated. { #myWorld . #activateObjectsTool }. 'A searchable source of new objects.' translated}. nil. "----------" { 'view trash contents' translated. { #myWorld . #openScrapsBook:}. 'The place where all your trashed morphs go.' translated}. { 'empty trash can' translated. { Utilities . #emptyScrapsBookGC}. 'Empty out all the morphs that have accumulated in the trash can.' translated}. nil. "----------" { 'sound library' translated. { SoundLibraryTool. #newInHand}.'A tool that lets you see and manage all the sounds in the sound library' translated}. { 'new scripting area' translated. { #myWorld . #detachableScriptingSpace}. 'A window set up for simple scripting.' translated}. nil. "----------" { 'status of scripts' translated. {#myWorld . #showStatusOfAllScripts}. 'Lets you view the status of all the scripts belonging to all the scripted objects of the project.' translated}. { 'summary of scripts' translated. {#myWorld . #printScriptSummary}. 'Produces a summary of scripted objects in the project, and all of their scripts.' translated}. { 'browser for scripts' translated. {#myWorld . #browseAllScriptsTextually}. 'Allows you to view all the scripts in the project in a traditional programmers'' "browser" format' translated}. nil. { 'gallery of players' translated. {#myWorld . #galleryOfPlayers}. 'A tool that lets you find out about all the players used in this project' translated}. " { 'gallery of scripts' translated. {#myWorld . #galleryOfScripts}. 'Allows you to view all the scripts in the project' translated}." { 'etoy vocabulary summary' translated. {#myWorld . #printVocabularySummary }. 'Displays a summary of all the pre-defined commands and properties in the pre-defined EToy vocabulary.' translated}. { 'attempt misc repairs' translated. {#myWorld . #attemptCleanup}. 'Take measures that may help fix up some things about a faulty or problematical project.' translated}. { 'remove all viewers' translated. {#myWorld . #removeAllViewers}. 'Remove all the Viewers from this project.' translated}. { 'abandon unsituated players' translated. {#myWorld. #abandonUnsituatedPlayers}. 'If any objects in the project have references, in player-valued variables, to other objects otherwise not present in the project, abandon them and replace former references to them by references to Dot'}. { 'refer to masters' translated. {#myWorld . #makeAllScriptEditorsReferToMasters }. 'Ensure that all script editors are referring to the first (alphabetically by external name) Player of their type' translated}. nil. "----------" { 'unlock locked objects' translated. { #myWorld . #unlockContents}. 'If any items on the world desktop are currently locked, unlock them.' translated}. { 'unhide hidden objects' translated. { #myWorld . #showHiders}. 'If any items on the world desktop are currently hidden, make them visible.' translated}. }! !