tim Rowledge uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-tpr.233.mcz ==================== Summary ==================== Name: ST80-tpr.233 Author: tpr Time: 7 January 2018, 4:44:46.985177 pm UUID: c7bef0c0-1026-4f40-a074-add958b89220 Ancestors: ST80-nice.232 Update some MVC related code to use the hooks that might oneday allow them to use a nice graphical file dialog =============== Diff against ST80-nice.232 =============== Item was changed: ----- Method: BitEditor>>fileOut (in category 'menu messages') ----- fileOut | fileName | fileName := UIManager default + saveFilenameRequest: 'Save this Form to' translated - request: 'File name?' translated initialAnswer: 'Filename.form'. + fileName ifNil: [^ self]. - fileName isEmpty ifTrue: [^ self]. Cursor normal showWhile: [model writeOnFileNamed: fileName]. ! Item was changed: ----- Method: FormEditor>>fileInForm (in category 'editing tools') ----- fileInForm "Ask the user for a file name and then recalls the Form in that file as the current source Form (form). Does not change the tool." | fileName | fileName := UIManager default + chooseFileMatchingSuffixes: #('form') + label: 'File name?' translated. + fileName ifNil: [^ self]. - request: 'File name?' translated - initialAnswer: 'Filename.form'. - fileName isEmpty ifTrue: [^ self]. form := Form fromFileNamed: fileName. tool := previousTool. ! Item was changed: ----- Method: FormEditor>>fileOut (in category 'menu messages') ----- fileOut | fileName | fileName := UIManager default + saveFilenameRequest: 'File name?' translated - request: 'File name?' translated initialAnswer: 'Filename.form'. + fileName ifNil: [^ self]. - fileName isEmpty ifTrue: [^ self]. Cursor normal showWhile: [model writeOnFileNamed: fileName]. ! Item was changed: ----- Method: FormEditor>>fileOutForm (in category 'editing tools') ----- fileOutForm "Ask the user for a file name and save the current source form under that name. Does not change the tool." | fileName | fileName := UIManager default + saveFilenameRequest: 'File name?' translated - request: 'File name?' translated initialAnswer: 'Filename.form'. + fileName ifNil: [^ self]. - fileName isEmpty ifTrue: [^ self]. Cursor normal showWhile: [form writeOnFileNamed: fileName]. tool := previousTool. ! Item was changed: ----- Method: ParagraphEditor>>saveContentsInFile (in category 'menu messages') ----- saveContentsInFile "Save the receiver's contents string to a file, prompting the user for a file-name. Suggest a reasonable file-name." | fileName stringToSave parentWindow labelToUse suggestedName | stringToSave := paragraph text string. stringToSave size = 0 ifTrue: [^ self inform: 'nothing to save.']. parentWindow := self model dependents detect: [:dep | dep isKindOf: SystemWindow orOf: StandardSystemView] ifNone: [nil]. labelToUse := parentWindow ifNil: ['Untitled'] ifNotNil: [parentWindow label]. suggestedName := nil. #(('Decompressed contents of: ' '.gz')) do: "can add more here..." [:leaderTrailer | | lastIndex | (labelToUse beginsWith: leaderTrailer first) ifTrue: [suggestedName := labelToUse copyFrom: leaderTrailer first size + 1 to: labelToUse size. (labelToUse endsWith: leaderTrailer last) ifTrue: [suggestedName := suggestedName copyFrom: 1 to: suggestedName size - leaderTrailer last size] ifFalse: [lastIndex := suggestedName lastIndexOf: $.. (lastIndex > 1) ifTrue: [suggestedName := suggestedName copyFrom: 1 to: lastIndex - 1]]]]. suggestedName ifNil: [suggestedName := labelToUse, '.text']. + fileName := UIManager default saveFilenameRequest: 'File name?' translated - fileName := UIManager default request: 'File name?' translated initialAnswer: suggestedName. fileName isEmptyOrNil ifFalse: [(FileStream newFileNamed: fileName) nextPutAll: stringToSave; close]! |
Free forum by Nabble | Edit this page |