The Trunk: MorphicExtras-tpr.223.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-tpr.223.mcz

commits-2
tim Rowledge uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-tpr.223.mcz

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

Name: MorphicExtras-tpr.223
Author: tpr
Time: 7 March 2018, 11:14:11.491809 am
UUID: c324d012-9883-4ede-a149-240f51d9687c
Ancestors: MorphicExtras-dtl.222

Convert usage of nasty old StandardFileMenu to gleaming new file dialogues

=============== Diff against MorphicExtras-dtl.222 ===============

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 :=DirectoryChooserDialog openOn: FileDirectory default label: 'Select the directory to load pages from'.
- 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: (self 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: FancyMailComposition>>addAttachment (in category 'actions') -----
  addAttachment
+ | file fileName |
- | file fileResult fileName |
  textEditor
  ifNotNil: [self hasUnacceptedEdits ifTrue: [textEditor accept]].
 
+ fileName := FileChooserDialog openOn: FileDirectory default pattern: nil label: 'Choose attachment'.
+ fileName ifNil: [^self].
+
+ file := FileStream readOnlyFileNamed: fileName.
+ file ifNotNil: [file binary.
- (fileResult := StandardFileMenu oldFile)
- ifNotNil:
- [fileName := fileResult directory fullNameFor: fileResult name.
- file := FileStream readOnlyFileNamed: fileName.
- file ifNotNil:
- [file binary.
  self messageText:
  ((MailMessage from: self messageText asString)
+ addAttachmentFrom: file withName: (FileDirectory localNameFor: fileName);  
+ text).
+ file close]!
- addAttachmentFrom: file withName: fileResult name; text).
- file close]] !

Item was changed:
  ----- Method: FatBitsPaint>>fileOut (in category 'menu') -----
  fileOut
 
+         | fileName |
-         | fileName result |
 
+ fileName := FileSaverDialog openOn: FileDirectory default.
+ fileName ifNil: [^Beeper beep].
+
+   Cursor normal showWhile:  [self unmagnifiedForm writeOnFileNamed: fileName]!
-         result := StandardFileMenu newFile ifNil: [^Beeper beep].
-         fileName := result directory fullNameFor: result name.
-         Cursor normal showWhile:
-                 [self unmagnifiedForm writeOnFileNamed: fileName]!