--- a/TextView.st Wed Jan 14 17:04:25 2004 +0100
+++ b/TextView.st Wed Jan 14 18:02:40 2004 +0100
@@ -20,7 +20,7 @@
selectStyle directoryForFileDialog defaultFileNameForFileDialog
externalEncoding contentsWasSaved searchAction lastSearchPattern
lastSearchIgnoredCase lastSearchDirection
- parenthesisSpecification dropSource dragIsActive'
+ parenthesisSpecification dropSource dragIsActive saveAction'
classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
DefaultSelectionBackgroundColor
DefaultAlternativeSelectionForegroundColor
@@ -703,6 +703,10 @@
See the classes initialize method for a useful value."
parenthesisSpecification := aDictionary
+!
+
+saveAction:something
+ saveAction := something.
! !
!TextView methodsFor:'accessing-contents'!
@@ -1499,6 +1503,7 @@
initialize
super initialize.
+ self initializeSaveAction.
contentsWasSaved := false.
dragIsActive := false.
@@ -1511,6 +1516,10 @@
"/ on default allow drag
self allowDrag:true.
+!
+
+initializeSaveAction
+ saveAction := [ self openSaveDialog ]
! !
!TextView methodsFor:'menu actions'!
@@ -1689,9 +1698,9 @@
"Modified: / 17.5.1998 / 20:07:59 / cg"
!
-save
- "save contents into a file
- - ask user for filename using a fileSelectionBox."
+openSaveDialog
+ "Ask user for filename using a fileSelectionBox
+ and save contents into that file."
Dialog
requestSaveFileName:(resources string:'Save contents in:')
@@ -1699,46 +1708,15 @@
fromDirectory:directoryForFileDialog
action:[:fileName | self saveAs:fileName]
appendAction:[:fileName | self appendTo:fileName]
-
-"/ |fileBox fileName|
-"/
-"/true ifTrue:[
-"/ fileName := FileDialog
-"/ requestFileName:(resources string:'Save contents in:')
-"/ default:(defaultFileNameForFileDialog ifNotNil:[defaultFileNameForFileDialog asString])
-"/ ok:(resources string:'Save')
-"/ abort:nil
-"/ version:nil
-"/ ifFail:nil
-"/ pattern:nil
-"/ fromDirectory:directoryForFileDialog
-"/ whenBoxCreatedEvaluate:[:dialog | dialog appendButtonVisibleHolder value:true].
-"/
-"/ fileName size > 0 ifTrue:[
-"/self halt.
-"/ self saveAs:fileName.
-"/ ].
-"/ ^ self.
-"/].
-"/ fileBox := FileSaveBox
-"/ title:(resources string:'Save contents in:')
-"/ okText:(resources string:'Save')
-"/ abortText:(resources string:'Cancel')
-"/ action:[:fileName | self saveAs:fileName].
-"/ fileBox appendAction:[:fileName | self appendTo:fileName].
-"/ directoryForFileDialog notNil ifTrue:[
-"/ fileBox directory:directoryForFileDialog
-"/ ].
-"/ defaultFileNameForFileDialog notNil ifTrue:[
-"/ fileBox initialText:defaultFileNameForFileDialog asString
-"/ ].
-"/ fileBox showAtPointer.
-"/
-"/ directoryForFileDialog := fileBox directory. "/ remember for next time
-"/
-"/ fileBox destroy.
-"/
-"/ "Modified: 16.4.1997 / 20:49:26 / cg"
+!
+
+save
+ "save contents into a file
+ - ask user for filename using a fileSelectionBox."
+
+ saveAction notNil ifTrue:[
+ saveAction value
+ ]
!
saveAs:fileName
@@ -3734,7 +3712,7 @@
!TextView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.221 2004-01-14 16:04:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.222 2004-01-14 17:02:40 cg Exp $'
! !
TextView initialize!