cvsimport
[fvwm-themes.git] / scripts / FvwmScript-ComponentProperties
blob237cd36cf99571a96e109f4dd24f02a6db722a5c
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 # Copyright 2000, Olivier Chapuis
18 #-----------------------------------------------------------------------------
21 WindowTitle {FVWM Themes: Component Properties}
22 WindowSize 320 300
23 Font            -adobe-helvetica-bold-r-*-*-12-*
25 Init
26 Begin
28     # --------------------------------------- Arguments
29     Set $ID = 0
30     Set $i = 1
31     Set $arg = (GetScriptArgument $i)
32     While $arg <> {} Do
33     Begin
34         Set $j = (Add $i 1)
35         If $arg == {--session} Then
36             Set $Session = (GetScriptArgument $j)
37         If $arg == {--viewer-colorset} Then
38             Set $ViewerColorset = (GetScriptArgument $j)
39         If $arg == {--text-colorset} Then
40             Set $TextColorset = (GetScriptArgument $j)
41         If $arg == {--icon-colorset} Then
42             Set $IconColorset = (GetScriptArgument $j)
43         If $arg == {--com-pid} Then
44             Set $pid = (GetScriptArgument $j)
45         If $arg == {--component} Then
46             Set $MainComponent = (GetScriptArgument $j)
47         If $arg == {--theme} Then
48             Set $MainTheme = (GetScriptArgument $j)
49         If $arg == {--lang} Then
50             Set $Lang = (GetScriptArgument $j)
51         If $arg == {--id} Then
52             Set $ID = (GetScriptArgument $j)
53         Set $i = (Add $i 2)
54         Set $arg = (GetScriptArgument $i)
55     End
57     If $TextColorset <> {} Then
58     Begin
59         ChangeColorset 5 $TextColorset
60     End
62     #Set $Lang = {en}
63     #Set $Lang = {ru}
64     # ------------------------------- Internationalization. 
65     If $Lang == {} Then
66     Begin
67         Set $cmd = {echo "$LANG" | cut -c1-2}
68         Set $Lang = (GetOutput $cmd 1 -1)
69     End
70     If $Lang == {} Then
71         Set $Lang = {C}
73     Set $msg = {}
74     Set $id = {}
75     Set $cmd = {fvwm-themes-script --get-msg FvwmScript-ComponentProperties --lang }$Lang
76     Set $MSG = (GetOutput $cmd 1 -1)
77     Set $index = 0
78     Set $notdone = 1
79     While $notdone == 1 Do
80     Begin
81         Set $index = (Add $index 1)
82         Set $id = (StrCopy $MSG $index (Add $index 11))
83         Set $index = (Add $index 12)
84         Set $tmp = (StrCopy $MSG $index (Add $index 3))
85         Set $index = (Add $index 4)
86         Set $pos = (Add $index $tmp)
87         Set $msg = (StrCopy $MSG $index $pos)
88         Set $index = (Add $index $tmp)
89         #Do {Echo id:}$id{:msg:}$msg{:}
91         If $index > 9999 Then
92             Set $notdone = 0
93         If $id == {END         } Then
94             Set $notdone = 0
95         If $id == {} Then
96             Set $notdone = 0
98         If $id == {SendModif   } Then
99             ChangeTitle 6 $msg
100         If $id == {Set         } Then
101             ChangeTitle 97 $msg
102         If $id == {SetQuit     } Then
103             ChangeTitle 98 $msg
104         If $id == {Quit        } Then
105             ChangeTitle 99 $msg
106         If $id == {for         } Then
107             Set $l_for = $msg
108         If $id == {ChangeFont  } Then
109             Set $ChangeFont = $msg
110         If $id == {SelFont     } Then
111             Set $SelFont = $msg
112         If $id == {ShadeFont   } Then
113             Set $ShadeFont = $msg
114         If $id == {FixedFont   } Then
115             Set $FixedFont = $msg
116         End
118     If $ChangeFont == 1 Then
119     Begin
120         ChangeFont 1 $SelFont
121         ChangeFont 2 $SelFont
122         ChangeFont 3 $SelFont
123         ChangeFont 5 $FixedFont
124         ChangeFont 6 $SelFont
125         ChangeFont 97 $SelFont
126         ChangeFont 98 $SelFont
127         ChangeFont 99 $SelFont
128     End
130     # ------------------------------------- com and init
131     Set $ComName =  {config-}$pid
132     # Get all the options and the first list
133     Set $cmd = {options }$MainComponent{ }$MainTheme{ 0|}
134     Set $MSG = (SendMsgAndGet $ComName $cmd 1)
135     Set $NbrOfOptions= (Parse $MSG 1)
136     Set $Type = (Parse $MSG 2)
137     Set $tmp = $Type{ }$l_for{ }$MainComponent{@}$MainTheme
138     ChangeTitle 1 $tmp
139     Set $Options = (Parse $MSG 3)
140     Set $CurrentVariants = (Parse $MSG 4)
141     ChangeTitle 5 $CurrentVariants
143     If $NbrOfOptions == 1 Then
144     Begin
145         HideWidget3
146         ChangeTitle 2 $Options
147     End
148     Else
149     Begin
150         HideWidget 2
151         ChangeTitle 3 $Options
152     End
154     # Get the "current" options List
155     Set $CurrentOptionsIndex = 1
156     Set $UpdateList = 0
158     # the selected option
159     Set $OptionIndex = 0
161     Set $SendUpdateMsg = 0
162     HideWidget 6
163     # send our pid
164     Set $myPid = (GetPid)
165     Set $cmd = {add-to-pid-list }$ID{ }$myPid{|}
166     Set $dummy = (SendMsgAndGet $ComName $cmd 0)
169 # ---------------------------------------------------------------------------
171 # Now the widgets
173 # ---------------------------------------------------------------------------
175 Widget 1
176 Property
177     Flags NoReliefString NoFocus
178     Position 20 5
179     Size 280 20 
180     Type ItemDraw
181     Title {}
182 Main
183 Case message of
185 SingleClic :
186  Begin
187  End
189 # message from FvwmScript-ThemesCenter
190 1 :
191  Begin
192     Set $str = (LastString)
193     If $str == {exit} Then
194     Begin
195         Quit
196     End
197     If $str == {update} Then
198     Begin
199         #Set $UpdateList = 1
200         SendSignal 1 2
201     End
202     Set $str = {}
203  End
205 # Update the list
206 2 :
207  Begin
208     Set $cmd = {options-variants }$MainComponent{ }$MainTheme{ }$CurrentOptionsIndex{|}
209     Set $tmp = {}
210     Set $count = 0
211     While $tmp == {} Do
212     Begin
213         Set $tmp = (SendMsgAndGet $ComName $cmd 1)
214         Set $count = (Add $count 1)
215         If $count == 10 Then
216         Begin
217             If $tmp == {} Then
218                 Set $tmp = {0}
219         End
220     End
221     Set $CurrentVariants = $tmp
222     ChangeTitle 5 $CurrentVariants
223  End
225 # send msg
226 3 :
227  Begin
228     If $SendUpdateMsg == 1 Then
229     Begin
230         Set $SendUpdateMsg = 0
231         Set $str = $ID{update}
232         Do {SendToModule FvwmScript-ThemesCenter SendString 1 1 }$str
233     End
234     If $SendUpdateQuit == 1 Then
235     Begin
236         Set $SendUpdateQuit = 0
237         Set $str = $ID{updatequit}
238         Do {SendToModule FvwmScript-ThemesCenter SendString 1 1 }$str
239         Set $cmd = {remove-to-pid-list }$ID{ }$myPid{|}
240         Set $dummy = (SendMsgAndGet $ComName $cmd 0)
241         Quit
242     End
243     If $SendQuit == 1 Then
244     Begin
245         Set $SendQuit = 0
246         Set $str = $ID{quit}
247         Do {SendToModule FvwmScript-ThemesCenter SendString 1 1 }$str
248         Set $cmd = {remove-to-pid-list }$ID{ }$myPid{|}
249         Set $dummy = (SendMsgAndGet $ComName $cmd 0)
250         Quit
251     End
252     Set $str = {}
253  End
256 Widget 2
257 Property
258     Flags NoReliefString NoFocus
259     Position 20 35
260     Size 280 20 
261     Type ItemDraw
262     Title {}
263 Main
264 Case message of
265     SingleClic :
266     Begin
267     End
270 Widget 3
271 Property
272     Flags NoReliefString
273     Position 20 35
274     Size 240 20 
275     Type PopupMenu
276     Title {Test Option                          }
277 Main
278 Case message of
279 SingleClic :
280  Begin
281     Set $value = (GetValue 3)
282     If $value <> $CurrentOptionsIndex Then
283     Begin
284         Set $CurrentOptionsIndex = $value
285         #Set $UpdateList = 1
286         Set $OptionIndex = 0
287         ChangeValue 5 0
288         SendSignal 1 2
289     End
290  End
293 Widget 5
294 Property
295     Flags NoReliefString
296     Position 20 65
297     Size 280 195 
298     Type List
299     Font -*-fixed-medium-r-semicondensed-*-13-*
300     Title {}
301 Main
302 Case message of
303 SingleClic :
304  Begin
305     
306  End
309 Widget 6
310 Property
311     Flags NoReliefString NoFocus
312     Position 1 35
313     Size 318 20 
314     Type ItemDraw
315     Title {}
316 Main
317 Case message of
318     SingleClic :
319     Begin
320     End
323 Widget 97
324 Property
325     Flags NoReliefString
326     Position 10 270
327     Size 90 20
328     Type PushButton
329     Title {}
330 Main
331 Case message of
332  SingleClic :
333  Begin
334     Set $OptionIndex = (GetValue 5)
335     If $OptionIndex <> 0 Then 
336     Begin
337         Set $cmd = {set-options }$MainComponent{ }$MainTheme{ }$CurrentOptionsIndex{ }$OptionIndex{|}
338         Set $dummy = (SendMsgAndGet $ComName $cmd 1)
339         #Set $UpdateList = 1
340         SendSignal 1 2
341         Set $SendUpdateMsg = 1
342         SendSignal 1 3
343     End
344     
345  End
348 Widget 98
349 Property
350     Flags NoReliefString
351     Position 115 270
352     Size 90 20
353     Type PushButton
354     Title {}
355 Main
356  Case message of
357   SingleClic :
358   Begin
359     Set $OptionIndex = (GetValue 5)
360     If $OptionIndex <> 0 Then 
361     Begin
362         Set $cmd = {set-options }$MainComponent{ }$MainTheme{ }$CurrentOptionsIndex{ }$OptionIndex{|}
363         Set $dummy = (SendMsgAndGet $ComName $cmd 1)
364     End
365     Set $SendUpdateQuit = 1
366     SendSignal 1 3
367   End
370 Widget 99
371 Property
372  Flags NoReliefString
373  Position 220 270
374  Size 90 20
375  Type PushButton
376  Title {}
377 Main
378  Case message of
379   SingleClic :
380   Begin
381     Set $SendQuit = 1
382     SendSignal 1 3
383   End