Documentation update.
[wine] / tools / wineconf.libs / wineconf.tcl
1 proc TkW:wineconf {DefaultConfFile} {
2         global WC_banner WC_driveSect WC_path WC_type WC_label  WC_fstype 
3         global EDIT SAVE REMOVE ADD WC_wineSect WC_windows  WC_system WC_temp
4         global WC_Symbols  WC_winepath WC_serialSect CLEAR WC_parallelSect
5         global WC_logSect WC_exclude WC_wineLook
6         global windowspath varpath syspath tmppath symbols winelook
7         global ndrives drive drivepath drivetype drivefstype drivelabel
8         global drivedevice driveserial
9         global resolution defaultfont 
10         global readport writeport TKW WAITconf
11         global exclude default_progs startup allocsyscolors winelook wine_logfile
12         global com lpt spool nspool alias nalias
13         global WC_helpondrives WC_helponwine WC_helponserial WC_helponPP
14         global WC_helponmisc WAIT WC_quit WC_quit
15         global WC_quitreally WC_noquit
16         if {[winfo exist .choosemethod] } {destroy .choosemethod}
17         if {[winfo exist .install] } {destroy .install}
18     set base .wineconf
19     if {[winfo exists .wineconf]} {
20         wm deiconify .wineconf; return
21     }
22     ###################
23     # CREATING WIDGETS
24     ###################
25     toplevel .wineconf -class Toplevel \
26         -background #3c1cfe 
27     wm focusmodel .wineconf passive
28     wm geometry .wineconf 462x600+148+153
29     wm maxsize .wineconf 1265 994
30     wm minsize .wineconf 1 1
31     wm overrideredirect .wineconf 0
32     wm resizable .wineconf 1 1
33     wm deiconify .wineconf
34     wm title .wineconf "TkWineSetup Configuring Wine"
35     #wm iconbitmap .wineconf @$TKW/setupfiles/images/setup2.xbm
36     #wm iconmask   .wineconf @$TKW/setupfiles/images/setupmask2.xbm
37
38     label .wineconf.lab18 \
39         -background #fcfefe \
40         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
41         -relief groove -text label -textvariable WC_banner 
42     canvas .wineconf.can01 \
43         -background #fee0b4 -borderwidth 2 -height 207 -relief ridge \
44         -width 296 
45     label .wineconf.can01.lab22 \
46         -background #fefefe \
47         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
48         -relief groove -text label -textvariable WC_drivesSect 
49     listbox .wineconf.can01.lis23 \
50         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
51         -yscrollcommand {.wineconf.can01.scrDrives set }
52     scrollbar .wineconf.can01.scrDrives \
53         -borderwidth 1 -orient vert -width 10 \
54         -command { .wineconf.can01.lis23 yview }
55     listbox .wineconf.can01.lis24 \
56         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
57     listbox .wineconf.can01.lis25 \
58         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
59     listbox .wineconf.can01.lis26 \
60         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
61     button .wineconf.can01.but28 \
62         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
63         -pady 3 -text button -textvariable ADD \
64         -command {TkW:drives new}
65     button .wineconf.can01.but29 \
66         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
67         -pady 3 -state disabled -text button -textvariable REMOVE \
68         -command {TkW:delDrive $sel_drive}
69     button .wineconf.can01.but30 \
70         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
71         -pady 3 -state disabled -text button -textvariable EDIT \
72         -command {TkW:drives $sel_drive}
73     label .wineconf.can01.lab31 \
74         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
75         -relief groove -text label -textvariable WC_path 
76     label .wineconf.can01.lab32 \
77         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
78         -relief groove -text label -textvariable WC_type 
79     label .wineconf.can01.lab33 \
80         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
81         -relief groove -text label -textvariable WC_label 
82     label .wineconf.can01.lab34 \
83         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
84         -relief groove -text label -textvariable WC_fstype 
85     button .wineconf.can01.but51 \
86         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
87         -pady 3 -text button -textvariable HELP \
88         -command {TkW:message $WC_helpondrives}
89
90
91 #section wine
92
93     canvas .wineconf.can37 \
94         -background #fedcdc -borderwidth 2 -height 207 -relief ridge \
95         -width 296 
96     label .wineconf.can37.lab39 \
97         -background #fefefe \
98         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
99         -relief groove -text label -textvariable WC_wineSect 
100     label .wineconf.can37.lab40 \
101         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
102         -relief groove -text label -textvariable WC_windows 
103     label .wineconf.can37.lab41 \
104         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
105         -relief groove -text label -textvariable WC_system 
106     button .wineconf.can37.but42 \
107         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
108         -relief groove -textvariable WC_winepath \
109         -command TkW:editWinePath
110
111     button .wineconf.can37.but43 \
112         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
113         -pady 3 -text button -textvariable HELP \
114         -command {TkW:message $WC_helponwine}
115     entry .wineconf.can37.ent45 \
116         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
117         -textvariable windowspath 
118     entry .wineconf.can37.ent46 \
119         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
120         -textvariable syspath 
121     label .wineconf.can37.lab47 \
122         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
123         -relief groove -text label -textvariable WC_temp 
124     label .wineconf.can37.lab48 \
125         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
126         -relief groove -text label -textvariable WC_Symbols 
127     entry .wineconf.can37.ent49 \
128         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
129         -textvariable tmppath 
130     entry .wineconf.can37.ent50 \
131         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
132         -textvariable symbols
133
134 # section serialports
135     canvas .wineconf.can53 \
136         -background #fedcdc -borderwidth 2 -relief ridge 
137     label .wineconf.can53.lab57 \
138         -background #fefefe \
139         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
140         -relief groove -text label -textvariable WC_serialSect
141     listbox .wineconf.can53.lis58 \
142         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
143     listbox .wineconf.can53.lis59 \
144         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
145         -yscrollcommand {.wineconf.can53.scr60 set }
146     scrollbar .wineconf.can53.scr60 \
147         -borderwidth 1 -orient vert -width 10 \
148         -command { .wineconf.can53.lis59 yview }
149     button .wineconf.can53.but63 \
150         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
151         -pady 3 -text button -textvariable EDIT \
152         -command {TkW:editports com}
153     button .wineconf.can53.but64 \
154         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
155         -pady 3 -text button -textvariable CLEAR  -state disabled \
156         -command {
157                 set com([expr $sel_com + 1]) " "
158                 TkW:setboxes 
159                 .wineconf.can53.but64 configure -state disabled
160         }
161      button .wineconf.can53.help \
162         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
163         -pady 3 -text button -textvariable HELP\
164         -command {TkW:message $WC_helponserial}
165
166 #section parallelports
167     canvas .wineconf.can54 \
168         -background #fedcdc -borderwidth 2 -relief ridge 
169     label .wineconf.can54.lab65 \
170         -background #fefefe \
171         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
172         -relief groove -text label -textvariable WC_parallelSect 
173     listbox .wineconf.can54.lis67 \
174         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
175         -yscrollcommand {.wineconf.can54.scr71 set }
176     listbox .wineconf.can54.lis68 \
177         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
178     button .wineconf.can54.but69 \
179         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
180         -pady 3 -text button -textvariable EDIT \
181         -command {TkW:editports lpt}
182     button .wineconf.can54.but70 \
183         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
184         -pady 3 -text button -textvariable CLEAR -state disabled \
185         -command {
186                 set lpt([expr $sel_port + 1]) " "
187                 TkW:setboxes 
188                 .wineconf.can54.but70 configure -state disabled
189         }
190     scrollbar .wineconf.can54.scr71 \
191         -borderwidth 1 -orient vert -width 10 \
192         -command {.wineconf.can54.lis67 yview}
193      button .wineconf.can54.help \
194         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
195         -pady 3 -text button -textvariable HELP\
196         -command {TkW:message $WC_helponPP}
197
198 #sections spy et Tweak.Layout
199     canvas .wineconf.can55 \
200         -background #fedcdc -borderwidth 2 -height 207 -relief ridge \
201         -width 296 
202     label .wineconf.can55.lab72 \
203         -background #fefefe \
204         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
205         -relief groove -text label -textvariable WC_logSect 
206     entry .wineconf.can55.ent74 \
207         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
208         -textvariable wine_logfile
209     button .wineconf.can55.but75 \
210         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
211         -pady 3 -text button  -textvariable WC_exclude
212     label .wineconf.can55.lab76 \
213         -background #fefefe \
214         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
215         -relief groove -text label -textvariable WC_wineLook
216     menubutton .wineconf.can55.men78 \
217         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
218         -menu .wineconf.can55.men78.m -padx 4 -pady 3 -text menu \
219         -textvariable winelook 
220     menu .wineconf.can55.men78.m \
221         -cursor {} -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* 
222     .wineconf.can55.men78.m add command \
223         -command {set winelook "Win31"} -label {Win 3.1} 
224     .wineconf.can55.men78.m add command \
225         -command {set winelook "Win95"} -label win95/98 
226     .wineconf.can55.men78.m add command \
227         -command {set winelook "Win98"} -label {Win 98} 
228     button .wineconf.can55.help \
229         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
230         -pady 3 -text button  -textvariable HELP \
231         -command {TkW:message $WC_helponmisc}
232
233 #main window buttons:
234
235     button .wineconf.but80 \
236         -command {
237                 set WAIT wait
238                 TkW:message2 $WC_quit $WC_quitreally $WC_noquit 
239                 while {$WAIT == "wait"} {update}
240                 if {$WAIT == "opt1"} { if {[winfo exists .desktop]} {
241                                                 destroy .wineconf
242                                                 set WAITconf 0
243                                                 return
244                                         } else {
245                                                 exit
246                                         }
247                                 }
248         } \
249         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
250         -pady 3 -text button -textvariable QUIT 
251     button .wineconf.save \
252         -command TkW:writewinerc \
253         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* -padx 9 \
254         -pady 3 -text button -textvariable SAVE 
255     ###################
256     # SETTING GEOMETRY
257     ###################
258     place .wineconf.lab18 \
259         -x 3 -y 5 -width 453 -height 20 -anchor nw -bordermode ignore 
260
261 #placing drives sctions widgets:
262     place .wineconf.can01 \
263         -x 5 -y 35 -width 466 -height 180 -anchor nw -bordermode ignore 
264     place .wineconf.can01.lab22 \
265         -x 0 -y 0 -width 443 -height 25 -anchor nw -bordermode ignore 
266     place .wineconf.can01.lis23 \
267         -x 10 -y 56 -width 130 -height 113 -anchor nw -bordermode ignore 
268     place .wineconf.can01.lis24 \
269         -x 139 -y 55 -width 85 -height 113 -anchor nw -bordermode ignore 
270     place .wineconf.can01.lis25 \
271         -x 223 -y 55 -width 65 -height 113 -anchor nw -bordermode ignore 
272     place .wineconf.can01.lis26 \
273         -x 288 -y 55 -width 65 -height 113 -anchor nw -bordermode ignore 
274     place .wineconf.can01.scrDrives \
275         -x 353 -y 55 -width 16 -height 113 -anchor nw -bordermode ignore 
276 # bind lis23-26
277         bind  .wineconf.can01.lis23 <ButtonRelease> {
278                 set sel_drive [ .wineconf.can01.lis23 nearest %y]
279                 #enable related button
280                 .wineconf.can01.but30 configure -state normal
281                 .wineconf.can01.but29 configure -state normal
282                 # disable the tow CLEAR buttons of ports:
283                 .wineconf.can54.but70 configure -state disabled
284                 .wineconf.can53.but64 configure -state disabled
285         }
286         bind  .wineconf.can01.lis24 <ButtonRelease> {
287                 set sel_drive [ .wineconf.can01.lis23 nearest %y]
288                  .wineconf.can01.lis23 selection set $sel_drive
289                 .wineconf.can01.but30 configure -state normal
290                 .wineconf.can01.but29 configure -state normal
291                 # disable the tow CLEAR buttons of ports:
292                 .wineconf.can54.but70 configure -state disabled
293                 .wineconf.can53.but64 configure -state disabled
294         }
295         bind  .wineconf.can01.lis25 <ButtonRelease> {
296                 set sel_drive [ .wineconf.can01.lis23 nearest %y]
297                  .wineconf.can01.lis23 selection set $sel_drive
298                 .wineconf.can01.but30 configure -state normal
299                 .wineconf.can01.but29 configure -state normal
300                 # disble the tow CLEAR buttons of ports:
301                 .wineconf.can54.but70 configure -state disabled
302                 .wineconf.can53.but64 configure -state disabled
303         }
304         bind  .wineconf.can01.lis26 <ButtonRelease> {
305                 set sel_drive [ .wineconf.can01.lis23 nearest %y]
306                  .wineconf.can01.lis23 selection set $sel_drive
307                 .wineconf.can01.but30 configure -state normal
308                 .wineconf.can01.but29 configure -state normal
309                 # disble the tow CLEAR buttons of ports:
310                 .wineconf.can54.but70 configure -state disabled
311                 .wineconf.can53.but64 configure -state disabled
312         }
313     place .wineconf.can01.but28 \
314         -x 375 -y 44 -width 60 -height 28 -anchor nw -bordermode ignore 
315     place .wineconf.can01.but29 \
316         -x 375 -y 76 -width 60 -height 28 -anchor nw -bordermode ignore 
317     place .wineconf.can01.but30 \
318         -x 375 -y 110 -width 60 -height 28 -anchor nw -bordermode ignore 
319     place .wineconf.can01.lab31 \
320         -x 13 -y 36 -width 128 -height 20 -anchor nw -bordermode ignore 
321     place .wineconf.can01.lab32 \
322         -x 140 -y 36 -width 83 -height 20 -anchor nw -bordermode ignore 
323     place .wineconf.can01.lab33 \
324         -x 223 -y 36 -width 68 -height 20 -anchor nw -bordermode ignore 
325     place .wineconf.can01.lab34 \
326         -x 290 -y 36 -width 68 -height 20 -anchor nw -bordermode ignore 
327     place .wineconf.can01.but51 \
328         -x 375 -y 141 -width 60 -height 28 -anchor nw -bordermode ignore 
329
330 #placing wine sctions widgets:
331
332     place .wineconf.can37 \
333         -x 5 -y 230 -width 449 -height 115 -anchor nw -bordermode ignore 
334     place .wineconf.can37.lab39 \
335         -x 3 -y 1 -width 443 -height 20 -anchor nw -bordermode ignore 
336     place .wineconf.can37.lab40 \
337         -x 7 -y 29 -width 58 -height 20 -anchor nw -bordermode ignore 
338     place .wineconf.can37.lab41 \
339         -x 7 -y 55 -width 58 -height 20 -anchor nw -bordermode ignore 
340     place .wineconf.can37.but42 \
341         -x 7 -y 84 -width 248 -height 20 -anchor nw -bordermode ignore 
342     place .wineconf.can37.but43 \
343         -x 375 -y 80 -width 60 -height 28 -anchor nw -bordermode ignore 
344     place .wineconf.can37.ent45 \
345         -x 74 -y 26 -width 150 -height 24 -anchor nw -bordermode ignore 
346     place .wineconf.can37.ent46 \
347         -x 74 -y 52 -width 150 -height 24 -anchor nw -bordermode ignore 
348     place .wineconf.can37.lab47 \
349         -x 239 -y 29 -width 58 -height 20 -anchor nw -bordermode ignore 
350     place .wineconf.can37.lab48 \
351         -x 239 -y 54 -width 58 -height 20 -anchor nw -bordermode ignore 
352     place .wineconf.can37.ent49 \
353         -x 304 -y 26 -width 135 -height 24 -anchor nw -bordermode ignore 
354     place .wineconf.can37.ent50 \
355         -x 304 -y 52 -width 135 -height 24 -anchor nw -bordermode ignore 
356
357 #placing serialports sections widgets:
358
359     place .wineconf.can53 \
360         -x 9 -y 356 -width 144 -height 180 -anchor nw -bordermode ignore 
361     place .wineconf.can53.lab57 \
362         -x 3 -y 3 -width 138 -height 20 -anchor nw -bordermode ignore 
363     place .wineconf.can53.lis58 \
364         -x 3 -y 25 -width 40 -height 83 -anchor nw -bordermode ignore 
365     place .wineconf.can53.lis59 \
366         -x 44 -y 25 -width 85 -height 83 -anchor nw -bordermode ignore 
367 # bind lis59 to select lis58 at the same time...
368         bind  .wineconf.can53.lis58 <ButtonRelease> {
369                 set sel_com [ .wineconf.can53.lis58 nearest %y]
370                  .wineconf.can53.lis58 selection set $sel_com
371                 #disbale other list related buttons:
372                 .wineconf.can01.but30 configure -state disabled
373                 .wineconf.can01.but29 configure -state disabled
374                 # disable/enable the tow CLEAR buttons of ports:
375                 .wineconf.can54.but70 configure -state disabled
376                 .wineconf.can53.but64 configure -state normal
377         }
378 # bind lis58 to select lis59 at the same time...
379         bind  .wineconf.can53.lis59 <ButtonRelease> {
380                 set sel_com [ .wineconf.can53.lis59 nearest %y]
381                  .wineconf.can53.lis58 selection set $sel_com
382                 #disbale other list related buttons:
383                 .wineconf.can01.but30 configure -state disabled
384                 .wineconf.can01.but29 configure -state disabled
385                 # disable/enable the tow CLEAR buttons of ports:
386                 .wineconf.can54.but70 configure -state disabled
387                 .wineconf.can53.but64 configure -state normal
388         }
389     place .wineconf.can53.scr60 \
390         -x 123 -y 26 -width 16 -height 80 -anchor nw -bordermode ignore 
391     place .wineconf.can53.but63 \
392         -x 10 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore 
393     place .wineconf.can53.but64 \
394         -x 78 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore 
395     place .wineconf.can53.help \
396         -x 10 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore 
397
398 #placing parallelports sections widgets:
399
400     place .wineconf.can54 \
401         -x 160 -y 356 -width 144 -height 180 -anchor nw -bordermode ignore 
402     place .wineconf.can54.lab65 \
403         -x 1 -y 3 -width 143 -height 20 -anchor nw -bordermode ignore 
404     place .wineconf.can54.lis67 \
405         -x 5 -y 26 -width 45 -height 83 -anchor nw -bordermode ignore 
406     place .wineconf.can54.lis68 \
407         -x 50 -y 25 -width 75 -height 83 -anchor nw -bordermode ignore 
408 # bind lis67 
409         bind  .wineconf.can54.lis68 <ButtonRelease> {
410                 set sel_port [ .wineconf.can53.lis59 nearest %y]
411                 #disbale other list related buttons:
412                 .wineconf.can01.but30 configure -state disabled
413                 .wineconf.can01.but29 configure -state disabled
414                 # disable/enable the tow CLEAR buttons of ports:
415                 .wineconf.can54.but70 configure -state normal
416                 .wineconf.can53.but64 configure -state disabled
417         }
418 # bind lis68 to select lis67 at the same time...
419         bind  .wineconf.can54.lis67 <ButtonRelease> {
420                 set sel_port [ .wineconf.can53.lis59 nearest %y]
421                  .wineconf.can54.lis67 selection set $sel_port
422                 #disbale other list related buttons:
423                 .wineconf.can01.but30 configure -state disabled
424                 .wineconf.can01.but29 configure -state disabled
425                 # disable/enable the tow CLEAR buttons of ports:
426                 .wineconf.can54.but70 configure -state normal
427                 .wineconf.can53.but64 configure -state disabled
428         }
429     place .wineconf.can54.but69 \
430         -x 10 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore 
431     place .wineconf.can54.but70 \
432         -x 78 -y 115 -width 60 -height 28 -anchor nw -bordermode ignore 
433     place .wineconf.can54.scr71 \
434         -x 123 -y 26 -width 16 -height 80 -anchor nw -bordermode ignore 
435     place .wineconf.can54.help \
436         -x 10 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore 
437
438 #placing spy and Tweak.Layout sections widgets:
439
440     place .wineconf.can55 \
441         -x 313 -y 357 -width 139 -height 180 -anchor nw -bordermode ignore 
442     place .wineconf.can55.lab72 \
443         -x 3 -y 3 -width 133 -height 20 -anchor nw -bordermode ignore 
444     place .wineconf.can55.ent74 \
445         -x 5 -y 25 -width 130 -height 24 -anchor nw -bordermode ignore 
446     place .wineconf.can55.but75 \
447         -x 5 -y 50 -width 130 -height 28 -anchor nw -bordermode ignore 
448     place .wineconf.can55.lab76 \
449         -x 3 -y 83 -width 133 -height 20 -anchor nw -bordermode ignore 
450     place .wineconf.can55.men78 \
451         -x 10 -y 110 -width 122 -height 24 -anchor nw -bordermode ignore 
452     place .wineconf.can55.help \
453         -x 5 -y 145 -width 130 -height 28 -anchor nw -bordermode ignore 
454
455 #Main window buttons:
456
457     pack .wineconf.but80 -padx 5 -pady 1 -side bottom -fill x
458     pack .wineconf.save -padx 5 -side bottom -fill x
459
460 # initialise the arrays
461         TkW:initarrays
462 # Now start reading the .winerc (or the default wine.ini)
463         TkW:readwinerc $DefaultConfFile
464 # Set the listboxes:
465         TkW:setboxes
466 #updates the scollings
467         set WAITconf 1
468         while {$WAITconf == 1} { TkW:scrollwindows }
469 }
470
471 proc TkW:readwinerc {DefaultConfFile} {
472         global sect ndrives drive n rcout line wine_logfile winelook
473         global nspool nalias srcdest TKW
474
475 TkW:debug "Entering readwinerc -----------------------------"
476
477 # OPEN THE FILE Read-Only:
478 TkW:fixme "TkW:wineconf::\
479 Detection of wine.ini will fail when ~/.winerc ~/wine.conf not there"
480         if {[file exist $DefaultConfFile] } then {
481                 set winerc [open $DefaultConfFile r]
482         } else {
483                 TkW:message "No file $DefaultConfFile... This is a TkWine error"
484                 return
485         }
486 # Adds a fe setting in case they're missing (actually, they are in the std file) in the wine.ini
487 set winelook Win95
488 set wine_logfile /tmp/winelog
489
490 # OPEN /tmp/tkwwinerc for writting
491         set rcout [open /tmp/tkwinerc w]
492
493         set ndrives -1
494         set nspool 0
495         set nalias -1
496         global NDllOver NDllPairs DllPairs DllOver
497         set NDllOver 0
498         set NDllPairs 0
499
500 # Read line by line
501         set charread 0
502         while {$charread != -1} {
503                 
504                 set charread [gets $winerc line]
505                 set line [string trim $line]
506                 set n [expr $charread - 1]
507                 set idok 0
508                 TkW:debug "READ:$line-$charread"
509                 if {[string match ";*" $line]} {
510                         #puts $rcout $line
511                         TkW:debug Comment; set idok 1}
512  # The two lines below SHOULD work... they don't
513                 #if {[string match "\[*\]" $line]} \
514                 #{TkW:debug Section;set idok 1}
515  ## a ugly replacement:
516                 if {"[string range $line 0 0][string range $line $n $n]"\
517                          == "\[\]"} {
518                         TkW:sections
519                         set idok 1
520                 }
521                 if {$idok != 1 && [string match "*=*" $line]} {
522                         TkW:assign
523                         TkW:debug Assignment
524                         set idok 1
525                 }
526                 if {!$idok && $charread > 0} {
527                         TkW:debug "Error::Unknow line in .winerc"
528                         puts "************Warning: Error in config \
529                                 file ****************"
530                         puts "Line $line incomprehensible"
531                 }
532         }
533 }
534
535 proc TkW:sections {} {
536         global sect ndrives drive n rcout line
537         global drivepath drivelabel drivetype drivefstype driveserial drivedevice
538         set sect [string tolower [string range $line 1 [expr $n - 1]]]
539         if {[string tolower [string range $sect 0 4]] == "drive"} {
540                 set ndrives [expr $ndrives + 1]
541                 set drive($ndrives) [string range $sect 6 6]
542                 set drivepath($ndrives) ""
543                 set drivelabel($ndrives) ""
544                 set drivetype($ndrives) ""
545                 set drivefstype($ndrives) ""
546                 set driveserial($ndrives) ""
547                 set drivedevice($ndrives) ""
548                 set sect drive
549                 TkW:debug "Section $sect $drive($ndrives)"
550                 #puts $rcout "\[$sect $drive($ndrives)\]"
551         } else {
552                 TkW:debug "Section $sect"
553                 #puts $rcout "\[$sect]"
554         }
555 }
556
557 proc TkW:assign {} {
558         global sect ndrives drive n rcout line
559
560         global windowspath varpath syspath tmppath symbols winelook
561         global ndrives drive drivepath drivetype drivefstype drivelabel
562         global drivedevice driveserial
563         global resolution defaultfont 
564         global readport writeport
565         global exclude default_progs startup allocsyscolors winelook wine_logfile
566         global com lpt spool nspool alias nalias
567         global NDllOver NDllPairs
568         global DllOver DllPairs 
569
570         set equalis  [string first "=" $line ]
571         set varname [string tolower [string trim [string range $line 0 [expr $equalis - 1]]]]
572         set value [string trim [string range $line [expr $equalis + 1] $n]]
573         if {$varname == "default"} {set varname Default}
574         switch $varname {
575                 {path} {
576                          switch  $sect  {
577                                 {drive} {set drivepath($ndrives) $value}
578                                 {wine} {set varpath $value;update}
579                                 {default} {TkW:conferror $sect $varname $value}
580                          }
581                        }
582                 {type} {
583                                 if {$sect != "drive"} then {
584                                         TkW:conferror $sect $varname $value
585                                 } else {
586                                         set drivetype($ndrives) $value
587                                 }
588                         }
589                 {label} {
590                                 if {$sect != "drive"} then {
591                                         TkW:conferror $sect $varname $value
592                                 } else {
593                                         set drivelabel($ndrives) $value
594                                 } 
595                         }
596                 {serial} {
597                                 if {$sect != "drive"} then {
598                                         TkW:conferror $sect $varname $value
599                                 } else {
600                                         set driveserial($ndrives) $value
601                                 } 
602                         }
603                 {filesystem} {
604                                 if {$sect != "drive"} then {
605                                         TkW:conferror $sect $varname $value
606                                 } else {
607                                         set drivefstype($ndrives) $value
608                                 } 
609                              }
610                 {device} {
611                                 if {$sect != "drive"} then {
612                                         TkW:conferror $sect $varname $value
613                                 } else {
614                                         set drivedevice($ndrives) $value
615                                 } 
616                         }
617                 {windows} {
618                                 if {$sect != "wine"} then {
619                                  TkW:conferror $sect $varname $value
620                                 } else {
621                                  set windowspath $value
622                                 } 
623                         }
624                 {system} {
625                                 if {$sect != "wine"} then {
626                                         TkW:conferror $sect $varname $value
627                                 } else {
628                                         set syspath $value
629                                 } 
630                         }
631                 {temp} {
632                                 if {$sect != "wine"} then {
633                                         TkW:conferror $sect $varname $value
634                                 } else {
635                                         set tmppath $value
636                                 } 
637                         }
638                 {symboltablefile} {
639                                         if {$sect != "wine"} then {
640                                                 TkW:conferror $sect\
641                                                          $varname $value
642                                         } else {
643                                                 set symbols $value
644                                         } 
645                                 }
646                 {resolution} {
647                                 if {$sect != "fonts"} then {
648                                         TkW:conferror $sect $varname $value
649                                 } else {
650                                         set resolution $value
651                                 }
652                              }
653                 {Default} {
654                                 switch $sect {
655                                         {fonts} { set defaultfont $value}
656                                         {programs} {set default_progs $value}
657                                         {default} { TkW:conferror \
658                                                         $sect $varname $value }
659                                 }
660                         }
661                 {read} {
662                                 if {$sect != "ports"} then {
663                                         TkW:conferror $sect $varname $value
664                                 } else {
665                                         set readport $value
666                                 }    
667                         }
668                 {write} {
669                                 if {$sect != "ports"} then {
670                                         TkW:conferror $sect $varname $value
671                                 } else {
672                                         set writeport $value
673                                 }    
674                         }
675                 {file} {
676                                 if {$sect != "spy"} then {
677                                         TkW:conferror $sect $varname $value
678                                 } else {
679                                         set wine_logfile $value
680                                 }    
681                         }
682                 {exclude} {
683                                 if {$sect != "spy"} then {
684                                         TkW:conferror $sect $varname $value
685                                 } else {
686                                         set Exclude $value
687                                 }    
688                         }
689                 {allocsystemcolors} {
690                                         if {$sect != "options"} then {
691                                                 TkW:conferror $sect $varname\
692                                                                          $value
693                                         } else {
694                                                 set allocsyscolors $value
695                                         } 
696                                    }
697                 {winelook} {
698                                         if {$sect != "tweak.layout"} then {
699                                                 TkW:conferror $sect $varname\
700                                                                          $value
701                                         } else {
702                                                 set winelook $value
703                                         } 
704                                    }
705                 {startup} {
706                                         if {$sect != "programs"} then {
707                                                 TkW:conferror $sect $varname\
708                                                                          $value
709                                         } else {
710                                                 set startup $value
711                                         } 
712                                    }
713                 {printer} {
714                                         if {$sect != "wine"} then {
715                                                 TkW:conferror $sect $varname\
716                                                                          $value
717                                         } else {
718                                                 set printer $value
719                                         } 
720                                    }
721                 {default} {
722                         if {$sect == "dllpairs"} {
723                                 set NDllPairs [expr $NDllPairs + 1]
724                                 set DllPairs($NDllPairs) "$varname      = $value"
725                                 return
726                         } 
727                         if {$sect == "dlloverrides"} {
728                                 set NDllOver [expr $NDllOver + 1]
729                                 set DllOver($NDllOver) "$varname        = $value"
730                                 return
731                         } 
732                         if {[string tolower [string trim [string range $line 0 2]]] == "lpt" &&  [string range $line 4 4 ] == ":" } {
733                                 if {$sect != "spooler"} then {
734                                            TkW:conferror $sect $varname $value
735                                  } else {
736                                         set nspool [expr $nspool + 1]
737                                         set spool($nspool) $value
738                                  }
739                                 return
740                         }
741
742                         set varname2 [string tolower [string trim \
743                                 [string range $line 0 [expr $equalis - 2]]]]
744                         set letter [string tolower [string range $line [expr $equalis - 1]\
745                                  [expr $equalis - 1] ]]
746                         #set varname2 [string tolower $varname2]
747                         switch $varname2 {
748         
749                                 {com} {
750                                         if {$sect != "serialports"} then {
751                                                 TkW:conferror $sect $varname\
752                                                                          $value
753                                         } else {
754                                                 set com($letter) $value
755                                         }
756                                       }        
757                                 {lpt} {
758                                         if {$sect != "parallelports"} then {
759                                                 TkW:conferror $sect $varname\
760                                                                          $value
761                                         } else {
762                                                 set lpt($letter) $value
763                                         }
764                                       }        
765
766                                 {alias} {
767                                         if {$sect != "fonts"} then {
768                                                 TkW:conferror $sect $varname\
769                                                                          $value
770                                         } else {
771                                                 set nalias [expr $nalias + 1]
772                                                 set alias($nalias) $value
773                                         }
774                                       }        
775                                 {default} {
776                                         TkW:conferror $sect $varname $value
777                                 }
778                                         
779
780                         }
781                         
782                 
783                 }
784         }
785 }
786
787 proc TkW:conferror {sect varname value} {
788
789         puts "ERROR IN CONFIG FILE, FOUND $varname=$value in section $sect"
790 }
791
792 proc TkW:setboxes {} {
793         
794         global ndrives drive drivepath drivetype drivefstype drivelabel
795         global drivedevice driveserial
796         global com lpt
797
798         .wineconf.can01.lis23 delete 0 end
799         .wineconf.can01.lis24 delete 0 end
800         .wineconf.can01.lis25 delete 0 end
801         .wineconf.can01.lis26 delete 0 end
802
803         for {set i 0} {$i <= $ndrives } {set i [expr $i + 1]} {
804
805                 TkW:debug "Drive $i : $drive($i) $drivepath($i) $drivetype($i)\
806                                         $drivelabel($i)"
807                 TkW:debug "           $drivefstype($i) $drivedevice($i) $driveserial($i)"
808                 
809                 set yes " "
810                 if {![file isdirectory $drivepath($i)]} {set yes "*"}
811                 .wineconf.can01.lis23 insert end \
812                         "$yes\($drive($i):\\) $drivepath($i) "
813                 .wineconf.can01.lis24 insert end \
814                         "$yes$drivetype($i)"
815                 .wineconf.can01.lis25 insert end \
816                         "$yes$drivelabel($i)"
817                 .wineconf.can01.lis26 insert end \
818                         "$yes$drivefstype($i)"
819         }
820
821         .wineconf.can53.lis59 delete 0 end
822         .wineconf.can53.lis58 delete 0 end
823         for {set i 1} {$i <= 8 } {set i [expr $i + 1]} {
824                 .wineconf.can53.lis58 insert end "com$i"
825                 .wineconf.can53.lis59 insert end $com($i)
826         }
827         .wineconf.can54.lis67 delete 0 end
828         .wineconf.can54.lis68 delete 0 end
829         for {set i 1} {$i <= 8 } {set i [expr $i + 1]} {
830                 .wineconf.can54.lis67 insert end "lpt$i"
831                 .wineconf.can54.lis68 insert end $lpt($i)
832         }
833
834 }
835
836 proc TkW:scrollwindows {} {
837
838         global OldPos 
839
840         if {![info exists OldPos]} {set OldPos 0}
841
842 # Serial
843         set lis58pos [.wineconf.can53.lis59 yview]; set a 1
844         foreach i $lis58pos { if {$a} {set pos $i};  set a 0 }
845         .wineconf.can53.lis58 yview moveto $pos
846 # // ports
847         set lis67pos [.wineconf.can54.lis67 yview]; set a 1
848         foreach i $lis67pos { if {$a} {set pos $i};  set a 0 }
849         .wineconf.can54.lis68 yview moveto $pos
850 # drives:
851         set lis23pos [.wineconf.can01.lis23 yview]; set a 1
852         foreach i $lis23pos { if {$a} {set pos $i};  set a 0 }
853         if {$lis23pos != $OldPos} {
854                 TkW:debug  "listbox23 has move from $OldPos to $lis23pos"
855                 TkW:debug  "listbox24 goes to $pos "
856         }
857         set OldPos $lis23pos
858         .wineconf.can01.lis24 yview moveto $pos
859         .wineconf.can01.lis25 yview moveto $pos
860         .wineconf.can01.lis26 yview moveto $pos
861
862         update
863 }
864
865 proc TkW:initarrays {} {
866
867         global com lpt spool
868
869         for {set i 1 } {$i <= 8 } {set i [expr $i + 1]} {
870                 set com($i) ""
871                 set lpt($i) ""
872         }
873         for {set i 1 } {$i <= 8 } {set i [expr $i + 1]} {
874                 set spool($i) ""
875         }
876 }
877
878 proc TkW:editports {comlpt} {
879         
880         global OK CANCEL com portch lpt lptcom win banner TKW
881         global WC_confserial WC_confparallel  WC_PPbanner WC_serialbanner
882
883         .wineconf.can54.but69 configure -state disabled
884         .wineconf.can53.but63 configure -state disabled
885
886 # this is a ugly trick as buttons command need a global variable, not an arg
887         set lptcom $comlpt
888
889         if {$comlpt == "com"} then {
890                 set win .comedit
891                 set title $WC_confserial
892                 set banner $WC_serialbanner
893         } else {
894                 set win .lptedit
895                 set title $WC_confparallel
896                 set banner $WC_PPbanner
897         }
898     toplevel $win -class Toplevel \
899         -background #3c1cfe 
900     wm focusmodel $win passive
901     wm geometry $win 205x365+448+253
902     wm maxsize $win 1265 994
903     wm minsize $win 1 1
904     wm overrideredirect $win 0
905     wm resizable $win 1 1
906     wm deiconify $win
907     wm title $win $title
908     #wm iconbitmap $win @$TKW/setupfiles/images/setup2.xbm
909     #wm iconmask   $win @$TKW/setupfiles/images/setupmask2.xbm 
910
911 # creating the Banner
912         
913         label "$win.banner" \
914                 -background #dc96dc \
915                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
916                 -relief groove -text $banner
917
918 # creating the labels and entries
919
920         for {set i 1} {$i <= 8} {set i [expr $i + 1 ]} {
921
922                 set portch($i) $com($i)
923                 if {$comlpt == "com"} then {
924                         set portch($i) $com($i) 
925                 } else {
926                         set portch($i) $lpt($i) 
927                 }
928
929                 label "$win.lab$i" \
930                      -background #dc96dc \
931                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
932                      -relief groove -text "Com$i"
933                 entry "$win.ent$i" \
934                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
935                      -textvariable portch($i)
936                 set Y [expr 55 + $i * 30]
937                 place  "$win.lab$i"\
938                         -x 5 -y $Y -width 45 -height 28 \
939                         -anchor nw -bordermode ignore 
940                 place  "$win.ent$i"\
941                         -x 55 -y $Y -width 145 -height 28 \
942                         -anchor nw -bordermode ignore 
943         }
944
945         button $win.but80 \
946                 -command {
947                         for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
948                                 if {$lptcom == "com"} then {
949                                         set com($i) $portch($i)
950                                 } else {
951                                         set lpt($i) $portch($i)
952                                 }
953                         .wineconf.can54.but69 configure -state normal
954                         .wineconf.can53.but63 configure -state normal
955                         }
956                         destroy $win
957                         TkW:setboxes
958                 } \
959                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
960                  -padx 9  -pady 3 -text button -textvariable OK 
961         place $win.banner -x 5 -y 5 -width 195 -height 70
962
963         place $win.but80 \
964                 -x 5 -y 335 -width 100 -height 28 \
965                 -anchor nw -bordermode ignore 
966         button $win.but81 \
967                 -command {destroy $win
968                         .wineconf.can54.but69 configure -state normal
969                         .wineconf.can53.but63 configure -state normal
970                 }\
971                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
972                  -padx 9  -pady 3 -text button -textvariable CANCEL \
973
974         place $win.but81 \
975                 -x 105 -y 335 -width 100 -height 28 \
976                 -anchor nw -bordermode ignore 
977
978 }
979
980 proc TkW:drives {n} {
981
982         global ndrives drive drivepath drivetype drivefstype drivelabel
983         global drivedevice driveserial TKW
984         global WC_confdrives HELP WCHLP WC_driveSetBanner
985         global chdrives1 chdrives2 chdrives3 chdrives4 
986         global chdrives5 chdrives6 chdrives7 
987         global win i num ch drOK
988
989         set chdrives(1) $chdrives1
990         set chdrives(2) $chdrives2
991         set chdrives(3) $chdrives3
992         set chdrives(4) $chdrives4
993         set chdrives(5) $chdrives5
994         set chdrives(6) $chdrives6
995         set chdrives(7) $chdrives7
996
997
998         if {$n == "new"} then {
999                 set num [expr $ndrives + 1]
1000                 set ch(1) ""
1001                 set ch(2) ""
1002                 set ch(3) ""
1003                 set ch(4) ""
1004                 set ch(5) ""
1005                 set ch(6) ""
1006                 set ch(7) ""
1007         } else {
1008                 set num $n
1009                 set ch(1) $drive($num)
1010                 set ch(2) $drivepath($num)
1011                 set ch(3) $drivetype($num)
1012                 set ch(4) $drivefstype($num)
1013                 set ch(5) $drivelabel($num)
1014                 set ch(6) $drivedevice($num)
1015                 set ch(7) $driveserial($num)
1016         }
1017
1018         TkW:debug "Entering TkW:drives - drive number: $num"
1019
1020         .wineconf.can01.but28 configure -state disabled
1021         .wineconf.can01.but29 configure -state disabled
1022         .wineconf.can01.but30 configure -state disabled
1023         # re-enable the tow EDIT buttons of ports:
1024         .wineconf.can54.but69 configure -state disabled
1025         .wineconf.can53.but63 configure -state disabled
1026
1027
1028         set win .drivedit
1029         set title $WC_confdrives
1030
1031     toplevel $win -class Toplevel \
1032         -background #3c1cfe 
1033     wm focusmodel $win passive
1034     wm geometry $win 305x325+448+253
1035     wm maxsize $win 1265 994
1036     wm minsize $win 1 1
1037     wm overrideredirect $win 0
1038     wm resizable $win 1 1
1039     wm deiconify $win
1040     wm title $win $title
1041     #wm iconbitmap $win @$TKW/setupfiles/images/setup2.xbm
1042     #wm iconmask   $win @$TKW/setupfiles/images/setupmask2.xbm
1043
1044 # setting the banner:
1045
1046                 label "$win.banner" \
1047                      -background #dc96dc \
1048                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1049                      -relief groove -text $WC_driveSetBanner -height 35
1050
1051
1052         
1053 # creating the labels and entries
1054
1055 # setting HELP buttons
1056                 button $win.hlp1\
1057                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1058                         -padx 9 -pady 3 -text button -textvariable HELP \
1059                         -command {TkW:message $WCHLP(1)}
1060                 button $win.hlp2\
1061                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1062                         -padx 9 -pady 3 -text button -textvariable HELP \
1063                         -command {TkW:message $WCHLP(2)}
1064                 button $win.hlp3\
1065                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1066                         -padx 9 -pady 3 -text button -textvariable HELP \
1067                         -command {TkW:message $WCHLP(3)}
1068                 button $win.hlp4\
1069                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1070                         -padx 9 -pady 3 -text button -textvariable HELP \
1071                         -command {TkW:message $WCHLP(4)}
1072                 button $win.hlp5\
1073                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1074                         -padx 9 -pady 3 -text button -textvariable HELP \
1075                         -command {TkW:message $WCHLP(5)}
1076                 button $win.hlp6\
1077                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1078                         -padx 9 -pady 3 -text button -textvariable HELP \
1079                         -command {TkW:message $WCHLP(6)}
1080                 button $win.hlp7\
1081                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1082                         -padx 9 -pady 3 -text button -textvariable HELP \
1083                         -command {TkW:message $WCHLP(7)}
1084
1085
1086         for {set i 1} {$i <= 7} {set i [expr $i + 1 ]} {
1087
1088
1089                 label "$win.lab$i" \
1090                      -background #dc96dc \
1091                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1092                      -relief groove -text $chdrives($i)
1093                 if {$i < 3 || $i > 4} then {
1094                    entry "$win.ent$i" \
1095                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1096                      -text text -textvariable ch($i)
1097                 } else {
1098                     menubutton $win.ent$i \
1099                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-* \
1100                         -menu $win.ent$i.m -padx 4 -pady 3 \
1101                         -text text -textvariable ch($i)
1102                 }
1103 # settings the menus:
1104                 if {$i == 3} then {
1105                         menu $win.ent$i.m \
1106                                 -cursor {} \
1107                                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
1108                         $win.ent$i.m add command \
1109                                 -command {set ch(3) "hd"} -label {Hard Drive}
1110                         $win.ent$i.m add command \
1111                                 -command {set ch(3) "floppy"} -label {Floppy}
1112                         $win.ent$i.m add command \
1113                                 -command {set ch(3) "cdrom"} -label {CDrom} 
1114                         $win.ent$i.m add command \
1115                                 -command {set ch(3) "network"} \
1116                                 -label {network} 
1117                 }
1118                 if {$i == 4} then {
1119                         menu $win.ent$i.m \
1120                                 -cursor {} \
1121                                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*
1122                         $win.ent$i.m add command \
1123                                 -command {set ch(4) "msdos"} -label {msdos}
1124                         $win.ent$i.m add command \
1125                                 -command {set ch(4) "win95"} -label {Win95}
1126                         $win.ent$i.m add command \
1127                                 -command {set ch(4) "Unix"} -label {Unix} 
1128                 }
1129
1130
1131                 set Y [expr 40 + $i * 30]
1132                 place  "$win.lab$i"\
1133                         -x 5 -y $Y -width 145 -height 28 \
1134                         -anchor nw -bordermode ignore 
1135                 place  "$win.ent$i"\
1136                         -x 150 -y $Y -width 85 -height 28 \
1137                         -anchor nw -bordermode ignore 
1138                 place  "$win.hlp$i"\
1139                         -x 235 -y $Y -width 55 -height 28 \
1140                         -anchor nw -bordermode ignore 
1141                 
1142         }
1143
1144
1145         button $win.but80 \
1146                 -command {
1147                         TkW:checkdrives
1148                         if {$drOK} {
1149                                 set drive($num) $ch(1)
1150                                 set drivepath($num) $ch(2)
1151                                 set drivetype($num) $ch(3)
1152                                 set drivefstype($num) $ch(4)
1153                                 set drivelabel($num) $ch(5)
1154                                 set drivedevice($num) $ch(6)
1155                                 set driveserial($num) $ch(7) 
1156                                 destroy $win
1157                                 if {$num > $ndrives} {set  ndrives $num}
1158                                 TkW:setboxes
1159                                 .wineconf.can01.but28 configure -state normal
1160                                 # re-enable the tow EDIT buttons of ports:
1161                                 .wineconf.can54.but69 configure -state normal
1162                                 .wineconf.can53.but63 configure -state normal
1163                         }
1164                 } \
1165                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1166                  -padx 9  -pady 3 -text button -textvariable OK \
1167
1168         place $win.but80 \
1169                 -x 5 -y 290 -width 145 -height 28 \
1170                 -anchor nw -bordermode ignore 
1171         button $win.but81 \
1172                 -command {
1173                         destroy $win
1174                         .wineconf.can01.but28 configure -state normal
1175                         #.wineconf.can01.but29 configure -state normal
1176                         #.wineconf.can01.but30 configure -state normal
1177                         # re-enable the tow EDIT buttons of ports:
1178                         #.wineconf.can54.but69 configure -state normal
1179                         #.wineconf.can53.but63 configure -state normal
1180                 }\
1181                 -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1182                  -padx 9  -pady 3 -text button -textvariable CANCEL \
1183
1184         place $win.but81 \
1185                 -x 150 -y 290 -width 145 -height 28 \
1186                 -anchor nw -bordermode ignore 
1187         place $win.banner -width 290 -height 35 -x 5 -y 5 
1188
1189 }
1190 proc TkW:checkdrives {} {
1191         global ndrives ch num drOK drive
1192         global WC_givepath WC_oneletter WC_usedletter WC_11letters
1193
1194                 if {[string length $ch(1)] != 1} {
1195                         TkW:message "$ch(1) $WC_oneletter"
1196                         set drOK 0
1197                         return
1198                 }
1199                 if {[string length $ch(5)] > 11} {
1200                         TkW:message "$ch(5) $WC_11letters"
1201                         set drOK 0
1202                         return
1203                 }
1204                 for {set i 0} {$i <=$ndrives} {set i [expr $i + 1]} {
1205                         if {$i != $num  && [string tolower $ch(1)]\
1206                                          == [string tolower $drive($i)] } {
1207                                 TkW:message "$ch(1)$WC_usedletter" 
1208                                 set drOK 0
1209                                 return
1210                         }
1211                 }
1212                 if { $ch(2) == ""} {TkW:message $WC_givepath; set drOK 0;return}
1213                 if { $ch(3) == ""} {set ch(3) hd}
1214                 if { $ch(4) == ""} {set ch(4) unix}
1215                 if { $ch(5) == ""} {set ch(5) "Drive $ch(1)"}
1216                 set drOK 1
1217 }
1218
1219 proc TkW:editWinePath {} {
1220         global OK varpath WC_editPathBanner WC_pathtitle TKW
1221         TkW:debug "Entering TkW:editWinePath with path set to $varpath"
1222         global ndrives dri
1223         
1224         # Create the toplevel
1225     toplevel .editpath -class Toplevel \
1226         -background #3c1cfe 
1227     wm focusmodel .editpath passive
1228     wm geometry .editpath 410x100+448+253
1229     wm maxsize .editpath 1265 994
1230     wm minsize .editpath 1 1
1231     wm overrideredirect .editpath 0
1232     wm resizable .editpath 1 1
1233     wm deiconify .editpath
1234     wm title .editpath $WC_pathtitle 
1235     #wm iconbitmap .editpath @$TKW/setupfiles/images/setup2.xbm
1236     #wm iconmask   .editpath @$TKW/setupfiles/images/setupmask2.xbm
1237
1238         #Creates the Banner
1239                 label .editpath.banner \
1240                      -background #dc96dc \
1241                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1242                      -relief groove -text $WC_editPathBanner
1243         #Creates the entry box
1244                 entry .editpath.ent \
1245                      -background #dc96dc \
1246                      -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1247                      -relief groove -textvariable varpath
1248         #Creates OK button
1249                 button .editpath.ok\
1250                         -background #dc96dc \
1251                         -font -Adobe-Helvetica-Medium-R-Normal-*-*-120-*-*-*-*-*-*\
1252                         -relief groove -text $OK -command {destroy .editpath}
1253
1254         place .editpath.banner -x 5 -y 5 -width 400 -height 30
1255         place .editpath.ent -x 5 -y 40 -width 400 -height 30
1256         place .editpath.ok -x 5 -y 70 -width 400 -height 30
1257                         
1258 }
1259
1260 proc TkW:writewinerc {} {
1261
1262         global windowspath varpath syspath tmppath symbols winelook
1263         global ndrives drive drivepath drivetype drivefstype drivelabel
1264         global drivedevice driveserial
1265         global resolution defaultfont HOME
1266         global readport writeport
1267         global exclude default_progs startup allocsyscolors winelook wine_logfile
1268         global com lpt spool nspool alias nalias
1269         global NDllPairs NDllOver DllPairs DllOver
1270
1271 # open file for writing:;;
1272
1273 # move the old file:
1274         if {[file exists ~/.winerc]} {
1275                 set free 1
1276                 while {[file exists ~/.winerc.$free]} {
1277                         set free [expr $free + 1]
1278                 }
1279                 exec mv -f $HOME/.winerc $HOME/.winerc.$free
1280         }
1281         set out [open ~/.winerc w]
1282
1283 # writes drives
1284 # Puts the usual comments:
1285         puts $out ";;"
1286         puts $out ";; MS-DOS drives configuration "
1287         puts $out ";;"
1288         puts $out ";; Each section has the following format:"
1289         puts $out ";; \[Drive X\]"
1290         puts $out ";; Path=xxx       (Unix path for drive root)"
1291         puts $out ";; Type=xxx       (supported types are 'floppy', 'hd', 'cdrom' and 'network')"
1292         puts $out ";; Label=xxx      (drive label, at most 11 characters)"
1293         puts $out ";; Serial=xxx     (serial number, 8 characters hexadecimal number)"
1294         puts $out ";; Filesystem=xxx (supported types are 'msdos','win95','unix')"
1295         puts $out ";; Device=/dev/xx (only if you want to allow raw device access)"
1296         puts $out ";;    "
1297         for {set i 0} {$i <= $ndrives} {set i [expr $i + 1]} {
1298                 puts $out "\[Drive $drive($i)\]"
1299                 puts $out "Path=$drivepath($i)"
1300                 puts $out "Type=$drivetype($i)"
1301                 puts $out "Label=$drivelabel($i)"
1302                 if {$drivefstype($i) == ""} {set drivefstype($i) unix}
1303                 puts $out "Filesystem=$drivefstype($i)"
1304                 if {$driveserial($i) != "" } {puts $out "Serial=$driveserial($i)"}
1305                 if {$drivedevice($i) != "" } {puts $out "Device=$drivedevice($i)"}
1306                 puts $out ""
1307
1308         }
1309 #write wine section
1310         puts $out "\[wine\]"
1311         puts $out "Windows=$windowspath"
1312         puts $out "System=$syspath"
1313         puts $out "Temp=$tmppath"
1314         puts $out "Path=$varpath"
1315         puts $out "SymbolTableFile=$symbols"
1316         puts $out ""
1317
1318 # write options
1319         TkW:fixme "Option not supported in wineconf, write de default"
1320         puts $out "\[options\]"
1321         puts $out "AllocSystemColors=$allocsyscolors"
1322         puts $out ""
1323
1324 # DllPairs:
1325         puts $out "\[DllPairs\]"
1326         for {set i 1} {$i <= $NDllPairs} {set i [expr $i + 1]} {
1327                 puts $out $DllPairs($i)
1328         }
1329         puts $out
1330 # DllOverrides:
1331         puts $out "\[DllOverrides\]"
1332         for {set i 1} {$i <= $NDllOver} {set i [expr $i + 1]} {
1333                 puts $out $DllOver($i)
1334         }
1335         puts $out
1336 # write fonts section
1337         TkW:fixme "fonts support to be added to wineconf...."
1338         puts $out "\[fonts\]"
1339         puts $out ";Read documentation/fonts before adding aliases"
1340         puts $out "Resolution = $resolution"
1341         puts $out "Default = $defaultfont"
1342         puts $out ""
1343 # write serial
1344         puts $out "\[serialports\]"
1345         for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
1346                 if {$com($i) != ""} {puts $out "Com$i=$com($i)"}
1347         }
1348         puts $out ""
1349 # write parallel
1350         puts $out "\[parallelports\]"
1351         for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
1352                 if {$lpt($i) != ""} {puts $out "Lpt$i=$lpt($i)"}
1353         }
1354         puts $out ""
1355 # write spooler
1356         puts $out "\[spooler\]"
1357         for {set i 1} {$i <= 8} {set i [expr $i + 1]} {
1358                 if {$spool($i) != ""} {puts $out "LPT$i:=$spool($i)"}
1359         }
1360         puts $out ""
1361 # write ports
1362         puts $out "\[ports]"
1363         if {[info exists readport]} {puts $out $readport} {puts $out ";read=0x779,0x379,0x280-0x2a0"}
1364         if {[info exists writeport]} {puts $out $writeport} {puts $out ";write=0x779,0x379,0x280-0x2a0"}
1365         puts $out ""
1366 #write spy
1367         puts $out "\[spy\]"
1368         puts $out "file=$wine_logfile"
1369         if {[info exists exclude]} {puts $out "Exclude=$exclude"} {puts $out "Exclude=WM_SIZE;WM_TIMER;"}
1370         puts $out ""
1371 #write Tweak.Layout
1372         puts $out "\[Tweak.Layout\]"
1373         puts $out ";; WineLook=xxx  (supported styles are \'Win31\'(default), \'Win95\', \'Win98\')"
1374         puts $out "WineLook=Win95"
1375 }
1376 proc TkW:delDrive {n} {
1377
1378         global ndrives drive drivepath drivetype drivefstype drivelabel
1379         global drivedevice driveserial
1380
1381         TkW:debug "Remove drive [expr  $n + 1]"
1382         for {set i  $n} {$i<$ndrives} {set i [expr $i +1]} {
1383                 set i1 [expr $i + 1]
1384                 set drive($i) $drive($i1)
1385                 set drivepath($i)  $drivepath($i1)
1386                 set drivelabel($i) $drivelabel($i1)
1387                 set drivetype($i) $drivetype($i1)
1388                 set drivefstype($i) $drivefstype($i1)
1389                 set driveserial($i) $driveserial($i1)
1390         }
1391         set ndrives [expr $ndrives - 1]
1392         TkW:setboxes
1393 }