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

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

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

Name: Morphic-mt.1109
Author: mt
Time: 12 April 2016, 7:40:42.953943 pm
UUID: 1f3d1aa2-1df5-7446-85d0-5262c3d99a83
Ancestors: Morphic-mt.1108

Reduce the use of globals in project classes. Clean-up code.

=============== Diff against Morphic-mt.1108 ===============

Item was removed:
- ----- Method: MorphicProject>>addItem:toMenu:selection:requestor: (in category 'utilities') -----
- addItem: item toMenu: menu selection: action requestor: requestingProject
- "Add a menu item representing this project to a menu being created by requestingProject"
-
- | color |
- "Color to be used for this menu item"
- color := self world isInMemory
- ifTrue: [Color black]
- ifFalse: [Color brown].
- "Menu item of type appropriate for current project"
- requestingProject
- addItem: item
- toMenu: menu
- selection: action
- color: color
- thumbnail: thumbnail!

Item was added:
+ ----- Method: MorphicProject>>color (in category 'accessing') -----
+ color
+
+ ^ self world isInMemory
+ ifTrue: [Color black]
+ ifFalse: [Color brown]!

Item was changed:
  ----- Method: MorphicProject>>interruptName:preemptedProcess: (in category 'utilities') -----
  interruptName: labelString preemptedProcess: theInterruptedProcess
  "Create a Notifier on the active scheduling process with the given label."
 
  | preemptedProcess projectProcess |
  ActiveHand ifNotNil:[ActiveHand interrupted].
+ ActiveWorld := world. "reinstall active globals"
+ ActiveHand := world primaryHand.
- ActiveWorld := World. "reinstall active globals"
- ActiveHand := World primaryHand.
  ActiveHand interrupted. "make sure this one's interrupted too"
  ActiveEvent := nil.
 
  projectProcess := self uiProcess. "we still need the accessor for a while"
  preemptedProcess := theInterruptedProcess ifNil: [Processor preemptedProcess].
  "Only debug preempted process if its priority is >= projectProcess' priority"
  preemptedProcess priority < projectProcess priority
  ifTrue:[preemptedProcess := projectProcess].
  preemptedProcess suspend.
  ToolSet interrupt: preemptedProcess label: labelString.!

Item was changed:
  ----- Method: MorphicProject>>openImage:name:saveResource: (in category 'editors') -----
  openImage: aForm name: fullName saveResource: aBoolean
  "Open a view on an image. If aBoolean is true, save the image as a project resource."
 
  aBoolean ifTrue:
  [self resourceManager
  addResource: aForm
  url: (FileDirectory urlForFileNamed: fullName) asString].
+ (world drawingClass withForm: aForm) openInWorld
- (World drawingClass withForm: aForm) openInWorld
  !

Item was changed:
  ----- Method: MorphicProject>>pauseEventRecorder (in category 'enter') -----
  pauseEventRecorder
  "Suspend any event recorder, and return it if found"
 
+ ^ world pauseEventRecorder!
- ^World pauseEventRecorder!

Item was changed:
  ----- Method: MorphicProject>>pointerMoved (in category 'utilities') -----
  pointerMoved
  "Pointer has moved during a drag operation. Perform any necessary updates.
  In Morphic, pay the price for reading the sensor directly."
 
+ world activeHand
- World activeHand
  newMouseFocus: nil;
  showTemporaryCursor: nil;
  flushEvents!

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

Item was changed:
  ----- Method: MorphicProject>>restoreDisplay (in category 'display') -----
  restoreDisplay
  "Clear the screen to gray and then redisplay all the scheduled views."
 
+ ^ world restoreMorphicDisplay
- ^ World restoreMorphicDisplay
  !

Item was changed:
  ----- Method: MorphicProject>>saveState (in category 'enter') -----
  saveState
  "Save the current state in me prior to leaving this project"
 
  changeSet := ChangeSet current.
  thumbnail ifNotNil: [thumbnail hibernate].
- world := World.
  world sleep.
  transcript := Transcript.
  !

Item was changed:
  ----- Method: MorphicProject>>setFlaps (in category 'flaps support') -----
  setFlaps
 
  | flapTabs flapIDs sharedFlapTabs navigationMorph |
  self flag: #toRemove. "check if this method still used by Etoys"
 
  flapTabs := ActiveWorld flapTabs.
  flapIDs := flapTabs collect: [:tab | tab knownName].
  flapTabs
  do: [:tab | (tab isMemberOf: ViewerFlapTab)
  ifFalse: [tab isGlobalFlap
  ifTrue: [Flaps removeFlapTab: tab keepInList: false.
  tab currentWorld reformulateUpdatingMenus]
  ifFalse: [| referent |
  referent := tab referent.
  referent isInWorld
  ifTrue: [referent delete].
  tab delete]]].
  sharedFlapTabs := Flaps classPool at: #SharedFlapTabs.
  flapIDs
  do: [:id |
  id = 'Navigator' translated
  ifTrue: [sharedFlapTabs add: Flaps newNavigatorFlap].
  id = 'Widgets' translated
  ifTrue: [sharedFlapTabs add: Flaps newWidgetsFlap].
  id = 'Tools' translated
  ifTrue: [sharedFlapTabs add: Flaps newToolsFlap].
  id = 'Squeak' translated
  ifTrue: [sharedFlapTabs add: Flaps newSqueakFlap].
  id = 'Supplies' translated
  ifTrue: [sharedFlapTabs add: Flaps newSuppliesFlap].
  id = 'Stack Tools' translated
  ifTrue: [sharedFlapTabs add: Flaps newStackToolsFlap].
  id = 'Painting' translated
  ifTrue: [sharedFlapTabs add: Flaps newPaintingFlap].
  id = 'Objects' translated
  ifTrue: [sharedFlapTabs add: Flaps newObjectsFlap ]].
  2 timesRepeat: [flapIDs do: [:id | Flaps enableDisableGlobalFlapWithID: id]].
  ActiveWorld flapTabs
  do: [:flapTab | flapTab isCurrentlyTextual
  ifTrue: [flapTab changeTabText: flapTab knownName]].
  Flaps positionNavigatorAndOtherFlapsAccordingToPreference.
+ navigationMorph := ActiveWorld findDeeplyA: ProjectNavigationMorph preferredNavigator.
- navigationMorph := World findDeeplyA: ProjectNavigationMorph preferredNavigator.
  navigationMorph isNil
  ifTrue: [^ self].
  navigationMorph allMorphs
  do: [:morph | morph class == SimpleButtonDelayedMenuMorph
  ifTrue: [(morph findA: ImageMorph) isNil
  ifTrue: [| label |
  label := morph label.
  label isNil
  ifFalse: [| name |
  name := morph knownName.
  name isNil
  ifTrue: [morph name: label.
  name := label].
  morph label: name translated]]]]!

Item was changed:
  ----- Method: MorphicProject>>showImage:named: (in category 'utilities') -----
  showImage: aForm named: imageName
  "Show an image, possibly attached to the pointer for positioning"
 
+ HandMorph attach: (world drawingClass withForm: aForm)
- HandMorph attach: (World drawingClass withForm: aForm)
  !

Item was changed:
  ----- Method: MorphicProject>>spawnNewProcess (in category 'active process') -----
  spawnNewProcess
 
  uiProcess := [
+ [world doOneCycle.  Processor yield ] repeat.
- [World doOneCycle.  Processor yield ] repeat.
  ] newProcess priority: Processor userSchedulingPriority.
  uiProcess resume!

Item was changed:
  ----- Method: MorphicProject>>textWindows (in category 'utilities') -----
  textWindows
  "Answer a dictionary of all system windows for text display keyed by window title.
  Generate new window titles as required to ensure unique keys in the dictionary."
 
  | aDict windows title |
  aDict := Dictionary new.
+ windows := world submorphs select: [:m | m isSystemWindow].
- windows := World submorphs select: [:m | m isSystemWindow].
  windows do:
  [:w | | assoc |
  assoc := w titleAndPaneText.
  assoc ifNotNil:
  [w holdsTranscript ifFalse:
  [title := assoc key.
  (aDict includesKey: title) ifTrue: [ | newKey | "Ensure unique keys in aDict"
  (1 to: 100) detect: [:e |
  newKey := title, '-', e asString.
  (aDict includesKey: newKey) not].
  title := newKey.
  assoc := newKey -> assoc value].
  aDict add: assoc]]].
  ^ aDict
  !

Item was changed:
  ----- Method: Project>>isMorphic (in category '*Morphic-testing') -----
  isMorphic
+
+ ^ false!
- "Complexity is because #isMVC is lazily installed"
- ^ world isInMemory
- ifTrue: [world isMorph]
- ifFalse: [(self projectParameters at: #isMVC ifAbsent: [false]) not]!