diff options
Diffstat (limited to 'grid/grid.tk2c')
-rw-r--r-- | grid/grid.tk2c | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/grid/grid.tk2c b/grid/grid.tk2c new file mode 100644 index 0000000..3e8f18f --- /dev/null +++ b/grid/grid.tk2c @@ -0,0 +1,164 @@ +// ########### grid procedures -- ydegoyon@free.fr ######### +sys_gui("proc grid_apply {id} {\n"); +// strip "." from the TK id to make a variable name suffix +sys_gui("set vid [string trimleft $id .]\n"); +// for each variable, make a local variable to hold its name... +sys_gui("set var_graph_name [concat graph_name_$vid]\n"); +sys_gui("global $var_graph_name\n"); +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_xmin [concat graph_xmin_$vid]\n"); +sys_gui("global $var_graph_xmin\n"); +sys_gui("set var_graph_xmax [concat graph_xmax_$vid]\n"); +sys_gui("global $var_graph_xmax\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set var_graph_ymin [concat graph_ymin_$vid]\n"); +sys_gui("global $var_graph_ymin\n"); +sys_gui("set var_graph_ymax [concat graph_ymax_$vid]\n"); +sys_gui("global $var_graph_ymax\n"); +sys_gui("set var_graph_grid [concat graph_grid_$vid]\n"); +sys_gui("global $var_graph_grid\n"); +sys_gui("set var_graph_xstep [concat graph_xstep_$vid]\n"); +sys_gui("global $var_graph_xstep\n"); +sys_gui("set var_graph_ystep [concat graph_ystep_$vid]\n"); +sys_gui("global $var_graph_ystep\n"); +sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n"); +sys_gui("global $var_graph_xlines\n"); +sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n"); +sys_gui("global $var_graph_ylines\n"); +sys_gui("set cmd [concat $id dialog [eval concat $$var_graph_name] [eval concat $$var_graph_width] [eval concat $$var_graph_xmin] [eval concat $$var_graph_xmax] [eval concat $$var_graph_height] [eval concat $$var_graph_ymin] [eval concat $$var_graph_ymax] [eval concat $$var_graph_grid] [eval concat $$var_graph_xstep] [eval concat $$var_graph_ystep] [eval concat $$var_graph_xlines] [eval concat $$var_graph_ylines] \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc grid_cancel {id} {\n"); +sys_gui("set cmd [concat $id cancel \\;]\n"); +// puts stderr $cmd +sys_gui("pd $cmd\n"); +sys_gui("}\n"); +sys_gui("proc grid_ok {id} {\n"); +sys_gui("grid_apply $id\n"); +sys_gui("grid_cancel $id\n"); +sys_gui("}\n"); +sys_gui("proc pdtk_grid_dialog {id name width xmin xmax height ymin ymax grid xstep ystep xlines ylines} {\n"); +sys_gui("set vid [string trimleft $id .]\n"); +sys_gui("set var_graph_name [concat graph_name_$vid]\n"); +sys_gui("global $var_graph_name\n"); +sys_gui("set var_graph_width [concat graph_width_$vid]\n"); +sys_gui("global $var_graph_width\n"); +sys_gui("set var_graph_xmin [concat graph_xmin_$vid]\n"); +sys_gui("global $var_graph_xmin\n"); +sys_gui("set var_graph_xmax [concat graph_xmax_$vid]\n"); +sys_gui("global $var_graph_xmax\n"); +sys_gui("set var_graph_height [concat graph_height_$vid]\n"); +sys_gui("global $var_graph_height\n"); +sys_gui("set var_graph_ymin [concat graph_ymin_$vid]\n"); +sys_gui("global $var_graph_ymin\n"); +sys_gui("set var_graph_ymax [concat graph_ymax_$vid]\n"); +sys_gui("global $var_graph_ymax\n"); +sys_gui("set var_graph_grid [concat graph_grid_$vid]\n"); +sys_gui("global $var_graph_grid\n"); +sys_gui("set var_graph_xstep [concat graph_xstep_$vid]\n"); +sys_gui("global $var_graph_xstep\n"); +sys_gui("set var_graph_ystep [concat graph_ystep_$vid]\n"); +sys_gui("global $var_graph_ystep\n"); +sys_gui("set var_graph_xlines [concat graph_xlines_$vid]\n"); +sys_gui("global $var_graph_xlines\n"); +sys_gui("set var_graph_ylines [concat graph_ylines_$vid]\n"); +sys_gui("global $var_graph_ylines\n"); +sys_gui("set $var_graph_name $name\n"); +sys_gui("set $var_graph_width $width\n"); +sys_gui("set $var_graph_xmin $xmin\n"); +sys_gui("set $var_graph_xmax $xmax\n"); +sys_gui("set $var_graph_height $height\n"); +sys_gui("set $var_graph_ymin $ymin\n"); +sys_gui("set $var_graph_ymax $ymax\n"); +sys_gui("set $var_graph_grid $grid\n"); +sys_gui("set $var_graph_xstep $xstep\n"); +sys_gui("set $var_graph_ystep $ystep\n"); +sys_gui("set $var_graph_xlines $xlines\n"); +sys_gui("set $var_graph_ylines $ylines\n"); +sys_gui("toplevel $id\n"); +sys_gui("wm title $id {grid}\n"); +sys_gui("wm protocol $id WM_DELETE_WINDOW [concat grid_cancel $id]\n"); +sys_gui("label $id.label -text {GRID PROPERTIES}\n"); +sys_gui("pack $id.label -side top\n"); +sys_gui("frame $id.buttonframe\n"); +sys_gui("pack $id.buttonframe -side bottom -fill x -pady 2m\n"); +sys_gui("button $id.buttonframe.cancel -text {Cancel} -command \"grid_cancel $id\"\n"); +sys_gui("button $id.buttonframe.apply -text {Apply} -command \"grid_apply $id\"\n"); +sys_gui("button $id.buttonframe.ok -text {OK} -command \"grid_ok $id\"\n"); +sys_gui("pack $id.buttonframe.cancel -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.apply -side left -expand 1\n"); +sys_gui("pack $id.buttonframe.ok -side left -expand 1\n"); +sys_gui("frame $id.1rangef\n"); +sys_gui("pack $id.1rangef -side top\n"); +sys_gui("label $id.1rangef.lname -text \"Name :\"\n"); +sys_gui("entry $id.1rangef.name -textvariable $var_graph_name -width 7\n"); +sys_gui("pack $id.1rangef.lname $id.1rangef.name -side left\n"); +sys_gui("frame $id.2rangef\n"); +sys_gui("pack $id.2rangef -side top\n"); +sys_gui("label $id.2rangef.lwidth -text \"Width :\"\n"); +sys_gui("entry $id.2rangef.width -textvariable $var_graph_width -width 7\n"); +sys_gui("pack $id.2rangef.lwidth $id.2rangef.width -side left\n"); +sys_gui("frame $id.3rangef\n"); +sys_gui("pack $id.3rangef -side top\n"); +sys_gui("label $id.3rangef.lxmin -text \"X min :\"\n"); +sys_gui("entry $id.3rangef.xmin -textvariable $var_graph_xmin -width 7\n"); +sys_gui("pack $id.3rangef.lxmin $id.3rangef.xmin -side left\n"); +sys_gui("frame $id.4rangef\n"); +sys_gui("pack $id.4rangef -side top\n"); +sys_gui("label $id.4rangef.lxmax -text \"X max :\"\n"); +sys_gui("entry $id.4rangef.xmax -textvariable $var_graph_xmax -width 7\n"); +sys_gui("pack $id.4rangef.lxmax $id.4rangef.xmax -side left\n"); +sys_gui("frame $id.41rangef\n"); +sys_gui("pack $id.41rangef -side top\n"); +sys_gui("label $id.41rangef.lxstep -text \"X step :\"\n"); +sys_gui("entry $id.41rangef.xstep -textvariable $var_graph_xstep -width 7\n"); +sys_gui("pack $id.41rangef.lxstep $id.41rangef.xstep -side left\n"); +sys_gui("frame $id.42rangef\n"); +sys_gui("pack $id.42rangef -side top\n"); +sys_gui("label $id.42rangef.lxlines -text \"X sections :\"\n"); +sys_gui("entry $id.42rangef.xlines -textvariable $var_graph_xlines -width 7\n"); +sys_gui("pack $id.42rangef.lxlines $id.42rangef.xlines -side left\n"); +sys_gui("frame $id.5rangef\n"); +sys_gui("pack $id.5rangef -side top\n"); +sys_gui("label $id.5rangef.lheight -text \"Height :\"\n"); +sys_gui("entry $id.5rangef.height -textvariable $var_graph_height -width 7\n"); +sys_gui("pack $id.5rangef.lheight $id.5rangef.height -side left\n"); +sys_gui("frame $id.6rangef\n"); +sys_gui("pack $id.6rangef -side top\n"); +sys_gui("label $id.6rangef.lymin -text \"Y min :\"\n"); +sys_gui("entry $id.6rangef.ymin -textvariable $var_graph_ymin -width 7\n"); +sys_gui("pack $id.6rangef.lymin $id.6rangef.ymin -side left\n"); +sys_gui("frame $id.7rangef\n"); +sys_gui("pack $id.7rangef -side top\n"); +sys_gui("label $id.7rangef.lymax -text \"Y max :\"\n"); +sys_gui("entry $id.7rangef.ymax -textvariable $var_graph_ymax -width 7\n"); +sys_gui("pack $id.7rangef.lymax $id.7rangef.ymax -side left\n"); +sys_gui("frame $id.71rangef\n"); +sys_gui("pack $id.71rangef -side top\n"); +sys_gui("label $id.71rangef.lystep -text \"Y step :\"\n"); +sys_gui("entry $id.71rangef.ystep -textvariable $var_graph_ystep -width 7\n"); +sys_gui("pack $id.71rangef.lystep $id.71rangef.ystep -side left\n"); +sys_gui("frame $id.72rangef\n"); +sys_gui("pack $id.72rangef -side top\n"); +sys_gui("label $id.72rangef.lylines -text \"Y sections :\"\n"); +sys_gui("entry $id.72rangef.ylines -textvariable $var_graph_ylines -width 7\n"); +sys_gui("pack $id.72rangef.lylines $id.72rangef.ylines -side left\n"); +sys_gui("checkbutton $id.showgrid -text {Show Grid} -variable $var_graph_grid -anchor w\n"); +sys_gui("pack $id.showgrid -side top\n"); +sys_gui("bind $id.1rangef.name <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.2rangef.width <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.3rangef.xmin <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.4rangef.xmax <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.41rangef.xstep <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.42rangef.xlines <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.5rangef.height <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.6rangef.ymin <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.7rangef.ymax <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.71rangef.ystep <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("bind $id.72rangef.ylines <KeyPress-Return> [concat grid_ok $id]\n"); +sys_gui("focus $id.1rangef.name\n"); +sys_gui("}\n"); +// ########### grid procedures END -- ydegoyon@free.fr ######### |