David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.1373.mcz ==================== Summary ==================== Name: Morphic-dtl.1373 Author: dtl Time: 22 November 2017, 10:25:57.941315 am UUID: 2e41d807-bf5a-4f90-84aa-d0ac472bb023 Ancestors: Morphic-dtl.1372 Reorganize Morph>>delete for clarity, and remove reference to global World. MorphicProject>>finalExitActions and finalEnterActions remove explicit references to global World and allow World be be removed for testing purposes. =============== Diff against Morphic-dtl.1372 =============== Item was changed: ----- Method: Morph>>delete (in category 'submorphs-add/remove') ----- delete "Remove the receiver as a submorph of its owner and make its new owner be nil." + | oldWorld | - - | aWorld | self removeHalo. + (oldWorld := self world) ifNotNil: [ - - self isInWorld ifTrue: [ self disableSubmorphFocusForHand: self activeHand. self activeHand releaseKeyboardFocus: self; releaseMouseFocus: self]. + owner ifNotNil: [ + self privateDelete. "remove from world" - - "Preserve world reference for player notificaiton. See below." - aWorld := self world ifNil: [World]. - - owner ifNotNil:[ - self privateDelete. self player ifNotNil: [:player | + oldWorld ifNotNil: [ + player noteDeletionOf: self fromWorld: oldWorld]]].! - player noteDeletionOf: self fromWorld: aWorld]].! Item was added: + ----- Method: MorphicProject>>clearGlobalState (in category 'enter') ----- + clearGlobalState + "Clean up global state. The global variables World, ActiveWorld, ActiveHand + and ActiveEvent provide convenient access to the state of the active project + in Morphic. Clear their prior values when leaving an active project. This + method may be removed if the use of global state variables is eliminated." + + "If global World is defined, clear it now. The value is expected to be set + again as a new project is entered." + Smalltalk globals at: #World + ifPresent: [ :w | Smalltalk globals at: #World put: nil ]. + ActiveWorld := ActiveHand := ActiveEvent := nil. + ! Item was changed: ----- Method: MorphicProject>>finalEnterActions: (in category 'enter') ----- finalEnterActions: leavingProject "Perform the final actions necessary as the receiver project is entered" | navigator armsLengthCmd navType thingsToUnhibernate | + "If this image has a global World variable, update it now" + Smalltalk globals at: #World + ifPresent: [ :w | Smalltalk globals at: #World put: world ]. - World := world. "Signifies Morphic" world install. world transferRemoteServerFrom: leavingProject world. "(revertFlag | saveForRevert | forceRevert) ifFalse: [ (Preferences valueOfFlag: #projectsSentToDisk) ifTrue: [ self storeSomeSegment]]." "Transfer event recorder to me." leavingProject isMorphic ifTrue: [ leavingProject world pauseEventRecorder ifNotNil: [:rec | rec resumeIn: world]]. world triggerOpeningScripts. self initializeMenus. self projectParameters at: #projectsToBeDeleted ifPresent: [ :projectsToBeDeleted | self removeParameter: #projectsToBeDeleted. projectsToBeDeleted do: [:each | each delete]]. Locale switchAndInstallFontToID: self localeID. thingsToUnhibernate := world valueOfProperty: #thingsToUnhibernate ifAbsent: [#()]. thingsToUnhibernate do: [:each | each unhibernate]. world removeProperty: #thingsToUnhibernate. navType := ProjectNavigationMorph preferredNavigator. armsLengthCmd := self parameterAt: #armsLengthCmd ifAbsent: [nil]. navigator := world findA: navType. (Preferences classicNavigatorEnabled and: [Preferences showProjectNavigator and: [navigator isNil]]) ifTrue: [(navigator := navType new) bottomLeft: world bottomLeft; openInWorld: world]. navigator notNil & armsLengthCmd notNil ifTrue: [navigator color: Color lightBlue]. armsLengthCmd notNil ifTrue: [Preferences showFlapsWhenPublishing ifFalse: [self flapsSuppressed: true. navigator ifNotNil: [navigator visible: false]]. armsLengthCmd openInWorld: world]. world reformulateUpdatingMenus. world presenter positionStandardPlayer. self assureMainDockingBarPresenceMatchesPreference. world repairEmbeddedWorlds.! Item was changed: ----- Method: MorphicProject>>finalExitActions: (in category 'enter') ----- finalExitActions: enteringProject world triggerClosingScripts. "Pause sound players, subject to preference settings" (world hasProperty: #letTheMusicPlay) ifTrue: [world removeProperty: #letTheMusicPlay] ifFalse: [SoundService stop]. world sleep. - (world findA: ProjectNavigationMorph) ifNotNil: [:navigator | navigator retractIfAppropriate]. + self clearGlobalState. - - "Clean-up global state." - World := nil. - ActiveWorld := ActiveHand := ActiveEvent := nil. Sensor flushAllButDandDEvents. ! |
Free forum by Nabble | Edit this page |