The Inbox: EToys-dtl.316.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: EToys-dtl.316.mcz

commits-2
David T. Lewis uploaded a new version of EToys to project The Inbox:
http://source.squeak.org/inbox/EToys-dtl.316.mcz

==================== Summary ====================

Name: EToys-dtl.316
Author: dtl
Time: 30 November 2017, 8:01:53.317128 pm
UUID: 1f54a00d-e84f-4edc-be26-c47b4c341103
Ancestors: EToys-dtl.315

Remove references to global World from WiWPasteUpMorph. In places where the World is assigned, instead call MorphicProject>>setWorld: which will set the world for Project current, and also set the global World if present in the image. This is expected to be consistent with current Squeak behavior, for which the value of World is Project current world.

This requires testing (not done) to verify if this behavior is consistent with the original design intent of WiWPasteUpMorph.

In the common case of transitioning from one project to another, the global World is set as the new project becomes current (and active). This update is a best effort to achieve similar behavior for becomeTheActiveWorldWith: and revertToPartentWorldWithEvent: in WiWPasteUpMorph.

=============== Diff against EToys-dtl.315 ===============

Item was changed:
  ----- Method: WiWPasteUpMorph>>becomeTheActiveWorldWith: (in category 'activation') -----
  becomeTheActiveWorldWith: evt
  "Make the receiver become the active world, and give its hand the event provided, if not nil"
 
  | outerWorld |
+ Project current world == self ifTrue: [^ self].
- World == self ifTrue: [^ self].
  worldState resetDamageRecorder. "since we may have moved, old data no longer valid"
  hostWindow setStripeColorsFrom: Color green.
  worldState canvas: nil. "safer to start from scratch"
  displayChangeSignatureOnEntry := Display displayChangeSignature.
 
  "Messy stuff to clear flaps from outer world"
  Flaps globalFlapTabsIfAny do: [:f | f changed].
+ outerWorld := Project current world.
+ Project current setWorld: self.
- outerWorld := World.
- World := self.
  self installFlaps.
+ Project current setWorld: outerWorld.
- World := outerWorld.
  outerWorld displayWorld.
+ Project current setWorld: self.
- World := self.
 
  self viewBox: hostWindow panelRect.
  self startSteppingSubmorphsOf: self.
  self changed.
  pendingEvent := nil.
  evt ifNotNil: [self primaryHand handleEvent: (evt setHand: self primaryHand)].
 
  !

Item was changed:
  ----- Method: WiWPasteUpMorph>>displayWorld (in category 'world state') -----
  displayWorld
 
  "RAA 27 Nov 99 - if we are not active, then the parent should do the drawing"
 
  self flag: #bob. "probably not needed"
 
+ Project current world == self ifTrue: [^super displayWorld].
- World == self ifTrue: [^super displayWorld].
  parentWorld ifNotNil: [^parentWorld displayWorld].
  ^super displayWorld "in case MVC needs it"!

Item was changed:
  ----- Method: WiWPasteUpMorph>>initialize (in category 'initialization') -----
  initialize
 
  super initialize.
+ parentWorld := Project current world.
- parentWorld := World.
  !

Item was changed:
  ----- Method: WiWPasteUpMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: evt
 
+ | world |
+ world := Project current world.
+ (world == self or: [world isNil]) ifTrue: [^ super mouseDown: evt].
- (World == self or: [World isNil]) ifTrue: [^ super mouseDown: evt].
  (self bounds containsPoint: evt cursorPoint) ifFalse: [^ self].
 
  self becomeTheActiveWorldWith: evt.
  !

Item was changed:
  ----- Method: WiWPasteUpMorph>>restoreDisplay (in category 'world state') -----
  restoreDisplay
 
+ Project current world ifNotNil: [ :w | w restoreMorphicDisplay].
+ "Comment from original method ar 3/18/2001: I don't actually expect this to be called"!
- World ifNotNil:[World restoreMorphicDisplay]. "I don't actually expect this to be called"!

Item was changed:
  ----- Method: WiWPasteUpMorph>>revertToParentWorldWithEvent: (in category 'activation') -----
  revertToParentWorldWithEvent: evt
 
  "RAA 27 Nov 99 - if the display changed while we were in charge, parent may need to redraw"
 
  worldState resetDamageRecorder. "Terminate local display"
+ Project current setWorld: parentWorld.
+ parentWorld assuredCanvas.
+ parentWorld installFlaps.
- World := parentWorld.
- World assuredCanvas.
- World installFlaps.
  hostWindow setStripeColorsFrom: Color red.
  (displayChangeSignatureOnEntry = Display displayChangeSignature) ifFalse: [
+ parentWorld fullRepaintNeeded; displayWorld
- World fullRepaintNeeded; displayWorld
  ].
+ evt ifNotNil: [parentWorld restartWorldCycleWithEvent: evt].
- evt ifNotNil: [World restartWorldCycleWithEvent: evt].
 
  !


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: EToys-dtl.316.mcz

David T. Lewis
If this update passes muster, it means that we have completely removed all
dependencies on the global variable World in trunk:

    Smalltalk garbageCollect.
    (CompiledMethod allInstances
           select: [:cm | (cm literals select: [:lit | #World = lit name]) size > 0]).
    ==> #()

It is now possible to do this, after which all project navigation will
continue to work as before:

    Smalltalk removeKey: #World.
    Compiler recompileAll.

After doing the above, put things back to normal with:

    Smalltalk at: #World put: Project current world.

Dave



On Fri, Dec 01, 2017 at 01:02:05AM +0000, [hidden email] wrote:

> David T. Lewis uploaded a new version of EToys to project The Inbox:
> http://source.squeak.org/inbox/EToys-dtl.316.mcz
>
> ==================== Summary ====================
>
> Name: EToys-dtl.316
> Author: dtl
> Time: 30 November 2017, 8:01:53.317128 pm
> UUID: 1f54a00d-e84f-4edc-be26-c47b4c341103
> Ancestors: EToys-dtl.315
>
> Remove references to global World from WiWPasteUpMorph. In places where the World is assigned, instead call MorphicProject>>setWorld: which will set the world for Project current, and also set the global World if present in the image. This is expected to be consistent with current Squeak behavior, for which the value of World is Project current world.
>
> This requires testing (not done) to verify if this behavior is consistent with the original design intent of WiWPasteUpMorph.
>
> In the common case of transitioning from one project to another, the global World is set as the new project becomes current (and active). This update is a best effort to achieve similar behavior for becomeTheActiveWorldWith: and revertToPartentWorldWithEvent: in WiWPasteUpMorph.
>
> =============== Diff against EToys-dtl.315 ===============
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>becomeTheActiveWorldWith: (in category 'activation') -----
>   becomeTheActiveWorldWith: evt
>   "Make the receiver become the active world, and give its hand the event provided, if not nil"
>  
>   | outerWorld |
> + Project current world == self ifTrue: [^ self].
> - World == self ifTrue: [^ self].
>   worldState resetDamageRecorder. "since we may have moved, old data no longer valid"
>   hostWindow setStripeColorsFrom: Color green.
>   worldState canvas: nil. "safer to start from scratch"
>   displayChangeSignatureOnEntry := Display displayChangeSignature.
>  
>   "Messy stuff to clear flaps from outer world"
>   Flaps globalFlapTabsIfAny do: [:f | f changed].
> + outerWorld := Project current world.
> + Project current setWorld: self.
> - outerWorld := World.
> - World := self.
>   self installFlaps.
> + Project current setWorld: outerWorld.
> - World := outerWorld.
>   outerWorld displayWorld.
> + Project current setWorld: self.
> - World := self.
>  
>   self viewBox: hostWindow panelRect.
>   self startSteppingSubmorphsOf: self.
>   self changed.
>   pendingEvent := nil.
>   evt ifNotNil: [self primaryHand handleEvent: (evt setHand: self primaryHand)].
>  
>   !
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>displayWorld (in category 'world state') -----
>   displayWorld
>  
>   "RAA 27 Nov 99 - if we are not active, then the parent should do the drawing"
>  
>   self flag: #bob. "probably not needed"
>  
> + Project current world == self ifTrue: [^super displayWorld].
> - World == self ifTrue: [^super displayWorld].
>   parentWorld ifNotNil: [^parentWorld displayWorld].
>   ^super displayWorld "in case MVC needs it"!
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>initialize (in category 'initialization') -----
>   initialize
>  
>   super initialize.
> + parentWorld := Project current world.
> - parentWorld := World.
>   !
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>mouseDown: (in category 'event handling') -----
>   mouseDown: evt
>  
> + | world |
> + world := Project current world.
> + (world == self or: [world isNil]) ifTrue: [^ super mouseDown: evt].
> - (World == self or: [World isNil]) ifTrue: [^ super mouseDown: evt].
>   (self bounds containsPoint: evt cursorPoint) ifFalse: [^ self].
>  
>   self becomeTheActiveWorldWith: evt.
>   !
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>restoreDisplay (in category 'world state') -----
>   restoreDisplay
>  
> + Project current world ifNotNil: [ :w | w restoreMorphicDisplay].
> + "Comment from original method ar 3/18/2001: I don't actually expect this to be called"!
> - World ifNotNil:[World restoreMorphicDisplay]. "I don't actually expect this to be called"!
>
> Item was changed:
>   ----- Method: WiWPasteUpMorph>>revertToParentWorldWithEvent: (in category 'activation') -----
>   revertToParentWorldWithEvent: evt
>  
>   "RAA 27 Nov 99 - if the display changed while we were in charge, parent may need to redraw"
>  
>   worldState resetDamageRecorder. "Terminate local display"
> + Project current setWorld: parentWorld.
> + parentWorld assuredCanvas.
> + parentWorld installFlaps.
> - World := parentWorld.
> - World assuredCanvas.
> - World installFlaps.
>   hostWindow setStripeColorsFrom: Color red.
>   (displayChangeSignatureOnEntry = Display displayChangeSignature) ifFalse: [
> + parentWorld fullRepaintNeeded; displayWorld
> - World fullRepaintNeeded; displayWorld
>   ].
> + evt ifNotNil: [parentWorld restartWorldCycleWithEvent: evt].
> - evt ifNotNil: [World restartWorldCycleWithEvent: evt].
>  
>   !
>
>