| 1 |
############ cooled procedures -- [email protected] ######### |
| 2 |
|
| 3 |
proc cooled_apply {id} { |
| 4 |
# strip "." from the TK id to make a variable name suffix |
| 5 |
set vid [string trimleft $id .] |
| 6 |
# for each variable, make a local variable to hold its name... |
| 7 |
set var_graph_width [concat graph_width_$vid] |
| 8 |
global $var_graph_width |
| 9 |
set var_graph_height [concat graph_height_$vid] |
| 10 |
global $var_graph_height |
| 11 |
set var_graph_draw [concat graph_draw_$vid] |
| 12 |
global $var_graph_draw |
| 13 |
|
| 14 |
set cmd [concat $id dialog \ |
| 15 |
[eval concat $$var_graph_width] \ |
| 16 |
[eval concat $$var_graph_height] \ |
| 17 |
[eval concat $$var_graph_draw] \ |
| 18 |
\;] |
| 19 |
#puts stderr $cmd |
| 20 |
pdsend $cmd |
| 21 |
} |
| 22 |
|
| 23 |
proc cooled_cancel {id} { |
| 24 |
set cmd [concat $id cancel \;] |
| 25 |
#puts stderr $cmd |
| 26 |
pdsend $cmd |
| 27 |
} |
| 28 |
|
| 29 |
proc cooled_ok {id} { |
| 30 |
cooled_apply $id |
| 31 |
cooled_cancel $id |
| 32 |
} |
| 33 |
|
| 34 |
proc pdtk_cooled_dialog {id width height draw} { |
| 35 |
set vid [string trimleft $id .] |
| 36 |
set var_graph_width [concat graph_width_$vid] |
| 37 |
global $var_graph_width |
| 38 |
set var_graph_height [concat graph_height_$vid] |
| 39 |
global $var_graph_height |
| 40 |
set var_graph_draw [concat graph_draw_$vid] |
| 41 |
global $var_graph_draw |
| 42 |
|
| 43 |
set $var_graph_width $width |
| 44 |
set $var_graph_height $height |
| 45 |
set $var_graph_draw $draw |
| 46 |
|
| 47 |
toplevel $id |
| 48 |
wm title $id {cooled} |
| 49 |
wm protocol $id WM_DELETE_WINDOW [concat cooled_cancel $id] |
| 50 |
|
| 51 |
label $id.label -text {EDITOR PROPERTIES} |
| 52 |
pack $id.label -side top |
| 53 |
|
| 54 |
frame $id.buttonframe |
| 55 |
pack $id.buttonframe -side bottom -fill x -pady 2m |
| 56 |
button $id.buttonframe.cancel -text {Cancel}\ |
| 57 |
-command "cooled_cancel $id" |
| 58 |
button $id.buttonframe.apply -text {Apply}\ |
| 59 |
-command "cooled_apply $id" |
| 60 |
button $id.buttonframe.ok -text {OK}\ |
| 61 |
-command "cooled_ok $id" |
| 62 |
pack $id.buttonframe.cancel -side left -expand 1 |
| 63 |
pack $id.buttonframe.apply -side left -expand 1 |
| 64 |
pack $id.buttonframe.ok -side left -expand 1 |
| 65 |
|
| 66 |
frame $id.1rangef |
| 67 |
pack $id.1rangef -side top |
| 68 |
label $id.1rangef.lwidth -text "Width :" |
| 69 |
entry $id.1rangef.width -textvariable $var_graph_width -width 7 |
| 70 |
pack $id.1rangef.lwidth $id.1rangef.width -side left |
| 71 |
|
| 72 |
frame $id.2rangef |
| 73 |
pack $id.2rangef -side top |
| 74 |
label $id.2rangef.lheight -text "Height :" |
| 75 |
entry $id.2rangef.height -textvariable $var_graph_height -width 7 |
| 76 |
pack $id.2rangef.lheight $id.2rangef.height -side left |
| 77 |
|
| 78 |
checkbutton $id.draw -text {Draw Sample} -variable $var_graph_draw \ |
| 79 |
-anchor w |
| 80 |
pack $id.draw -side top |
| 81 |
|
| 82 |
bind $id.1rangef.width <KeyPress-Return> [concat cooled_ok $id] |
| 83 |
bind $id.2rangef.height <KeyPress-Return> [concat cooled_ok $id] |
| 84 |
focus $id.1rangef.width |
| 85 |
} |
| 86 |
|
| 87 |
############ cooled procedures END -- [email protected] ######### |