[squeak-dev] MorphicProject subclass: #EtoysProject

David T. Lewis lewis at mail.msen.com
Mon Oct 2 00:26:26 UTC 2017


An EtoysProject is a project that is configured for running Etoys. On
first entry to a new EtoysProject, the playground and project preferences
are initialized to provide an environment similar to that of a traditional
standalone Etoys image.

Certain preferences that are required for Etoys are initialized on project
entry, overriding their global preference values while this EtoysProject
is active. On leaving the project, these preferences are restored to their
previous values.

	"ProjectViewMorph openOn: EtoysProject new"

Change set attached for a minimal implementation.

Anyone with Etoys knowledge care to help? I do not know enough about Etoys
to fill in the rest of the initialization that will be required, but it
should not be hard to do.

Dave

-------------- next part --------------
'From Squeak6.0alpha of 30 September 2017 [latest update: #17406] on 1 October 2017 at 8:12:48 pm'!
"Change Set:		EtoysProject-dtl
Date:			1 October 2017
Author:			David T. Lewis

An EtoysProject is a project that is configured for running Etoys. On first entry to a new EtoysProject, the playground and project preferences are initialized to provide an environment similar to that of a traditional standalone Etoys image.

Certain preferences that are required for Etoys are initialized on project entry, overriding their global preference valuse while this EtoysProject is active. On leaving the project, these preferences are restored to their previous values.

	ProjectViewMorph openOn: EtoysProject new
"!

MorphicProject subclass: #EtoysProject
	instanceVariableNames: 'configured preferenceUndoList'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Project-Etoys'!

!EtoysProject commentStamp: 'dtl 10/1/2017 20:01' prior: 0!
An EtoysProject is a project that is configured for running Etoys. On first entry to a new EtoysProject, the playground and project preferences are initialized to provide an environment similar to that of a traditional standalone Etoys image.

Certain preferences that are required for Etoys are initialized on project entry, overriding their global preference values while this EtoysProject is active. On leaving the project, these preferences are restored to their previous values.

	"ProjectViewMorph openOn: EtoysProject new"
!


!EtoysProject methodsFor: 'enter' stamp: 'dtl 10/1/2017 20:07'!
finalEnterActions: leavingProject
	"Perform the final actions necessary as the receiver project is entered"

	super finalEnterActions: leavingProject.
	self saveGlobalPreferences.
	configured == true ifFalse: [
		self configureOnFirstEntry.
		configured := true ]
! !

!EtoysProject methodsFor: 'enter' stamp: 'dtl 10/1/2017 20:03'!
finalExitActions: enteringProject

	self restoreGlobalPreferences.
	super finalExitActions: enteringProject.
! !

!EtoysProject methodsFor: 'enter' stamp: 'dtl 10/1/2017 20:05'!
restoreGlobalPreferences
	"Perferences that are mandatory for Etoys may have been set during entry
	to this EtoysProject. Restore their values prior to leaving."

	preferenceUndoList do: [ :e | e value ].
	preferenceUndoList := nil.
! !

!EtoysProject methodsFor: 'enter' stamp: 'dtl 10/1/2017 20:08'!
saveGlobalPreferences
	"Perferences that are mandatory for Etoys must be enabled, regardless of any
	global preference settings that would apply to all other projects."

	preferenceUndoList := OrderedCollection new.
	SugarNavigatorBar showSugarNavigator
		ifFalse: [ preferenceUndoList add: [SugarNavigatorBar showSugarNavigator: false ] ].
	SugarNavigatorBar showSugarNavigator: true.
! !

!EtoysProject methodsFor: 'project parameters' stamp: 'dtl 10/1/2017 18:17'!
initializeProjectPreferences
	"Initialize the project's preferences from currently-prevailing preferences that are currently being held in projects in this system"

	super initializeProjectPreferences.

	self flag: #TODO. "Add Etoys preferences as needed"! !

!EtoysProject methodsFor: 'initialize' stamp: 'dtl 10/1/2017 18:41'!
configureOnFirstEntry
	"Set up initial preferences and playground"

	self flag: #TODO. "Add objects to the playground"

! !



More information about the Squeak-dev mailing list