author | Claus Gittinger <cg@exept.de> |
Tue, 05 Mar 1996 02:38:29 +0100 | |
changeset 472 | 17f795e6ecba |
parent 467 | ecf956d44135 |
child 547 | 6c9aaf7a84e7 |
permissions | -rw-r--r-- |
11 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
62 | 3 |
All Rights Reserved |
11 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
SelectionInListView subclass:#FileSelectionList |
|
287 | 14 |
instanceVariableNames:'pattern directory timeStamp directoryId directoryName |
15 |
directoryContents directoryFileTypes fileTypes realAction |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
16 |
matchBlock stayInDirectory ignoreParentDirectory markDirectories |
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
17 |
ignoreDirectories directoryChangeCheckBlock quickDirectoryChange |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
18 |
directoryChangeAction' |
282 | 19 |
classVariableNames:'' |
20 |
poolDictionaries:'' |
|
21 |
category:'Views-Text' |
|
11 | 22 |
! |
23 |
||
24 |
!FileSelectionList class methodsFor:'documentation'! |
|
25 |
||
38 | 26 |
copyright |
27 |
" |
|
28 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
62 | 29 |
All Rights Reserved |
38 | 30 |
|
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
11 | 40 |
documentation |
41 |
" |
|
38 | 42 |
this class implements file selection lists - its basically a |
43 |
selection in list, but adds some right-arrows to directories. |
|
44 |
(and will soon remember the previous position when changing directories). |
|
59 | 45 |
You can specify an optional filename-pattern (such as '*.st') and an |
46 |
optional matchBlock (such as: [:name | name startsWith:'A']). |
|
47 |
||
48 |
Only files (plus directories) matching the pattern (if present) and |
|
49 |
for which the matchBlock returns true (if present), are shown. |
|
21 | 50 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
51 |
Except for file-browser like applications, FileSelectionLists are almost |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
52 |
exclusively used with FileSelectionBoxes (see examples there). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
53 |
|
38 | 54 |
Instance variables: |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
55 |
pattern the matchpattern |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
56 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
57 |
directory the current directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
58 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
59 |
timeStamp the time, when directoryContents was last taken |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
60 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
61 |
directoryId the directories id (inode-nr) when it was taken |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
62 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
63 |
directoryName the path when it was taken |
62 | 64 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
65 |
directoryContents (cached) contents of current directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
66 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
67 |
directoryFileTypes (cached) file types (symbols) of current directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
68 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
69 |
fileTypes file types as shown in list (i.e only matching ones) |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
70 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
71 |
matchBlock if non-nil: block evaluated per full filename; |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
72 |
only files for which matchBlock returns true are shown. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
73 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
74 |
realAction (internal) the action to perform when a file is selected |
59 | 75 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
76 |
quickDirectoryChange if true, directories can be changed with a single click |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
77 |
if false (the default), they need a double click. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
78 |
Makes sense if a directory is what we are interrested in, |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
79 |
for files its better to leave it as false. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
80 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
81 |
stayInDirectory if true, no directoryChanges are allowed. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
82 |
Makes sense to limit the user to choose among certain files. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
83 |
The default is false. |
59 | 84 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
85 |
ignoreParentDirectory if true, the parent directory is not shown. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
86 |
Makes sense to limit the user to files below the initial |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
87 |
directory. Default is false. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
88 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
89 |
ignoreDirectories if true, no directories are shown at all. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
90 |
Makes sense to limit the user to choose among regular files. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
91 |
Default is false. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
92 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
93 |
directoryChangeCheckBlock |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
94 |
if nonNil, directoryChanges are only allowed if this block |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
95 |
returns true. It is evaluated with one argument, the pathName. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
96 |
Defaults to nil (i.e. no checks). |
62 | 97 |
|
98 |
" |
|
99 |
! |
|
59 | 100 |
|
62 | 101 |
examples |
102 |
" |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
103 |
FileSelectionLists are typically used in FileSelectionBoxes, |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
104 |
or file-browser-like applications. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
105 |
Thus, the following examples are a bit untypical. |
59 | 106 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
107 |
example (plain file-list): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
108 |
|
62 | 109 |
|list| |
59 | 110 |
|
62 | 111 |
list := FileSelectionList new. |
112 |
list open |
|
59 | 113 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
114 |
example (scrolled & some action): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
115 |
|
62 | 116 |
|top v list| |
59 | 117 |
|
62 | 118 |
top := StandardSystemView new. |
119 |
top extent:(300 @ 200). |
|
120 |
v := ScrollableView for:FileSelectionList in:top. |
|
121 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
122 |
list := v scrolledView. |
|
123 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
124 |
top open |
|
59 | 125 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
126 |
ignore the parentDirectory: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
127 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
128 |
|top v list| |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
129 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
130 |
top := StandardSystemView new. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
131 |
top extent:(300 @ 200). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
132 |
v := ScrollableView for:FileSelectionList in:top. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
133 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
134 |
list := v scrolledView. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
135 |
list ignoreParentDirectory:true. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
136 |
top open |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
137 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
138 |
ignore all directories: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
139 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
140 |
|top v list| |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
141 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
142 |
top := StandardSystemView new. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
143 |
top extent:(300 @ 200). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
144 |
v := ScrollableView for:FileSelectionList in:top. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
145 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
146 |
list := v scrolledView. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
147 |
list ignoreDirectories:true. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
148 |
top open |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
149 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
150 |
dont show the directory arrow-mark: |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
151 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
152 |
|top v list| |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
153 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
154 |
top := StandardSystemView new. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
155 |
top extent:(300 @ 200). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
156 |
v := ScrollableView for:FileSelectionList in:top. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
157 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
158 |
list := v scrolledView. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
159 |
list markDirectories:false. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
160 |
top open |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
161 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
162 |
example (adds a pattern, only showing .st files and directories): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
163 |
|
62 | 164 |
|top v list| |
59 | 165 |
|
62 | 166 |
top := StandardSystemView new. |
167 |
top extent:(300 @ 200). |
|
168 |
v := ScrollableView for:FileSelectionList in:top. |
|
169 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
170 |
list := v scrolledView. |
|
171 |
list pattern:'*.st'. |
|
172 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
173 |
top open |
|
59 | 174 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
175 |
example (a more complicated pattern): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
176 |
|
62 | 177 |
|top v list| |
59 | 178 |
|
62 | 179 |
top := StandardSystemView new. |
180 |
top extent:(300 @ 200). |
|
181 |
v := ScrollableView for:FileSelectionList in:top. |
|
182 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
183 |
list := v scrolledView. |
|
184 |
list pattern:'[A-D]*.st'. |
|
185 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
186 |
top open |
|
59 | 187 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
188 |
example (adds a matchblock to show only writable files): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
189 |
|
62 | 190 |
|top v list| |
59 | 191 |
|
62 | 192 |
top := StandardSystemView new. |
193 |
top extent:(300 @ 200). |
|
194 |
v := ScrollableView for:FileSelectionList in:top. |
|
195 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
196 |
list := v scrolledView. |
|
197 |
list matchBlock:[:name | |
|
198 |
|fileName| |
|
199 |
fileName := name asFilename. |
|
200 |
fileName isWritable or:[fileName isDirectory] |
|
201 |
]. |
|
202 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
203 |
top open |
|
59 | 204 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
205 |
example (adds a matchblock to suppress directories): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
206 |
|
62 | 207 |
|top v list| |
59 | 208 |
|
62 | 209 |
top := StandardSystemView new. |
210 |
top extent:(300 @ 200). |
|
211 |
v := ScrollableView for:FileSelectionList in:top. |
|
212 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
213 |
list := v scrolledView. |
|
214 |
list matchBlock:[:name | |
|
215 |
name asFilename isDirectory not |
|
216 |
]. |
|
217 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
218 |
top open |
|
59 | 219 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
220 |
example (the above can be done more convenient) |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
221 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
222 |
|top v list| |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
223 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
224 |
top := StandardSystemView new. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
225 |
top extent:(300 @ 200). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
226 |
v := ScrollableView for:FileSelectionList in:top. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
227 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
228 |
list := v scrolledView. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
229 |
list ignoreDirectories:true. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
230 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
231 |
top open |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
232 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
233 |
example (adds a matchblock to block parent dirs (i.e. only allow files here & below): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
234 |
|
62 | 235 |
|top v list currentDir| |
59 | 236 |
|
62 | 237 |
currentDir := '.' asFilename pathName. |
59 | 238 |
|
62 | 239 |
top := StandardSystemView new. |
240 |
top extent:(300 @ 200). |
|
241 |
v := ScrollableView for:FileSelectionList in:top. |
|
242 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
243 |
list := v scrolledView. |
|
244 |
list matchBlock:[:name | |
|
245 |
((name endsWith:'/..') and:[list directory pathName = currentDir]) not |
|
246 |
]. |
|
247 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
248 |
top open |
|
59 | 249 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
250 |
example (block moving up AND show all .rc-files only): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
251 |
|
62 | 252 |
|top v list currentDir| |
59 | 253 |
|
62 | 254 |
currentDir := '.' asFilename pathName. |
59 | 255 |
|
62 | 256 |
top := StandardSystemView new. |
257 |
top extent:(300 @ 200). |
|
258 |
v := ScrollableView for:FileSelectionList in:top. |
|
259 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
260 |
list := v scrolledView. |
|
261 |
list pattern:'*.rc'. |
|
262 |
list matchBlock:[:name | |
|
263 |
((name endsWith:'/..') and:[list directory pathName = currentDir]) not |
|
264 |
]. |
|
265 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
266 |
top open |
|
59 | 267 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
268 |
example (show only .rc-files in current directory): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
269 |
|
62 | 270 |
|top v list currentDir| |
59 | 271 |
|
62 | 272 |
currentDir := '.' asFilename pathName. |
59 | 273 |
|
62 | 274 |
top := StandardSystemView new. |
275 |
top extent:(300 @ 200). |
|
276 |
v := ScrollableView for:FileSelectionList in:top. |
|
277 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
278 |
list := v scrolledView. |
|
279 |
list pattern:'*.rc'. |
|
280 |
list matchBlock:[:name | |
|
281 |
name asFilename isDirectory not |
|
282 |
]. |
|
283 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
284 |
top open |
|
59 | 285 |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
286 |
example (show only h*-files in /etc; dont allow directory changes): |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
287 |
|
62 | 288 |
|top v list| |
59 | 289 |
|
62 | 290 |
top := StandardSystemView new. |
291 |
top extent:(300 @ 200). |
|
292 |
v := ScrollableView for:FileSelectionList in:top. |
|
293 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
294 |
list := v scrolledView. |
|
295 |
list directory:'/etc'. |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
296 |
list pattern:'h*'. |
62 | 297 |
list matchBlock:[:name | name printNL. |
298 |
name asFilename isDirectory not |
|
299 |
]. |
|
300 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
|
301 |
top open |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
302 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
303 |
example (only allow changing into directories below the current one; i.e. not up; |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
304 |
but show it) |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
305 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
306 |
|top v list here| |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
307 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
308 |
top := StandardSystemView new. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
309 |
top extent:(300 @ 200). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
310 |
v := ScrollableView for:FileSelectionList in:top. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
311 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
312 |
list := v scrolledView. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
313 |
list directoryChangeCheckBlock:[:dirPath | |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
314 |
dirPath asFilename pathName |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
315 |
startsWith:Filename currentDirectory pathName]. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
316 |
list action:[:index | Transcript showCr:'you selected: ' , list selectionValue]. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
317 |
top open |
11 | 318 |
" |
77 | 319 |
! ! |
320 |
||
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
321 |
!FileSelectionList methodsFor:'accessing-behavior'! |
77 | 322 |
|
193 | 323 |
action:aBlock |
324 |
"set the action to be performed on a selection" |
|
325 |
||
326 |
realAction := aBlock |
|
327 |
! |
|
328 |
||
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
329 |
directoryChangeAction:aBlock |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
330 |
"set the action to be performed on a directory change" |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
331 |
|
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
332 |
directoryChangeAction := aBlock |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
333 |
|
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
334 |
"Created: 5.3.1996 / 02:37:08 / cg" |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
335 |
! |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
336 |
|
338 | 337 |
directoryChangeCheckBlock:aBlock |
338 |
"set the directoryChangeCheckBlock - if non-nil, it controls if |
|
339 |
a directory change is legal." |
|
77 | 340 |
|
338 | 341 |
directoryChangeCheckBlock := aBlock |
77 | 342 |
! |
343 |
||
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
344 |
ignoreDirectories:aBoolean |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
345 |
"set/clear the flag which controls if directories are ignored |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
346 |
(i.e. hidden). The default is false (i.e. dirs are shown)" |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
347 |
|
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
348 |
ignoreDirectories := aBoolean |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
349 |
! |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
350 |
|
338 | 351 |
ignoreParentDirectory:aBoolean |
352 |
"set/clear the flag which controls if the parent directory (..) |
|
353 |
is shown in the list. The default is false (i.e. show it)" |
|
354 |
||
355 |
ignoreParentDirectory := aBoolean |
|
356 |
! |
|
357 |
||
282 | 358 |
markDirectories:aBoolean |
359 |
"turn on/off marking of directories with an arrow. |
|
360 |
The default is on" |
|
361 |
||
362 |
markDirectories := aBoolean |
|
363 |
! |
|
364 |
||
193 | 365 |
matchBlock:aBlock |
366 |
"set the matchBlock - if non-nil, it controls which |
|
367 |
names are shown in the list." |
|
368 |
||
369 |
matchBlock := aBlock |
|
370 |
! |
|
371 |
||
77 | 372 |
pattern:aPattern |
373 |
"set the pattern - if it changes, update the list." |
|
21 | 374 |
|
77 | 375 |
pattern ~= aPattern ifTrue:[ |
376 |
pattern := aPattern. |
|
377 |
realized ifTrue:[ |
|
378 |
self updateList |
|
379 |
]. |
|
380 |
]. |
|
381 |
! |
|
382 |
||
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
383 |
quickDirectoryChange:aBoolean |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
384 |
"set/clear quick change (i.e. chdir with single click). |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
385 |
The default is false (i.e. double click is required)" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
386 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
387 |
quickDirectoryChange := aBoolean |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
388 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
389 |
"Created: 4.3.1996 / 17:37:58 / cg" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
390 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
391 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
392 |
stayInDirectory:aBoolean |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
393 |
"set/clear the flag which controls if selecting a directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
394 |
should locally change (if false) or be handled just like |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
395 |
the selection of a file (if true). |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
396 |
The default is false (i.e. change and do not tell via action)" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
397 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
398 |
stayInDirectory := aBoolean |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
399 |
! ! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
400 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
401 |
!FileSelectionList methodsFor:'accessing-contents'! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
402 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
403 |
directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
404 |
"return the shown directory" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
405 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
406 |
^ directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
407 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
408 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
409 |
directory:nameOrDirectory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
410 |
"set the lists contents to the filenames in the directory. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
411 |
This does not validate the change with any directoryChangeBlock." |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
412 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
413 |
|oldPath name| |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
414 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
415 |
nameOrDirectory isString ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
416 |
name := nameOrDirectory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
417 |
] ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
418 |
nameOrDirectory isNil ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
419 |
directory := nil. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
420 |
^ self updateList |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
421 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
422 |
name := nameOrDirectory pathName |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
423 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
424 |
directory isNil ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
425 |
directory := FileDirectory new. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
426 |
oldPath := nil |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
427 |
] ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
428 |
oldPath := directory pathName. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
429 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
430 |
directory pathName:name. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
431 |
realized ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
432 |
(directory pathName = oldPath) ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
433 |
self updateList |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
434 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
435 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
436 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
437 |
|
77 | 438 |
selectedPathname |
439 |
"if there is a selection, return its full pathname. |
|
440 |
Of there is no selection, return nil." |
|
441 |
||
442 |
|sel| |
|
443 |
||
444 |
sel := self selectionValue. |
|
445 |
sel isNil ifTrue:[^ nil]. |
|
446 |
^ directory pathName , Filename separator asString , sel. |
|
447 |
||
193 | 448 |
! ! |
449 |
||
450 |
!FileSelectionList methodsFor:'drawing'! |
|
451 |
||
452 |
redrawFromVisibleLine:startVisLineNr to:endVisLineNr |
|
453 |
"redefined to look for directory in every line" |
|
454 |
||
455 |
|l| |
|
456 |
||
457 |
"first, draw chunk of lines" |
|
458 |
super redrawFromVisibleLine:startVisLineNr to:endVisLineNr. |
|
282 | 459 |
markDirectories ifFalse:[^ self]. |
193 | 460 |
|
461 |
"then draw marks" |
|
462 |
startVisLineNr to:endVisLineNr do:[:visLineNr | |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
463 |
l := self visibleLineToListLine:visLineNr. |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
464 |
l notNil ifTrue:[ |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
465 |
(fileTypes at:l) == #directory ifTrue:[ |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
466 |
self drawRightArrowInVisibleLine:visLineNr |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
467 |
] |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
468 |
] |
193 | 469 |
] |
470 |
! |
|
471 |
||
472 |
redrawVisibleLine:visLineNr |
|
473 |
"if the line is one for a directory, draw a right arrow" |
|
474 |
||
475 |
|l| |
|
476 |
||
477 |
super redrawVisibleLine:visLineNr. |
|
282 | 478 |
markDirectories ifFalse:[^ self]. |
479 |
||
193 | 480 |
l := self visibleLineToListLine:visLineNr. |
481 |
l notNil ifTrue:[ |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
482 |
(fileTypes at:l) == #directory ifTrue:[ |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
483 |
self drawRightArrowInVisibleLine:visLineNr |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
484 |
] |
193 | 485 |
] |
486 |
! ! |
|
487 |
||
329
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
488 |
!FileSelectionList methodsFor:'events'! |
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
489 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
490 |
doubleClicked |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
491 |
self selectionIsDirectory ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
492 |
stayInDirectory not ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
493 |
quickDirectoryChange ifFalse:[ |
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
494 |
directoryChangeAction notNil ifTrue:[ |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
495 |
directoryChangeAction value:self selection |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
496 |
] ifFalse:[ |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
497 |
self changeDirectory |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
498 |
] |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
499 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
500 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
501 |
^ self |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
502 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
503 |
super doubleClicked |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
504 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
505 |
"Created: 4.3.1996 / 17:39:58 / cg" |
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
506 |
"Modified: 5.3.1996 / 02:38:06 / cg" |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
507 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
508 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
509 |
selectionChanged |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
510 |
"if the selection changed, check for it being a directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
511 |
and possibly go there. If its not a directory, perform the realAction." |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
512 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
513 |
self selection isCollection ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
514 |
self selectionIsDirectory ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
515 |
(stayInDirectory not and:[quickDirectoryChange]) ifTrue:[ |
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
516 |
directoryChangeAction notNil ifTrue:[ |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
517 |
directoryChangeAction value:self selection |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
518 |
] ifFalse:[ |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
519 |
self changeDirectory |
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
520 |
] |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
521 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
522 |
] ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
523 |
realAction notNil ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
524 |
realAction value:self selection |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
525 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
526 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
527 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
528 |
|
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
529 |
"Modified: 5.3.1996 / 02:37:58 / cg" |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
530 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
531 |
|
329
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
532 |
sizeChanged:how |
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
533 |
"redraw marks if any" |
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
534 |
|
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
535 |
super sizeChanged:how. |
338 | 536 |
(shown and:[markDirectories]) ifTrue:[ |
330 | 537 |
self redraw |
538 |
] |
|
329
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
539 |
! ! |
dc3de413de73
redraw directoryMarks if size changes
Claus Gittinger <cg@exept.de>
parents:
296
diff
changeset
|
540 |
|
193 | 541 |
!FileSelectionList methodsFor:'initialization'! |
542 |
||
543 |
initialize |
|
544 |
directory := FileDirectory currentDirectory. |
|
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
545 |
stayInDirectory := ignoreParentDirectory := ignoreDirectories := false. |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
546 |
quickDirectoryChange := false. |
282 | 547 |
markDirectories := true. |
193 | 548 |
super initialize. |
77 | 549 |
|
193 | 550 |
pattern := '*'. |
551 |
self initializeAction. |
|
552 |
||
553 |
"nontypical use ..." |
|
554 |
" |
|
555 |
FileSelectionList new open |
|
556 |
(FileSelectionList new directory:'/etc') open |
|
557 |
(ScrollableView for:FileSelectionList) open |
|
558 |
(HVScrollableView for:FileSelectionList) open |
|
559 |
" |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
560 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
561 |
"Modified: 4.3.1996 / 17:36:29 / cg" |
193 | 562 |
! |
563 |
||
564 |
initializeAction |
|
565 |
"setup action as: selections in list get forwarded to enterfield if not |
|
566 |
a directory; otherwise directory is changed" |
|
567 |
||
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
568 |
actionBlock := [:lineNr | self selectionChanged]. |
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
569 |
"/ doubleClickActionBlock := [:lineNr | self selectionChanged]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
570 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
571 |
"Modified: 4.3.1996 / 17:39:08 / cg" |
193 | 572 |
! |
573 |
||
574 |
reinitialize |
|
575 |
directory := FileDirectory currentDirectory. |
|
576 |
super reinitialize |
|
21 | 577 |
! ! |
578 |
||
11 | 579 |
!FileSelectionList methodsFor:'private'! |
580 |
||
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
581 |
changeDirectory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
582 |
"change directory to the selected one" |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
583 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
584 |
|entry ok newDir warnMessage oldDir| |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
585 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
586 |
entry := self selectionValue. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
587 |
(entry isNil or:[entry isEmpty]) ifTrue:[ ^ false]. |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
588 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
589 |
(entry endsWith:' ...') ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
590 |
entry := entry copyWithoutLast:4. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
591 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
592 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
593 |
ok := false. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
594 |
oldDir := directory pathName asFilename baseName. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
595 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
596 |
newDir := directory pathName , Filename separator asString , entry. |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
597 |
|
467
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
598 |
(directoryChangeCheckBlock isNil |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
599 |
or:[directoryChangeCheckBlock value:newDir]) ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
600 |
(directory isReadable:entry) ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
601 |
warnMessage := 'not allowed to read directory %1' |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
602 |
] ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
603 |
(directory isExecutable:entry) ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
604 |
warnMessage := 'not allowed to change to directory %1' |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
605 |
] ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
606 |
ok := true. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
607 |
] |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
608 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
609 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
610 |
ok ifFalse:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
611 |
warnMessage notNil ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
612 |
self warn:(resources string:warnMessage with:entry). |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
613 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
614 |
self deselect |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
615 |
] ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
616 |
self directory:newDir. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
617 |
entry = '..' ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
618 |
self selectElement:oldDir |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
619 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
620 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
621 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
622 |
"Created: 4.3.1996 / 17:45:18 / cg" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
623 |
"Modified: 4.3.1996 / 18:10:17 / cg" |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
624 |
! |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
625 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
626 |
selectionIsDirectory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
627 |
|entry| |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
628 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
629 |
entry := self selectionValue. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
630 |
(entry isNil or:[entry isEmpty]) ifTrue:[ ^ false]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
631 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
632 |
(entry endsWith:' ...') ifTrue:[ |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
633 |
entry := entry copyWithoutLast:4. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
634 |
]. |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
635 |
^ (directory typeOf:entry) == #directory |
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
636 |
|
ecf956d44135
now needs double click to change directory (configurable)
Claus Gittinger <cg@exept.de>
parents:
350
diff
changeset
|
637 |
"Created: 4.3.1996 / 17:43:26 / cg" |
296
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
638 |
! |
e1b9431b3aef
more examples in the documentation category
Claus Gittinger <cg@exept.de>
parents:
287
diff
changeset
|
639 |
|
77 | 640 |
updateList |
641 |
"set the lists contents to the filenames in the directory" |
|
642 |
||
350 | 643 |
|oldCursor files newList index path obsolete matching patternList| |
77 | 644 |
|
645 |
directory isNil ifTrue:[ |
|
350 | 646 |
super list:nil. |
647 |
files := newList := fileTypes := nil. |
|
648 |
^ self |
|
77 | 649 |
]. |
650 |
||
651 |
oldCursor := cursor. |
|
652 |
self cursor:(Cursor read). |
|
653 |
||
654 |
" |
|
655 |
if the directory-id changed, MUST update. |
|
656 |
(can happen after a restart, when a file is no longer |
|
657 |
there, has moved or is NFS-mounted differently) |
|
658 |
" |
|
287 | 659 |
obsolete := directoryId ~~ directory id |
350 | 660 |
or:[directoryName ~= directory pathName |
661 |
or:[timeStamp notNil |
|
662 |
and:[directory timeOfLastChange > timeStamp]]]. |
|
287 | 663 |
|
664 |
obsolete ifTrue:[ |
|
350 | 665 |
timeStamp := directory timeOfLastChange. |
666 |
directoryId := directory id. |
|
667 |
directoryName := directory pathName. |
|
668 |
directoryContents := directory asStringCollection sort. |
|
669 |
directoryFileTypes := OrderedCollection new. |
|
670 |
directoryContents do:[:name | directoryFileTypes add:(directory typeOf:name)]. |
|
77 | 671 |
]. |
672 |
||
673 |
files := directoryContents. |
|
674 |
newList := OrderedCollection new. |
|
675 |
fileTypes := OrderedCollection new. |
|
676 |
index := 1. |
|
677 |
||
95 | 678 |
path := directory pathName , Filename separator asString. |
679 |
files do:[:name | |
|
350 | 680 |
|type| |
77 | 681 |
|
350 | 682 |
(matchBlock isNil or:[matchBlock value:(path , name)]) ifTrue:[ |
683 |
type := directoryFileTypes at:index. |
|
684 |
type == #directory ifTrue:[ |
|
685 |
ignoreDirectories ifFalse:[ |
|
686 |
name = '..' ifTrue:[ |
|
687 |
ignoreParentDirectory ifFalse:[ |
|
688 |
newList add:name. |
|
689 |
fileTypes add:type |
|
690 |
] |
|
691 |
] ifFalse:[ |
|
692 |
name = '.' ifTrue:[ |
|
693 |
"ignore" |
|
694 |
] ifFalse:[ |
|
695 |
newList add:(name ", ' ...'"). |
|
696 |
fileTypes add:type |
|
697 |
] |
|
698 |
] |
|
699 |
] |
|
700 |
] ifFalse:[ |
|
701 |
matching := true. |
|
702 |
||
703 |
(pattern isNil |
|
704 |
or:[pattern isEmpty]) ifFalse:[ |
|
705 |
pattern = '*' ifFalse:[ |
|
706 |
(pattern includes:$;) ifTrue:[ |
|
707 |
patternList := pattern asCollectionOfSubstringsSeparatedBy:$;. |
|
708 |
matching := (patternList findFirst:[:subPattern | subPattern match:name]) ~~ 0. |
|
709 |
] ifFalse:[ |
|
710 |
matching := pattern match:name |
|
711 |
] |
|
712 |
] |
|
713 |
]. |
|
714 |
||
715 |
matching ifTrue:[ |
|
716 |
newList add:name. |
|
717 |
fileTypes add:type |
|
718 |
] |
|
719 |
]. |
|
720 |
]. |
|
721 |
index := index + 1 |
|
77 | 722 |
]. |
723 |
super list:newList. |
|
95 | 724 |
|
77 | 725 |
self cursor:oldCursor. |
726 |
! |
|
727 |
||
21 | 728 |
visibleLineNeedsSpecialCare:visLineNr |
729 |
|l| |
|
730 |
||
731 |
l := self visibleLineToListLine:visLineNr. |
|
732 |
l notNil ifTrue:[ |
|
62 | 733 |
(fileTypes at:l) == #directory ifTrue:[^ true]. |
734 |
^ super visibleLineNeedsSpecialCare:visLineNr |
|
21 | 735 |
]. |
736 |
^ false |
|
737 |
! |
|
738 |
||
193 | 739 |
widthForScrollBetween:firstLine and:lastLine |
740 |
"return the width in pixels for a scroll between firstLine and lastLine |
|
741 |
- return full width here since there might be directory marks" |
|
11 | 742 |
|
193 | 743 |
^ (width - margin - margin) |
11 | 744 |
! ! |
745 |
||
746 |
!FileSelectionList methodsFor:'realization'! |
|
747 |
||
748 |
realize |
|
749 |
"make the view visible; redefined to check if directory is still |
|
750 |
valid (using timestamp and inode numbers) - reread if not" |
|
751 |
||
752 |
(timeStamp isNil |
|
753 |
or:[(directory timeOfLastChange > timeStamp) |
|
754 |
or:[(directoryId isNil) |
|
755 |
or:[directoryId ~~ directory id]]]) ifTrue:[ |
|
62 | 756 |
directoryId := nil. |
757 |
self updateList |
|
11 | 758 |
]. |
759 |
super realize |
|
760 |
! ! |
|
77 | 761 |
|
282 | 762 |
!FileSelectionList class methodsFor:'documentation'! |
763 |
||
764 |
version |
|
472
17f795e6ecba
added a separate directoryChangeAction
Claus Gittinger <cg@exept.de>
parents:
467
diff
changeset
|
765 |
^ '$Header: /cvs/stx/stx/libwidg/FileSelectionList.st,v 1.26 1996-03-05 01:38:29 cg Exp $' |
282 | 766 |
! ! |