The Trunk: Morphic-mt.1236.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-mt.1236.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1236.mcz

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

Name: Morphic-mt.1236
Author: mt
Time: 5 August 2016, 11:08:10.113358 am
UUID: 04c11a0e-41ce-6947-85fb-dc2f7d340ff0
Ancestors: Morphic-mt.1235

Due to popular request, make the background for Morphic projects also part of the UI theme -- unless the user did set a custom background.

Still propagate the current (custom) background to freshly opened Morphic projects.

=============== Diff against Morphic-mt.1235 ===============

Item was added:
+ ----- Method: MorphicProject class>>themeProperties (in category 'preferences') -----
+ themeProperties
+
+ ^ super themeProperties, {
+ { #background. 'Colors'. 'Color or fill-style for projects. Use-defined background will not be overwritten.' }.
+ }!

Item was added:
+ ----- Method: MorphicProject>>applyUserInterfaceTheme (in category 'updating') -----
+ applyUserInterfaceTheme
+
+ super applyUserInterfaceTheme.
+ self setWorldBackground: false.!

Item was added:
+ ----- Method: MorphicProject>>canApplyUserInterfaceTheme (in category 'updating') -----
+ canApplyUserInterfaceTheme
+
+ ^ true!

Item was changed:
  ----- Method: MorphicProject>>initialize (in category 'initialize') -----
  initialize
  "Initialize a new Morphic Project"
  super initialize.
  world := PasteUpMorph newWorldForProject: self.
+ self setWorldBackground: true.
- world fillStyle: (Project current isMorphic ifTrue: [Project current world fillStyle] ifFalse: [self class defaultFill]).
  Locale switchToID: CurrentProject localeID.
  Preferences useVectorVocabulary ifTrue: [world installVectorVocabulary]!

Item was changed:
  ----- Method: MorphicProject>>installPasteUpAsWorld: (in category 'initialize') -----
  installPasteUpAsWorld: pasteUpMorph
  "(ProjectViewMorph newMorphicProjectOn: aPasteUpMorph) openInWorld."
 
+ world := pasteUpMorph beWorldForProject: self.
+ self setWorldBackground: true.!
- world := pasteUpMorph beWorldForProject: self!

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

Item was added:
+ ----- Method: MorphicProject>>setWorldBackground: (in category 'initialize') -----
+ setWorldBackground: force
+
+ ((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])
+ ifTrue: [
+ world fillStyle: Project current world fillStyle.
+ world setProperty: #hasCustomBackground toValue: true]
+ ifFalse: [
+ world removeProperty: #hasCustomBackground.
+ world fillStyle: (self userInterfaceTheme background ifNil: [self class defaultFill])].!