aboutsummaryrefslogtreecommitdiff
path: root/colorgrid/colorgrid.tk
blob: b5bb173ee35c2089affa0ce69bdb795476e6d15a (plain)
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
############ colorgrid procedures  -- ydegoyon@free.fr        #########
package require Img

proc colorgrid_apply {id} {
# strip "." from the TK id to make a variable name suffix 
     set vid [string trimleft $id .]
# for each variable, make a local variable to hold its name...
     set var_graph_colorgrid [concat graph_colorgrid_$vid]
     global $var_graph_colorgrid
     set var_graph_xlines [concat graph_xlines_$vid]
     global $var_graph_xlines
     set var_graph_ylines [concat graph_ylines_$vid]
     global $var_graph_ylines
 
     set cmd [concat $id dialog \
     	[eval concat $$var_graph_xlines] \
     	[eval concat $$var_graph_ylines] \
     	[eval concat $$var_graph_colorgrid] \
 	\;]
     #puts stderr $cmd
     pd $cmd
}
 
proc colorgrid_cancel {id} {
     set cmd [concat $id cancel \;]
     #puts stderr $cmd
     pd $cmd
}
 
proc colorgrid_ok {id} {
     colorgrid_apply $id
     colorgrid_cancel $id
}
 
proc pdtk_colorgrid_dialog {id xlines ylines colorgrid} {
     set vid [string trimleft $id .]
     set var_graph_colorgrid [concat graph_colorgrid_$vid]
     global $var_graph_colorgrid
     set var_graph_xlines [concat graph_xlines_$vid]
     global $var_graph_xlines
     set var_graph_ylines [concat graph_ylines_$vid]
     global $var_graph_ylines
 
     set $var_graph_colorgrid $colorgrid
     set $var_graph_xlines $xlines
     set $var_graph_ylines $ylines
 
     toplevel $id
     wm title $id {colorgrid}
     wm protocol $id WM_DELETE_WINDOW [concat colorgrid_cancel $id]
 
     label $id.label -text {COLORGRID PROPERTIES}
     pack $id.label -side top
 
     frame $id.buttonframe
     pack $id.buttonframe -side bottom -fill x -pady 2m
     button $id.buttonframe.cancel -text {Cancel}\
     	-command "colorgrid_cancel $id"
     button $id.buttonframe.apply -text {Apply}\
     	-command "colorgrid_apply $id"
     button $id.buttonframe.ok -text {OK}\
     	-command "colorgrid_ok $id"
     pack $id.buttonframe.cancel -side left -expand 1
     pack $id.buttonframe.apply -side left -expand 1
     pack $id.buttonframe.ok -side left -expand 1
     
     frame $id.42rangef
     pack $id.42rangef -side top
     label $id.42rangef.lxlines -text "X sections :"
     entry $id.42rangef.xlines -textvariable $var_graph_xlines -width 7
     pack $id.42rangef.lxlines $id.42rangef.xlines -side left
 
     frame $id.72rangef
     pack $id.72rangef -side top
     label $id.72rangef.lylines -text "Y sections :"
     entry $id.72rangef.ylines -textvariable $var_graph_ylines -width 7
     pack $id.72rangef.lylines $id.72rangef.ylines -side left
 
     checkbutton $id.showcolorgrid -text {Show Grid} -variable $var_graph_colorgrid \
     	-anchor w
     pack $id.showcolorgrid -side top
 
     bind $id.42rangef.xlines <KeyPress-Return> [concat colorgrid_ok $id]
     bind $id.72rangef.ylines <KeyPress-Return> [concat colorgrid_ok $id]
     focus $id.42rangef.xlines
}

############ colorgrid procedures END -- lluis@artefacte.org     #########