FileSelectionList.st
changeset 1687 bf72059725a1
parent 1445 2c717104c3fb
child 1690 77d381b11f95
--- a/FileSelectionList.st	Fri Sep 18 23:10:34 1998 +0200
+++ b/FileSelectionList.st	Tue Sep 22 13:17:04 1998 +0200
@@ -12,8 +12,8 @@
 
 SelectionInListView subclass:#FileSelectionList
 	instanceVariableNames:'pattern directory timeStamp directoryId directoryName
-		directoryContents directoryFileTypes fileTypes realAction
-		matchBlock stayInDirectory ignoreParentDirectory markDirectories
+		directoryContents directoryFileTypes realAction matchBlock
+		stayInDirectory ignoreParentDirectory markDirectories
 		ignoreDirectories directoryChangeCheckBlock quickDirectoryChange
 		directoryChangeAction directorySelectAction fileSelectAction
 		ignoreFiles directoryHolder'
@@ -670,13 +670,15 @@
 
     "then draw marks"
     startVisLineNr to:endVisLineNr do:[:visLineNr |
-	l := self visibleLineToListLine:visLineNr.
-	l notNil ifTrue:[
-	    (fileTypes at:l) == #directory ifTrue:[
-		self drawRightArrowInVisibleLine:visLineNr
-	    ]
-	]
+        l := self visibleLineToListLine:visLineNr.
+        l notNil ifTrue:[
+            (directoryFileTypes at:l) == true ifTrue:[
+                self drawRightArrowInVisibleLine:visLineNr
+            ]
+        ]
     ]
+
+    "Modified: / 22.9.1998 / 12:32:24 / cg"
 !
 
 redrawVisibleLine:visLineNr
@@ -689,10 +691,12 @@
 
     l := self visibleLineToListLine:visLineNr.
     l notNil ifTrue:[
-	(fileTypes at:l) == #directory ifTrue:[
-	    self drawRightArrowInVisibleLine:visLineNr
-	]
+        (directoryFileTypes at:l) == true ifTrue:[
+            self drawRightArrowInVisibleLine:visLineNr
+        ]
     ]
+
+    "Modified: / 22.9.1998 / 12:32:34 / cg"
 ! !
 
 !FileSelectionList methodsFor:'events'!
@@ -852,6 +856,8 @@
 !
 
 selectionIsDirectory
+    "return true, if the current selection is a directory"
+
     |entry|
 
     entry := self selectionValue.
@@ -860,20 +866,22 @@
     (entry endsWith:' ...') ifTrue:[
         entry := entry copyWithoutLast:4.
     ].
-    ^ (directory construct:entry) type == #directory
+    ^ (directory construct:entry) isDirectory
 
-    "Created: 4.3.1996 / 17:43:26 / cg"
-    "Modified: 18.9.1997 / 23:37:05 / stefan"
+    "Created: / 4.3.1996 / 17:43:26 / cg"
+    "Modified: / 18.9.1997 / 23:37:05 / stefan"
+    "Modified: / 22.9.1998 / 12:30:21 / cg"
 !
 
 updateList
     "set the lists contents to the filenames in the directory"
 
-    |oldCursor files newList index obsolete matching patternList dir|
+    |oldCursor files newList index obsolete 
+     matching patternList dir|
 
     directory isNil ifTrue:[
         super list:nil.
-        files :=  newList := fileTypes := nil.
+        files :=  newList := nil.
         ^ self
     ].
 
@@ -895,14 +903,17 @@
         directoryId := directory id.
         directoryName := directory pathName.
         directoryContents := directory fullDirectoryContents sort.
+        directoryFileTypes := OrderedCollection new.
+        directoryContents do:[:name | 
+            |f|
 
-        directoryFileTypes := OrderedCollection new.
-        directoryContents do:[:name | directoryFileTypes add:(directory construct:name)type].
+            f := directory construct:name.
+            directoryFileTypes add:(f isDirectory)
+        ].
     ].
 
     files := directoryContents.
     newList := OrderedCollection new.
-    fileTypes := OrderedCollection new.
     index := 1.
 
     dir := directory pathName asFilename.
@@ -911,20 +922,17 @@
 
         fullName := dir constructString:name.
         (matchBlock isNil or:[matchBlock value:fullName]) ifTrue:[
-            type := directoryFileTypes at:index.
-            type == #directory ifTrue:[
+            (directoryFileTypes at:index) == true ifTrue:[
                 ignoreDirectories ifFalse:[
                     name = '..' ifTrue:[
                         ignoreParentDirectory ifFalse:[
                             newList add:name.
-                            fileTypes add:type
                         ]
                     ] ifFalse:[
                         name = '.' ifTrue:[
                             "ignore"
                         ] ifFalse:[
                             newList add:(name ", ' ...'").
-                            fileTypes add:type
                         ]
                     ]
                 ]
@@ -946,7 +954,6 @@
                                     
                     matching ifTrue:[
                         newList add:name.
-                        fileTypes add:type
                     ]
                 ]
             ].
@@ -957,8 +964,8 @@
 
     self cursor:oldCursor.
 
-    "Modified: 18.9.1997 / 23:43:52 / stefan"
-    "Modified: 20.9.1997 / 13:03:48 / cg"
+    "Modified: / 18.9.1997 / 23:43:52 / stefan"
+    "Modified: / 22.9.1998 / 12:33:24 / cg"
 !
 
 visibleLineNeedsSpecialCare:visLineNr
@@ -966,10 +973,12 @@
 
     l := self visibleLineToListLine:visLineNr.
     l notNil ifTrue:[
-	(fileTypes at:l) == #directory ifTrue:[^ true].
-	^ super visibleLineNeedsSpecialCare:visLineNr
+        (directoryFileTypes at:l) == true ifTrue:[^ true].
+        ^ super visibleLineNeedsSpecialCare:visLineNr
     ].
     ^ false
+
+    "Modified: / 22.9.1998 / 12:32:48 / cg"
 !
 
 widthForScrollBetween:firstLine and:lastLine
@@ -1002,5 +1011,5 @@
 !FileSelectionList class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.41 1998-02-05 22:52:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.42 1998-09-22 11:17:04 cg Exp $'
 ! !