1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
### Copyright (C) 1995-1997 Jesper K. Pedersen
### This program is free software; you can redistribute it and/or modify
### it under the terms of the GNU General Public License as published by
### the Free Software Foundation; either version 2 of the License, or
### (at your option) any later version.
###
### This program is distributed in the hope that it will be useful,
### but WITHOUT ANY WARRANTY; without even the implied warranty of
### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
### GNU General Public License for more details.
###
### You should have received a copy of the GNU General Public License
### along with this program; if not, write to the Free Software
### Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
### This command link the value of setup(generateDefault) to generateDefault
### Fri Dec 5 16:23:46 1997 -- Jesper Pedersen
### It need to be located here instead of in dotfile.tcl, to make wish8.0
### work.
upvar \#0 setup(generateDefault) generateDefault
proc setup {} {
global setup __temp module __language
if {[winfo exists .setup]} {
raise .setup
wm deiconify .setup
return
}
toplevel .setup
bind .setup <3> "help`gotoTag menu_options"
foreach var {file print whatToGenerate generateDefault
saveOnGenerate placeWindows} {
set __temp($var) $setup($var)
}
label .setup.label -text "Setup"
pack .setup.label
frame .setup.filename
pack .setup.filename -expand 1 -fill both
set i 0
foreach elm $setup(dotfile) {
pack [frame .setup.filename.$i] -expand 1 -fill x
label .setup.filename.$i.label -text [lindex $elm 1]
entry .setup.filename.$i.entry -textvariable __temp(dotfile$i) \
-bd 2 -relief sunken
label .setup.filename.$i.label2 -text $__language(setup,1)
entry .setup.filename.$i.commentChar -textvariable __temp(commentChar$i)\
-width 5
pack .setup.filename.$i.label .setup.filename.$i.entry \
.setup.filename.$i.label2 .setup.filename.$i.commentChar -side left
set __temp(dotfile$i) [lindex $elm 2]
set __temp(commentChar$i) [lindex $elm 3]
incr i
}
frame .setup.save
pack .setup.save -expand 1 -fill x
checkbutton .setup.save.1 -text $__language(setup,2) \
-variable __temp(file) -anchor w
checkbutton .setup.save.2 -text $__language(setup,3) \
-variable __temp(print) -anchor w
pack .setup.save.1 .setup.save.2 -fill x -side left -fill x -expand 1
checkbutton .setup.whatTosave -text $__language(setup,4) \
-variable __temp(generateDefault) -anchor w
pack [frame .setup.whatToGen] -expand 1 -fill x
radiobutton .setup.whatToGen.onePage -variable __temp(whatToGenerate) \
-value one -text $__language(setup,5)
radiobutton .setup.whatToGen.selected -variable __temp(whatToGenerate) \
-value selected -text $__language(setup,6)
radiobutton .setup.whatToGen.all -variable __temp(whatToGenerate) \
-value all -text $__language(setup,7)
pack .setup.whatToGen.onePage .setup.whatToGen.selected .setup.whatToGen.all\
-side left
if {[info exists module(onlyGenerateAll)] && $module(onlyGenerateAll)} {
.setup.whatToGen.onePage configure -state disabled
.setup.whatToGen.selected configure -state disabled
.setup.whatToGen.all configure -state disabled
}
checkbutton .setup.saveOnGenerate -text $__language(setup,8) \
-variable __temp(saveOnGenerate) -anchor w
pack .setup.whatTosave .setup.saveOnGenerate -fill both -expand 1
### place windows
checkbutton .setup.place -text $__language(setup,9) \
-variable __temp(placeWindows) -anchor w
pack .setup.place -fill both -expand 1
frame .setup.buttons
pack .setup.buttons -expand 1 -fill x
button .setup.buttons.ok -text $__language(ok) -command {
foreach var {file print whatToGenerate generateDefault saveOnGenerate
placeWindows} {
set setup($var) $__temp($var)
}
set i 0
set new {}
foreach elm $setup(dotfile) {
lappend new [list [lindex $elm 0] [lindex $elm 1] \
$__temp(dotfile$i) $__temp(commentChar$i)]
set __fileHandles([lindex $elm 0]) $__temp(dotfile$i)
incr i
}
set setup(dotfile) $new
setWhatToGenerate
catch "destroy .setup"
}
button .setup.buttons.cancel -text $__language(cancel) -command {
catch "destroy .setup"
}
pack .setup.buttons.cancel .setup.buttons.ok -side right
}
|