Use case: 'New MorphicProject'
Last updated at 10:25 pm UTC on 4 December 2021
USE CASE: How is a new Morphic project constructed.
The activities which happen when you choose the menu 'Projects' -> 'New Project' -> 'New MorphicProject' (5.2) or 'Projects' -> 'New MorphicProject' (5.3).
To find out about the method which is activated when the user chooses 'New MorphicProject',
open a workspace and type
Then select the text and from the menu choose 'method source with it'.
You get the following information
Double click on 'newProject' (=the symbol right of 'selector') and hit CTRL-M.
The result is
That means a new MorphicProject is constructed with something similar to the following code
| newProject |
newProject := MorphicProject new.
ProjectViewMorph openOn: newProject.
And this means that an object 'newProject' may be inspected and changed before the call of
thus allowing us to find out about the details of the use case steps.
is executed a default action is to call the #initialize method
Within 'MorphicProject initialize' a world morph is created
world := PasteUpMorph newWorldForProject: self.
Then still in 'MorphicProject initialize' we find
self setWorldBackground: true.
The details of setting the background are
((world hasProperty: #hasCustomBackground) and: [force not])
ifTrue: [^ self].
"If the user has a custom background, propagate it into the new project."
((Project current ~~ self and: [Project current isMorphic]) and: [Project current world hasProperty: #hasCustomBackground])
world fillStyle: Project current world fillStyle.
world setProperty: #hasCustomBackground toValue: true]
world removeProperty: #hasCustomBackground.
world fillStyle: (self userInterfaceTheme background ifNil: [self class defaultFill])].
Still within 'MorphicProject initialize'
Locale switchToID: CurrentProject localeID.