[squeak-dev] ActiveWorld and World globals

H. Hirzel hannes.hirzel at gmail.com
Wed Nov 15 14:39:49 UTC 2017


Bob's changes involve 4 methods

PasteUpMorph>>installAsActiveSubprojectIn: enclosingWorld at:
newBounds titled: aString
PasteUpMorph>>installAsActiveSubprojectIn: enclosingWorld titled: aString
Project>>enterAsActiveSubprojectWithin: enclosingWorld
ProjectViewMorph>>enterAsActiveSubproject


BTW this involves the mysterious 'AlignmentMorphBob1'.....

Hannes



Here is the code (unpacked fixProjectView.14Nov0811.cs.gz) to make it
easier for people to have a look at it.



'From Squeak5.1 of 23 August 2016 [latest update: #16548] on 14
November 2017 at 8:11:28 am'!
"Change Set:		fixProjectView
Date:			14 November 2017
Author:			Bob Arning

squeak 5.1...

reinstate 'ENTER ACTIVE' option in menu for ProjectViewMorph "!


!PasteUpMorph methodsFor: 'WiW support' stamp: 'raa 11/14/2017 07:47'!
installAsActiveSubprojectIn: enclosingWorld at: newBounds titled: aString
    | window howToOpen tm boundsForWorld |
    howToOpen := self embeddedProjectDisplayMode.
    "#scaled may be the only one that works at the moment"
    submorphs do: [:ss | ss owner isNil ifTrue: [ss privateOwner: self]].
    "Transcript that was in outPointers and then got deleted."
    boundsForWorld := howToOpen == #naked ifTrue: [newBounds] ifFalse: [bounds].
    worldState canvas: nil.
    worldState viewBox: boundsForWorld.
    self bounds: boundsForWorld.

    "self viewBox: Display boundingBox."
    "worldState handsDo: [:h | h initForEvents]."
    self installFlaps.

    "SystemWindow noteTopWindowIn: self."
    "self displayWorldSafely."
    howToOpen == #naked ifTrue: [enclosingWorld addMorphFront: self].
    howToOpen == #window
        ifTrue:
            [window := (SystemWindow labelled: aString) model: self.
            window addMorph: self frame: (0 @ 0 extent: 1.0 @ 1.0).
            window openInWorld: enclosingWorld].
    howToOpen == #frame
        ifTrue:
            [window := (AlignmentMorphBob1 new)
                        minWidth: 100;
                        minHeight: 100;
                        borderWidth: 8;
                        borderColor: Color green;
                        bounds: newBounds.
            window addMorph: self.
            window openInWorld: enclosingWorld].
    howToOpen == #scaled
        ifTrue:
            [self position: 0 @ 0.
            window := (EmbeddedWorldBorderMorph new)
                        minWidth: 100;
                        minHeight: 100;
                        borderWidth: 8;
                        borderColor: Color green;
                        bounds: newBounds.
            tm := BOBTransformationMorph new.
            window addMorph: tm.
            tm addMorph: self.
            window openInWorld: enclosingWorld.
            tm changeWorldBoundsToShow: bounds.
            self arrangeToStartSteppingIn: enclosingWorld
            "tm scale: (tm width / self width min: tm height / self
height) asFloat."]! !

!PasteUpMorph methodsFor: 'WiW support' stamp: 'raa 11/14/2017 07:47'!
installAsActiveSubprojectIn: enclosingWorld titled: aString

    | opt newWidth |

    opt := self optimumExtentFromAuthor.
    (opt x > (enclosingWorld width * 0.7) or:
            [opt y > (enclosingWorld height * 0.7)]) ifTrue: [
        newWidth := enclosingWorld width // 2.
        opt := newWidth @ (opt y * newWidth / opt x) truncated
    ].
    ^self
        installAsActiveSubprojectIn: enclosingWorld
        at: (enclosingWorld topLeft + (enclosingWorld extent - opt //
2) extent: opt)
        titled: aString! !


!Project methodsFor: 'enter' stamp: 'raa 11/14/2017 06:45'!
enterAsActiveSubprojectWithin: enclosingWorld

    "Install my ChangeSet, Transcript, and scheduled views as current globals.

    If returningFlag is true, we will return to the project from
whence the current project was entered; don't change its
previousProject link in this case.
    If saveForRevert is true, save the ImageSegment of the project being left.
    If revertFlag is true, make stubs for the world of the project being left.
    If revertWithoutAsking is true in the project being left, then
always revert."

    "Experimental mods for initial multi-project work:
        1. assume in morphic (this eliminated need for <showZoom>)
        2. assume <saveForRevert> is false (usual case) - removed <old>
        3. assume <revertFlag> is false
        4. assume <revertWithoutAsking> is false - <forceRevert> now
auto false <seg> n.u.
        5. no zooming
        6. assume <projectsSentToDisk> false - could be dangerous here
        7. assume no isolation problems (isolationHead ==)
        8. no closing scripts
    "

    self isCurrentProject ifTrue: [^ self].

    "guards ifNotNil: [
        guards := guards reject: [:obj | obj isNil].
        guards do: [:obj | obj okayToEnterProject ifFalse: [^ self]]
    ]."

        "CurrentProject makeThumbnail."
        "--> Display bestGuessOfCurrentWorld triggerClosingScripts."
    CurrentProject displayDepth: Display depth.

    displayDepth == nil ifTrue: [displayDepth := Display depth].
        "Display newDepthNoRestore: displayDepth."

        "(world hasProperty: #letTheMusicPlay)
            ifTrue: [world removeProperty: #letTheMusicPlay]
            ifFalse: [Smalltalk at: #ScorePlayer ifPresent: [:playerClass |
                        playerClass allSubInstancesDo: [:player |
player pause]]]."

        "returningFlag
            ifTrue: [nextProject := CurrentProject]
            ifFalse: [previousProject := CurrentProject]."

        "CurrentProject saveState."
        "CurrentProject := self."
        "Smalltalk newChanges: changeSet."
        "TranscriptStream newTranscript: transcript."
        "Sensor flushKeyboard."
        "recorderOrNil := Display pauseMorphicEventRecorder."

        "Display changeMorphicWorldTo: world."  "Signifies Morphic"
    world
        installAsActiveSubprojectIn: enclosingWorld
        titled: self name.

        "recorderOrNil ifNotNil: [recorderOrNil resumeIn: world]."
    world triggerOpeningScripts.
    self removeParameter: #exportState.
        "self spawnNewProcessAndTerminateOld: true"! !


!ProjectViewMorph methodsFor: 'events' stamp: 'raa 11/14/2017 06:46'!
enterAsActiveSubproject
    "Enter my project."

    project class == DiskProxy
        ifTrue:
            ["When target is not in yet"

            [self enterWhenNotPresent    "will bring it in"] on:
ProjectEntryNotification
                do: [:ex | ^ex projectToEnter
enterAsActiveSubprojectWithin: self world].
            project class == DiskProxy ifTrue: [self error: 'Could not
find view']].
    (owner isSystemWindow) ifTrue: [project setViewSize: self extent].
    self showMouseState: 3.
    project enterAsActiveSubprojectWithin: self world! !

!ProjectViewMorph methodsFor: 'events' stamp: 'raa 11/14/2017 06:43'!
showMenuForProjectView
	| menu |
	(menu := MenuMorph new)
		add: 'enter this project' translated
		action: [^ self enter];

 		add: 'ENTER ACTIVE' translated
		action: [self setProperty: #wasOpenedAsSubproject toValue: true.
            ^ self enterAsActiveSubproject];
		
		add: 'PUBLISH (also saves a local copy)' translated
		action: [^ project storeOnServerShowProgressOn: self forgetURL: false];
		
		add: 'PUBLISH to a different server' translated
		action: [project forgetExistingURL.
			^ project storeOnServerShowProgressOn: self forgetURL: true];
		
		add: 'see if server version is more recent' translated
		action: [^ self checkForNewerVersionAndLoad];

		addLine;
		add: 'expunge this project' translated
		action: [^ self expungeProject].

	menu title: ('Project Named \"{1}"' translated withCRs format: {project name}).
	menu invokeModal.! !

Project removeSelector: #installAsActiveSubprojectIn:titled:!

On 11/15/17, David T. Lewis <lewis at mail.msen.com> wrote:
> I hope someone can take a look at Bob's change set. I'm going to be away for
> a day or two and I'm out of time for playing with Squeak, but this is
> certainly
> on my personal to-do list when I get back :-)
>
> Dave
>
>
> On Tue, Nov 14, 2017 at 08:14:07AM -0500, Bob Arning wrote:
>> Here is a start (squeak 5.1). Not extensively tested, but a FileList in
>> a world in the World was operational.
>>
>>
>> On 11/14/17 5:13 AM, H. Hirzel wrote:
>> >And it would be good to get "worlds in worlds" working again.
>
>
>
>


More information about the Squeak-dev mailing list