Debian Codegraph @

scrolllist.tcl

raw
1 ############ scrolllist procedures -- [email protected] #########
2
3 proc scrolllist_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_capacity [concat graph_capacity_$vid]
8 global $var_graph_capacity
9 set var_graph_width [concat graph_width_$vid]
10 global $var_graph_width
11 set var_graph_height [concat graph_height$vid]
12 global $var_graph_height
13 set var_graph_font [concat graph_font$vid]
14 global $var_graph_font
15 set var_graph_bgcolor [concat graph_bgcolor$vid]
16 global $var_graph_bgcolor
17 set var_graph_fgcolor [concat graph_fgcolor$vid]
18 global $var_graph_fgcolor
19 set var_graph_secolor [concat graph_secolor$vid]
20 global $var_graph_secolor
21
22 set cmd [concat $id dialog \
23 [eval concat $$var_graph_capacity] \
24 [eval concat $$var_graph_width] \
25 [eval concat $$var_graph_height] \
26 [eval concat $$var_graph_font] \
27 [eval concat $$var_graph_bgcolor] \
28 [eval concat $$var_graph_fgcolor] \
29 [eval concat $$var_graph_secolor] \
30 \;]
31 #puts stderr $cmd
32 pdsend $cmd
33 }
34
35 proc scrolllist_cancel {id} {
36 set cmd [concat $id cancel \;]
37 #puts stderr $cmd
38 pdsend $cmd
39 }
40
41 proc scrolllist_ok {id} {
42 scrolllist_apply $id
43 scrolllist_cancel $id
44 }
45
46 proc pdtk_scrolllist_dialog {id capacity width height font bgcolor fgcolor secolor} {
47 set vid [string trimleft $id .]
48 set var_graph_capacity [concat graph_capacity_$vid]
49 global $var_graph_capacity
50 set var_graph_width [concat graph_width_$vid]
51 global $var_graph_width
52 set var_graph_height [concat graph_height$vid]
53 global $var_graph_height
54 set var_graph_font [concat graph_font$vid]
55 global $var_graph_font
56 set var_graph_bgcolor [concat graph_bgcolor$vid]
57 global $var_graph_bgcolor
58 set var_graph_fgcolor [concat graph_fgcolor$vid]
59 global $var_graph_fgcolor
60 set var_graph_secolor [concat graph_secolor$vid]
61 global $var_graph_secolor
62
63 set $var_graph_capacity $capacity
64 set $var_graph_width $width
65 set $var_graph_height $height
66 set $var_graph_font $font
67 set $var_graph_bgcolor $bgcolor
68 set $var_graph_fgcolor $fgcolor
69 set $var_graph_secolor $secolor
70
71 toplevel $id
72 wm title $id {scrolllist}
73 wm protocol $id WM_DELETE_WINDOW [concat scrolllist_cancel $id]
74
75 label $id.label -text {SCROLLLIST PROPERTIES}
76 pack $id.label -side top
77
78 frame $id.buttonframe
79 pack $id.buttonframe -side bottom -fill x -pady 2m
80 button $id.buttonframe.cancel -text {Cancel}\
81 -command "scrolllist_cancel $id"
82 button $id.buttonframe.apply -text {Apply}\
83 -command "scrolllist_apply $id"
84 button $id.buttonframe.ok -text {OK}\
85 -command "scrolllist_ok $id"
86 pack $id.buttonframe.cancel -side left -expand 1
87 pack $id.buttonframe.apply -side left -expand 1
88 pack $id.buttonframe.ok -side left -expand 1
89
90 frame $id.1rangef
91 pack $id.1rangef -side top
92 label $id.1rangef.lcapacity -text "Capacity :"
93 entry $id.1rangef.capacity -textvariable $var_graph_capacity -width 7
94 pack $id.1rangef.lcapacity $id.1rangef.capacity -side left
95
96 frame $id.2rangef
97 pack $id.2rangef -side top
98 label $id.2rangef.lwidth -text "Width :"
99 entry $id.2rangef.width -textvariable $var_graph_width -width 7
100 pack $id.2rangef.lwidth $id.2rangef.width -side left
101
102 frame $id.3rangef
103 pack $id.3rangef -side top
104 label $id.3rangef.lheight -text "Height :"
105 entry $id.3rangef.height -textvariable $var_graph_height -width 7
106 pack $id.3rangef.lheight $id.3rangef.height -side left
107
108 frame $id.3_5rangef
109 pack $id.3_5rangef -side top
110 label $id.3_5rangef.lfont -text "Font :"
111 entry $id.3_5rangef.font -textvariable $var_graph_font -width 30
112 pack $id.3_5rangef.lfont $id.3_5rangef.font -side left
113
114 frame $id.4rangef
115 pack $id.4rangef -side top
116 label $id.4rangef.lbgcolor -text "Background Color :"
117 entry $id.4rangef.bgcolor -textvariable $var_graph_bgcolor -width 7
118 pack $id.4rangef.lbgcolor $id.4rangef.bgcolor -side left
119
120 frame $id.5rangef
121 pack $id.5rangef -side top
122 label $id.5rangef.lfgcolor -text "Foreground Color :"
123 entry $id.5rangef.fgcolor -textvariable $var_graph_fgcolor -width 7
124 pack $id.5rangef.lfgcolor $id.5rangef.fgcolor -side left
125
126 frame $id.6rangef
127 pack $id.6rangef -side top
128 label $id.6rangef.lsecolor -text "Selection Color :"
129 entry $id.6rangef.secolor -textvariable $var_graph_secolor -width 7
130 pack $id.6rangef.lsecolor $id.6rangef.secolor -side left
131
132 bind $id.1rangef.capacity <KeyPress-Return> [concat scrolllist_ok $id]
133 bind $id.2rangef.width <KeyPress-Return> [concat scrolllist_ok $id]
134 bind $id.3rangef.height <KeyPress-Return> [concat scrolllist_ok $id]
135 bind $id.3_5rangef.font <KeyPress-Return> [concat scrolllist_ok $id]
136 bind $id.4rangef.bgcolor <KeyPress-Return> [concat scrolllist_ok $id]
137 bind $id.5rangef.fgcolor <KeyPress-Return> [concat scrolllist_ok $id]
138 bind $id.6rangef.secolor <KeyPress-Return> [concat scrolllist_ok $id]
139 }
140
141 ############ scrolllist procedures END -- [email protected] #########