The Trunk: Morphic-dtl.366.mcz

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

The Trunk: Morphic-dtl.366.mcz

commits-2
David T. Lewis uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-dtl.366.mcz

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

Name: Morphic-dtl.366
Author: dtl
Time: 27 February 2010, 11:49:57.312 am
UUID: a1f4b02f-798f-46da-b8df-4a4167f1df36
Ancestors: Morphic-ar.365

Implement #resetDisplay, #setAsBackground: and #handledFatalDrawingError: to reduce use of #isMorphic.
Use Project>>handleFatalDrawingError: in PasteUpMorph and WorldState.

=============== Diff against Morphic-ar.365 ===============

Item was changed:
  ----- Method: WorldState>>handleFatalDrawingError: (in category 'update cycle') -----
  handleFatalDrawingError: errMsg
  "Handle a fatal drawing error."
+ self flag: #toRemove. "Implementation moved to Project, but are there external packages with senders?"
+ Project current handleFatalDrawingError: errMsg
+ !
- Smalltalk isMorphic ifFalse:[^self error: errMsg]. "Can still handle it from MVC"
- Display deferUpdates: false. "Just in case"
- self primitiveError: errMsg.
-
- "Hm... we should jump into a 'safe' worldState here, but how do we find it?!!"!

Item was changed:
  ----- Method: WorldState>>displayWorldSafely: (in category 'update cycle') -----
  displayWorldSafely: aWorld
  "Update this world's display and keep track of errors during draw methods."
 
  [aWorld displayWorld] ifError: [:err :rcvr |
  "Handle a drawing error"
  | errCtx errMorph |
  errCtx := thisContext.
  [
  errCtx := errCtx sender.
  "Search the sender chain to find the morph causing the problem"
  [errCtx notNil and:[(errCtx receiver isMorph) not]]
  whileTrue:[errCtx := errCtx sender].
  "If we're at the root of the context chain then we have a fatal drawing problem"
+ errCtx ifNil:[^Project current handleFatalDrawingError: err].
- errCtx ifNil:[^self handleFatalDrawingError: err].
  errMorph := errCtx receiver.
  "If the morph causing the problem has already the #drawError flag set,
  then search for the next morph above in the caller chain."
  errMorph hasProperty: #errorOnDraw
  ] whileTrue.
  errMorph setProperty: #errorOnDraw toValue: true.
  "Install the old error handler, so we can re-raise the error"
  rcvr error: err.
  ].!

Item was added:
+ ----- Method: MorphicProject>>setAsBackground: (in category 'utilities') -----
+ setAsBackground: aForm
+ "Set  aForm as a background image."
+
+ | world newColor |
+ world := self currentWorld.
+ newColor := InfiniteForm with: aForm.
+ aForm rememberCommand:
+ (Command new cmdWording: 'set background to a picture' translated;
+ undoTarget: world selector: #color: argument: world color;
+ redoTarget: world selector: #color: argument: newColor).
+ world color: newColor
+ !

Item was added:
+ ----- Method: MorphicProject>>resetDisplay (in category 'display') -----
+ resetDisplay
+ "Bring the display to a usable state after handling primitiveError."
+
+ World install "init hands and redisplay"!

Item was changed:
  ----- Method: PasteUpMorph>>handleFatalDrawingError: (in category 'world state') -----
  handleFatalDrawingError: errMsg
  "Handle a fatal drawing error."
+ self flag: #toRemove. "Implementation moved to Project, but are there external packages with senders?"
+ Project current handleFatalDrawingError: errMsg
+ !
- Smalltalk isMorphic ifFalse:[^self error: errMsg]. "Can still handle it from MVC"
- Display deferUpdates: false. "Just in case"
- self primitiveError: errMsg.
-
- "Hm... we should jump into a 'safe' worldState here, but how do we find it?!!"!

Item was added:
+ ----- Method: MorphicProject>>handleFatalDrawingError: (in category 'utilities') -----
+ handleFatalDrawingError: errMsg
+ "Handle a fatal drawing error."
+
+ Display deferUpdates: false. "Just in case"
+ self primitiveError: errMsg
+
+ "Hm... we should jump into a 'safe' worldState here, but how do we find it?!!"!