[squeak-dev] ActiveWorld and World globals

Bob Arning arning315 at comcast.net
Thu Nov 16 01:40:28 UTC 2017


I did encounter an emergency evaluator after posting the first code. My 
fix for that one is attached.


On 11/15/17 8:29 PM, David T. Lewis wrote:
> Bob's changes are in the inbox as System-dtl.977 and Morphic-dtl.1365.
>
> Try the ENTER ACTIVE menu selection in a project view morph to test.
>
> It is quite easy to find your way to an emergency evaluator, so I put
> in into inbox rather than trunk for the time being.
>
> Dave
>
>
> On Wed, Nov 15, 2017 at 03:39:49PM +0100, H. Hirzel wrote:
>> 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.
>>>
>>>
>>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20171115/9f28b0f6/attachment.html>
-------------- next part --------------
'From Squeak5.1 of 23 August 2016 [latest update: #16548] on 15 November 2017 at 8:39 pm'!

!WorldState methodsFor: 'update cycle' stamp: 'raa 11/14/2017 11:21'!
displayWorld: aWorld submorphs: submorphs
	"Update this world's display."

	| deferredUpdateMode handsToDraw allDamage handDamageRects worldDamageRects |

	submorphs do: [:m | m fullBounds].  "force re-layout if needed"
	self checkIfUpdateNeeded ifFalse: [^ self].  "display is already up-to-date"

	deferredUpdateMode := self doDeferredUpdatingFor: aWorld.
	deferredUpdateMode ifFalse: [self assuredCanvas].

	worldDamageRects := self drawWorld: aWorld submorphs: submorphs invalidAreasOn: self assuredCanvas.  "repair world's damage on canvas"
	"self handsDo:[:h| h noticeDamageRects: worldDamageRects]."
	handsToDraw := self selectHandsToDrawForDamage: worldDamageRects.
	handDamageRects := handsToDraw collect: [:h | h savePatchFrom: canvas].
	allDamage := worldDamageRects, handDamageRects.

	handsToDraw reverseDo: [:h | canvas fullDrawMorph: h].  "draw hands onto world canvas"

	"*make this true to flash damaged areas for testing*"
	Preferences debugShowDamage ifTrue: [aWorld flashRects: allDamage color: Color black].

	canvas finish: allDamage.

	"quickly copy altered rects of canvas to Display:"
	deferredUpdateMode
		ifTrue: [self forceDamageToScreen: allDamage]
		ifFalse: [canvas showAt: aWorld viewBox origin invalidRects: allDamage].
	handsToDraw do: [:h | h restoreSavedPatchOn: canvas].  "restore world canvas under hands"
	Display deferUpdates: false; forceDisplayUpdate.
! !


More information about the Squeak-dev mailing list