TextView.st
changeset 3417 44c33c650dc0
parent 3399 c350a2e3efee
child 3426 bbcad86d26a8
--- a/TextView.st	Mon Oct 16 11:17:41 2006 +0200
+++ b/TextView.st	Wed Oct 25 15:03:09 2006 +0200
@@ -9,7 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
 "{ Package: 'stx:libwidg' }"
 
 ListView subclass:#TextView
@@ -556,19 +555,17 @@
 setupForFile:aFileName
     "setup a textView on a file; return the textView"
 
-    |top textView f|
+    |textView f|
 
     textView := self setupEmpty.
-    top := textView topView.
     aFileName notNil ifTrue:[
-        f := aFileName asFilename.
-        top label:(f baseName).
-        textView contents:(f contents).
+        textView setupForFile:aFileName.
     ].
 
     ^ textView
 
-    "Created: 14.2.1997 / 15:21:43 / cg"
+    "Created: / 14-02-1997 / 15:21:43 / cg"
+    "Modified: / 25-10-2006 / 14:46:54 / cg"
 !
 
 setupForModel:aModel
@@ -786,11 +783,10 @@
 fromFile:aFileName
     "take contents from a named file"
 
-    |f|
-
-    f := aFileName asFilename.
-    self directoryForFileDialog:(f directoryName).
-    self contents:(f contents)
+    self obsoleteMethodWarning.
+    ^ self loadTextFile:aFileName.
+
+    "Modified: / 25-10-2006 / 14:47:35 / cg"
 !
 
 list:something
@@ -804,6 +800,18 @@
     "Modified: 29.4.1996 / 12:13:24 / cg"
 !
 
+loadTextFile:aFileName
+    "take contents from a named file"
+
+    |f|
+
+    f := aFileName asFilename.
+    self directoryForFileDialog:(f directoryName).
+    self contents:(f contents)
+
+    "Created: / 25-10-2006 / 14:44:01 / cg"
+!
+
 setContents:something
     "set the contents (either a string or a Collection of strings)
      dont change the position (i.e. do not scroll) or the selection."
@@ -838,6 +846,21 @@
     super setList:something
 !
 
+setupForFile:aFileName
+    "take contents from a named file"
+
+    |baseName|
+
+    self loadTextFile:aFileName.
+    aFileName notNil ifTrue:[
+        baseName := aFileName asFilename baseName.
+        self topView label:baseName.
+        self defaultFileNameForFileDialog:baseName.
+    ].
+
+    "Created: / 25-10-2006 / 14:47:13 / cg"
+!
+
 text
     "for ST80 compatibility"
 
@@ -3897,7 +3920,7 @@
 !TextView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.272 2006-09-21 14:53:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/TextView.st,v 1.273 2006-10-25 13:03:09 cg Exp $'
 ! !
 
 TextView initialize!