| 1 |
############ probalizer procedures -- [email protected] ######### |
| 2 |
|
| 3 |
proc probalizer_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_nvalues [concat graph_nvalues_$vid] |
| 12 |
global $var_graph_nvalues |
| 13 |
set var_graph_noccurrences [concat graph_noccurrences_$vid] |
| 14 |
global $var_graph_noccurrences |
| 15 |
set var_graph_save [concat graph_save_$vid] |
| 16 |
global $var_graph_save |
| 17 |
|
| 18 |
set cmd [concat $id dialog \ |
| 19 |
[eval concat $$var_graph_width] \ |
| 20 |
[eval concat $$var_graph_height] \ |
| 21 |
[eval concat $$var_graph_nvalues] \ |
| 22 |
[eval concat $$var_graph_noccurrences] \ |
| 23 |
[eval concat $$var_graph_save] \;] |
| 24 |
#puts stderr $cmd |
| 25 |
pdsend $cmd |
| 26 |
} |
| 27 |
|
| 28 |
proc probalizer_cancel {id} { |
| 29 |
set cmd [concat $id cancel \;] |
| 30 |
#puts stderr $cmd |
| 31 |
pdsend $cmd |
| 32 |
} |
| 33 |
|
| 34 |
proc probalizer_ok {id} { |
| 35 |
probalizer_apply $id |
| 36 |
probalizer_cancel $id |
| 37 |
} |
| 38 |
|
| 39 |
proc pdtk_probalizer_dialog {id width height nvalues noccurrences save } { |
| 40 |
set vid [string trimleft $id .] |
| 41 |
|
| 42 |
set var_graph_width [concat graph_width_$vid] |
| 43 |
global $var_graph_width |
| 44 |
set var_graph_height [concat graph_height_$vid] |
| 45 |
global $var_graph_height |
| 46 |
set var_graph_nvalues [concat graph_nvalues_$vid] |
| 47 |
global $var_graph_nvalues |
| 48 |
set var_graph_noccurrences [concat graph_noccurrences_$vid] |
| 49 |
global $var_graph_noccurrences |
| 50 |
set var_graph_save [concat graph_save_$vid] |
| 51 |
global $var_graph_save |
| 52 |
|
| 53 |
set $var_graph_width $width |
| 54 |
set $var_graph_height $height |
| 55 |
set $var_graph_nvalues $nvalues |
| 56 |
set $var_graph_noccurrences $noccurrences |
| 57 |
set $var_graph_save $save |
| 58 |
|
| 59 |
toplevel $id |
| 60 |
wm title $id {probalizer} |
| 61 |
wm protocol $id WM_DELETE_WINDOW [concat probalizer_cancel $id] |
| 62 |
|
| 63 |
label $id.label -text {PROBALIZER PROPERTIES} |
| 64 |
pack $id.label -side top |
| 65 |
|
| 66 |
frame $id.buttonframe |
| 67 |
pack $id.buttonframe -side bottom -fill x -pady 2m |
| 68 |
button $id.buttonframe.cancel -text {Cancel}\ |
| 69 |
-command "probalizer_cancel $id" |
| 70 |
button $id.buttonframe.apply -text {Apply}\ |
| 71 |
-command "probalizer_apply $id" |
| 72 |
button $id.buttonframe.ok -text {OK}\ |
| 73 |
-command "probalizer_ok $id" |
| 74 |
pack $id.buttonframe.cancel -side left -expand 1 |
| 75 |
pack $id.buttonframe.apply -side left -expand 1 |
| 76 |
pack $id.buttonframe.ok -side left -expand 1 |
| 77 |
|
| 78 |
frame $id.1rangef |
| 79 |
pack $id.1rangef -side top |
| 80 |
label $id.1rangef.lwidth -text "Width :" |
| 81 |
entry $id.1rangef.width -textvariable $var_graph_width -width 7 |
| 82 |
pack $id.1rangef.lwidth $id.1rangef.width -side left |
| 83 |
|
| 84 |
frame $id.2rangef |
| 85 |
pack $id.2rangef -side top |
| 86 |
label $id.2rangef.lheight -text "Height :" |
| 87 |
entry $id.2rangef.height -textvariable $var_graph_height -width 7 |
| 88 |
pack $id.2rangef.lheight $id.2rangef.height -side left |
| 89 |
|
| 90 |
frame $id.3rangef |
| 91 |
pack $id.3rangef -side top |
| 92 |
label $id.3rangef.lnvalues -text "Values :" |
| 93 |
entry $id.3rangef.nvalues -textvariable $var_graph_nvalues -width 7 |
| 94 |
pack $id.3rangef.lnvalues $id.3rangef.nvalues -side left |
| 95 |
|
| 96 |
frame $id.4rangef |
| 97 |
pack $id.4rangef -side top |
| 98 |
label $id.4rangef.lnoccurrences -text "Max Occurrences :" |
| 99 |
entry $id.4rangef.noccurrences -textvariable $var_graph_noccurrences -width 7 |
| 100 |
pack $id.4rangef.lnoccurrences $id.4rangef.noccurrences -side left |
| 101 |
|
| 102 |
checkbutton $id.save -text {Save contents} -variable $var_graph_save \ |
| 103 |
-anchor w |
| 104 |
pack $id.save -side top |
| 105 |
|
| 106 |
bind $id.1rangef.width <KeyPress-Return> [concat probalizer_ok $id] |
| 107 |
bind $id.2rangef.height <KeyPress-Return> [concat probalizer_ok $id] |
| 108 |
bind $id.3rangef.nvalues <KeyPress-Return> [concat probalizer_ok $id] |
| 109 |
bind $id.4rangef.noccurrences <KeyPress-Return> [concat probalizer_ok $id] |
| 110 |
focus $id.1rangef.width |
| 111 |
} |
| 112 |
|
| 113 |
############ probalizer procedures END -- [email protected] ######### |