cvsimport
[fvwm-themes.git] / scripts / FvwmScript-IconBrowser
blobd5314bac08ab47bb405e2f2b934d9ee9bcd96f92
1 # This script is free software; you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation; either version 2 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program; if not, write to the Free Software
13 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16 #-----------------------------------------------------------------------------
17 # This fvwm-themes "module" is a modification of FvwmScript-FileBrowser
18 # from fvwm (in fact rewrote from scratch ...)
19 #     Copyright 2000, Olivier Chapuis
20 #-----------------------------------------------------------------------------
22 # Note : the mode list is not yet supported!
24 WindowTitle {Icon Browser}
25 WindowSize 390 430              # Taille
26 Font            -adobe-helvetica-bold-r-*-*-12-*
28 Init
29 Begin
30     # Name of the "utile" perl script
31     Set $PerlUtile={fvwm-themes-script }
33     # Arguments
34     Set $LsOptions = {1F}
35     Set $hidden = {}
36     Set $Type = {}
37     Set $Mode = {browser}
38     Set $i = 1
39     Set $ARG = (GetScriptArgument $i)
40     Set $Launched = 1
42     While $ARG <> {} Do
43     Begin
44         Set $j = (Add $i 1)
45         If $ARG == {--dir} Then
46             Set $Directory = (GetScriptArgument $j)
47         If $ARG == {--mode} Then
48             Set $Mode = (GetScriptArgument $j)
49         If $ARG == {--ls-options} Then
50             Set $LsOptions = $LsOptions (GetScriptArgument $j)
51         If $ARG == {--text-colorset} Then
52             Set $TextColorset = (GetScriptArgument $j)
53         If $ARG == {--icon-colorset} Then
54             Set $ICON_COLORSET = (GetScriptArgument $j)
55         If $ARG == {--list-title} Then
56             Set $ListTitle = (GetScriptArgument $j)
57         If $ARG == {--launched} Then
58             Set $Launched = (GetScriptArgument $j)
59         Set $i = (Add $i 2)
60         Set $ARG = (GetScriptArgument $i)
61     End
63     If $Launched == 1 Then
64         Do {Style "FvwmScript-IconBrowser" StaysOnTop, NoHandles}
65     Else
66         Do {Style "FvwmScript-IconBrowser" StaysPut, NoHandles}
68     If $TextColorset <> {} Then
69     Begin
70         ChangeColorset 5 $TextColorset
71         ChangeColorset 7 $TextColorset
72     End
73     If $ICON_COLORSET <> {} Then
74     Begin
75         ChangeColorset 8 $ICON_COLORSET
76     End
78     If $Mode == {list} Then
79     Begin
80         Set $UpdateList = 1
81         HideWidget 5
82         HideWidget 4
83         HideWidget 6
84         HideWidget 11
85         HideWidget 12
86         ChangeTitle 20 $ListTitle
87         Set $Type = {file}
88     End
89     
90     If $Mode == {browser} Then
91     Begin
92         Set $UpdateList = 1
93         Set $CMD={cd } $Directory{; pwd}
94         Set $Directory=(GetOutput $CMD 1 -1)
95         ChangeTitle 7 $List
96         ChangeTitle 5 $Directory
97         ChangeTitle 9 {}
98         HideWidget 20
99     End
103 PeriodicTasks
104 Begin
105     If $UpdateValue == 1 Then
106     Begin
107         Set $UpdateValue = 0
108         Set $CMD = $PerlUtile {--dirs="}$Directory{" --ls --ls-opt=-"}$LsOptions $hidden{" --item=}$Value{ --type="}$Type{"}
109         Set $TheItem = (GetOutput $CMD 1 -1)
110         Set $CMD = {if [ -d "}$Directory {/} $TheItem{" ]; then echo 1; else echo 0; fi}
111         Set $test = (GetOutput $CMD 1 -1)
112         If $test == 1 Then
113         Begin
114             Set $UpdateList = 1
115             Set $Directory = $Directory {/} $TheItem
116             Set $CMD={cd } $Directory{; pwd}
117             Set $Directory=(GetOutput $CMD 1 -1)
118             ChangeTitle 5 $Directory
119             ChangeTitle 9 {}
120             ChangeIcon 8 mini/empty.xpm
121         End
122         Else
123         Begin
124             ChangeTitle 9 $TheItem
125             Set $Icon = $Directory {/} $TheItem
126             ChangeIcon 8 $Icon
127         End
128     End
130     If $UpdateList == 1 Then
131     Begin
132         Set $UpdateList = 0
133         Set $GetListCmd= $PerlUtile {--dirs="}$Directory{" --ls --ls-opt="-}$LsOptions $hidden{" --type="}$Type{"}
134         Set $List = (GetOutput $GetListCmd 1 -1)
135         ChangeTitle 7 $List
136         ChangeTitle 5 $Directory
137         ChangeTitle 9 {}
138         ChangeIcon 8 mini/empty.xpm
139         ChangeValue 7 0
140     End
144 Widget 1
145 Property
146  Size 80 20
147  Position 60 390
148  Type PushButton
149  Flags NoReliefString
150  Title {OK}
151 Main
152  Case message of
153  SingleClic :
154  Begin
155     If $Launched == 1 Then
156     Begin
157         If $Mode == {list} Then
158             SendToScript (GetScriptFather) (GetTitle 9)
159         Else
160             SendToScript (GetScriptFather) $Directory {/} (GetTitle 9)
161     End
162     Quit
163   End
166 Widget 2
167 Property
168  Size 80 20
169  Position 250 390
170  Type PushButton
171  Flags NoReliefString
172  Title {Cancel}
173 Main
174  Case message of
175  SingleClic :
176  Begin
177     If $Launched == 1 Then
178         SendToScript (GetScriptFather) {Cancel}
179     Quit
180   End
183 Widget 3
184 Property
185  Position 10 10
186  Size 370 370
187  Type Rectangle
188 Main
189  Case message of
190   SingleClic :
191   Begin
192   End
195 Widget 4
196 Property
197  Position 20 25
198  Type PushButton
199  Flags NoReliefString
200  Title {Path:}
201 Main
202  Case message of
203   SingleClic :
204   Begin
205     Set $Directory = (GetTitle 5)
206     Set $UpdateList = 1
207   End
210 Widget 5
211 Property
212  Position 75 25
213  Size 295 0
214  Font -*-fixed-medium-r-semicondensed-*-13-*
215  Type TextField
216  Flags NoReliefString
217  Title {}
218 Main
219  Case message of
220   SingleClic :
221   Begin
222   End
225 Widget 20
226 Property
227  Position 20 45
228  Size 320 20
229  Type ItemDraw
230  Flags NoReliefString
231  Title {All Applications in Path}
232 Main
233  Case message of
234  SingleClic :
235  Begin
236  End
239 Widget 6
240 Property
241  Position 40 62
242  Size 50 18
243  Flags NoReliefString
244  Title {up}
245  #Icon up.xpm
246  Type PushButton
247 Main
248  Case message of
249   SingleClic :
250   Begin
251     Set $CMD={cd } $Directory {; cd ../; pwd}
252     Set $Directory=(GetOutput $CMD 1 -1)
253     Set $UpdateList = 1
254   End
257 Widget 11
258 Property
259  Position 110 62
260  Size 50 18
261  Flags NoReliefString
262  Title {home}
263  #Icon home.xpm
264  Type PushButton
265 Main
266  Case message of
267   SingleClic :
268   Begin
269     Set $Directory={~/}
270     Set $CMD={cd } $Directory{; pwd}
271     Set $Directory=(GetOutput $CMD 1 -1)
272     Set $UpdateList = 1
273   End
276 Widget 12
277 Property
278  Position 200 67
279  Type CheckBox
280  Flags NoReliefString
281  Title { Show hidden files}
282 Main
283  Case message of
284  SingleClic :
285  Begin
286     If (GetValue 12) == 1 Then
287         Set $hidden={A}
288     Else
289         Set $hidden={ }
290     Set $UpdateList = 1   
291  End
294 Widget 7
295 Property
296  Position 30 105
297  Size 330 165
298  Type List
299  Font -*-fixed-medium-r-semicondensed-*-13-*
300  Flags NoReliefString
301  Title {}
302 Main
303  Case message of
304  SingleClic :
305  Begin
306     Set $Value = (GetValue 7)
307     Set $UpdateValue = 1
308  End
311 Widget 8
312 Property
313  Position 160 280
314  Size 70 70
315  Type ItemDraw
316  Icon mini/empty.xpm
317 Main
318  Case message of
319   SingleClic :
320   Begin
321   End
324 Widget 9
325 Property
326  Position 30 355
327  Size 330 20
328  Type ItemDraw
329  Flags NoReliefString
330  Title {}
331 Main
332  Case message of
333   SingleClic :
334   Begin
335   End