The Trunk: MorphicExtras-dtl.214.mcz

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

The Trunk: MorphicExtras-dtl.214.mcz

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

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

Name: MorphicExtras-dtl.214
Author: dtl
Time: 11 November 2017, 4:05:52.716283 pm
UUID: 297c9f00-e80a-4a90-a1aa-5f3a26a835d0
Ancestors: MorphicExtras-pre.213

World global elimination. Once the current project has been entered, Project current world == World. Begin eliminating references to the global variable World in cases where it is not required.

=============== Diff against MorphicExtras-pre.213 ===============

Item was changed:
  ----- Method: BookMorph>>loadImagesIntoBook (in category 'menu') -----
  loadImagesIntoBook
  "PowerPoint stores GIF presentations as individual slides named Slide1, Slide2, etc.
  Load these into the book.  mjg 9/99"
 
  | directory filenumber form newpage |
  directory := ((StandardFileMenu oldFileFrom: FileDirectory default)
  ifNil: [^nil]) directory.
  directory isNil ifTrue: [^nil].
 
  "Start loading 'em up!!"
  filenumber := 1.
  [directory fileExists: 'Slide' , filenumber asString] whileTrue:
  [Transcript
  show: 'Slide' , filenumber asString;
  cr.
  Smalltalk bytesLeft < 1000000
  ifTrue:
  ["Make some room"
 
  (self valueOfProperty: #url) isNil
  ifTrue: [self savePagesOnURL]
  ifFalse: [self saveAsNumberedURLs]].
  form := Form
  fromFileNamed: (directory fullNameFor: 'Slide' , filenumber asString).
  newpage := PasteUpMorph new extent: form extent.
+ newpage addMorph: (Project current world drawingClass withForm: form).
- newpage addMorph: (World drawingClass withForm: form).
  self pages addLast: newpage.
  filenumber := filenumber + 1].
 
  "After adding all, delete the first page."
  self goToPage: 1.
  self deletePageBasic.
 
  "Save the book"
  (self valueOfProperty: #url) isNil
  ifTrue: [self savePagesOnURL]
  ifFalse: [self saveAsNumberedURLs]!

Item was changed:
  ----- Method: GraphicalDictionaryMenu>>handMeOne (in category 'menu commands') -----
  handMeOne
+ self currentHand attachMorph: (Project current world drawingClass new form: (formChoices at: currentIndex))!
- self currentHand attachMorph: (World drawingClass new form: (formChoices at: currentIndex))!

Item was changed:
  ----- Method: GraphicalDictionaryMenu>>repaintEntry (in category 'menu commands') -----
  repaintEntry
  "Let the user enter into painting mode to repaint the item and save it back."
 
  | aWorld bnds sketchEditor aPaintBox formToEdit |
 
  (aWorld := self world) assureNotPaintingElse: [^ self].
 
  aWorld prepareToPaint.
  aWorld displayWorld.
  formToEdit := formChoices at: currentIndex.
  bnds := (submorphs second boundsInWorld origin extent: formToEdit extent) intersect: aWorld bounds.
  bnds := (aWorld paintingBoundsAround: bnds center) merge: bnds.
  sketchEditor := SketchEditorMorph new.
  aWorld addMorphFront: sketchEditor.
+ sketchEditor initializeFor: ((aWorld drawingClass withForm: formToEdit) position: submorphs second positionInWorld)  inBounds: bnds pasteUpMorph: aWorld paintBoxPosition: bnds topRight.
- sketchEditor initializeFor: ((World drawingClass withForm: formToEdit) position: submorphs second positionInWorld)  inBounds: bnds pasteUpMorph: aWorld paintBoxPosition: bnds topRight.
  sketchEditor
  afterNewPicDo: [:aForm :aRect |
  formChoices at: currentIndex put: aForm.
  baseDictionary at: (entryNames at: currentIndex) put: aForm.
  self updateThumbnail.
  (aPaintBox := aWorld paintBoxOrNil) ifNotNil: [aPaintBox delete]]
  ifNoBits:
  [(aPaintBox := aWorld paintBoxOrNil) ifNotNil: [aPaintBox delete]].
 
  !

Item was changed:
  ----- Method: ProjectSorterMorph>>addControls (in category 'initialization') -----
  addControls
  "Add the control bar at the top of the tool."
 
  | b r partsBinButton newButton aWrapper |
+ newButton := ImageMorph new image: (Project current makeThumbnail scaledToSize: 48@36).
- newButton := ImageMorph new image: (World project makeThumbnail scaledToSize: 48@36).
  newButton on: #mouseDown send: #insertNewProject: to: self.
  newButton setBalloonText: 'Make a new Project' translated.
  (partsBinButton := UpdatingThreePhaseButtonMorph checkBox)
  target: self;
  actionSelector: #togglePartsBinStatus;
  arguments: #();
  getSelector: #getPartsBinStatus.
  (r := AlignmentMorph newRow)
  color: Color transparent;
  borderWidth: 0;
  layoutInset: 0;
  cellInset: 10@0;
  wrapCentering: #center;
  cellPositioning: #leftCenter;
  hResizing: #shrinkWrap;
  vResizing: #shrinkWrap;
  extent: 5@5.
  b := SimpleButtonMorph new target: self; color: self defaultColor darker;
  borderColor: Color black.
  r addMorphBack: (self wrapperFor: (b label: 'Okay' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #acceptSort)).
  b := SimpleButtonMorph new target: self; color: self defaultColor darker;
  borderColor: Color black.
  r addMorphBack: (self wrapperFor: (b label: 'Cancel' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #delete));
  addTransparentSpacerOfSize: 8 @ 0;
  addMorphBack: (self wrapperFor: (newButton));
  addTransparentSpacerOfSize: 8 @ 0.
 
  aWrapper := AlignmentMorph newRow beTransparent.
  aWrapper cellInset: 0; layoutInset: 0; borderWidth: 0.
  aWrapper
  addMorphBack: (self wrapperFor: partsBinButton);
  addMorphBack: (self wrapperFor: (StringMorph contents: 'Parts bin' translated font: ScriptingSystem fontForEToyButtons) lock).
  r addMorphBack: aWrapper.
 
  self addMorphFront: r.
  !

Item was changed:
  ----- Method: SpeakerMorph>>addGraphic (in category 'initialization') -----
  addGraphic
 
  | graphic |
+ graphic := Project current world drawingClass withForm: self speakerGraphic.
- graphic := World drawingClass withForm: self speakerGraphic.
  graphic position: bounds center - (graphic extent // 2).
  self addMorph: graphic.
  !

Item was changed:
  ----- Method: SqueakPage>>prePurge (in category 'saving') -----
  prePurge
  "Return self if ready to be purged, or nil if not"
 
  self isContentsInMemory ifFalse: [^ nil].
  contentsMorph ifNil: [^ nil].  "out already"
  url ifNil: [^ nil]. "just to be safe"
+ ^ (Project current world ~~ nil and: [contentsMorph world == World])
- ^ (World ~~ nil and: [contentsMorph world == World])
  ifTrue: [nil "showing now"] ifFalse: [self]!

Item was changed:
  ----- Method: TabbedPalette class>>authoringPrototype (in category 'scripting') -----
  authoringPrototype
  | aTabbedPalette aBook aTab |
  aTabbedPalette := self new markAsPartsDonor.
  aTabbedPalette pageSize: 200 @ 300.
  aTabbedPalette tabsMorph highlightColor: Color red regularColor: Color blue.
  aTabbedPalette addMenuTab.
 
  aBook := BookMorph new setNameTo: 'one'; pageSize: aTabbedPalette pageSize.
  aBook color: Color blue muchLighter.
  aBook removeEverything; insertPage; showPageControls.
+ aBook currentPage addMorphBack: (Project current world drawingClass withForm: ScriptingSystem squeakyMouseForm).
- aBook currentPage addMorphBack: (World drawingClass withForm: ScriptingSystem squeakyMouseForm).
  aTab := aTabbedPalette addTabForBook: aBook.
 
  aBook := BookMorph new setNameTo: 'two'; pageSize: aTabbedPalette pageSize.
  aBook color: Color red muchLighter.
  aBook removeEverything; insertPage; showPageControls.
  aBook currentPage addMorphBack: CurveMorph authoringPrototype.
  aTabbedPalette addTabForBook: aBook.
 
  aTabbedPalette selectTab: aTab.
 
  aTabbedPalette beSticky.
  aTabbedPalette tabsMorph hResizing: #spaceFill.
  ^ aTabbedPalette!

Item was changed:
  ----- Method: TabbedPalette>>addMenuTab (in category 'palette menu') -----
  addMenuTab
  "Add the menu tab.  This is ancient code, not much in the spirit of anything current"
 
  | aMenu aTab aGraphic sk |
  aMenu := MenuMorph new defaultTarget: self.
  aMenu stayUp: true.
  "aMenu add:  'clear' translated action: #showNoPalette."
  aMenu add:  'sort tabs' translated action: #sortTabs:.
  aMenu add:  'choose new colors for tabs' translated action: #recolorTabs.
  aMenu setProperty: #paletteMenu toValue: true.
  "aMenu add:  'make me the Standard palette' translated action: #becomeStandardPalette."
  aTab := self addTabForBook: aMenu  withBalloonText: 'a menu of palette-related controls' translated.
  aTab highlightColor: tabsMorph highlightColor; regularColor: tabsMorph regularColor.
  tabsMorph laySubpartsOutInOneRow; layoutChanged.
 
  aGraphic := ScriptingSystem formAtKey: 'TinyMenu'.
  aGraphic ifNotNil:
  [aTab removeAllMorphs.
+ aTab addMorph: (sk := Project current world drawingClass withForm: aGraphic).
- aTab addMorph: (sk := World drawingClass withForm: aGraphic).
  sk position: aTab position.
  sk lock.
  aTab fitContents].
  self layoutChanged!