Debian Codegraph @

playlist.tcl

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