Mercurial > audlegacy
annotate audacious/widgets/vis.c @ 2179:8bdcac47760b trunk
[svn] Keep the voiceprint inside the range for the theme.
author | marvin |
---|---|
date | Tue, 19 Dec 2006 15:13:17 -0800 |
parents | 7267fc6b2c67 |
children | 65ca93cd72bf |
rev | line source |
---|---|
1653 | 1 /* BMP - Cross-platform multimedia player |
2 * Copyright (C) 2003-2004 BMP development team. | |
3 * | |
4 * Based on XMMS: | |
5 * Copyright (C) 1998-2003 XMMS development team. | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 */ | |
21 | |
22 #include "widgetcore.h" | |
23 | |
24 #include <glib.h> | |
25 #include <gdk/gdk.h> | |
26 #include <string.h> | |
27 | |
28 #include "main.h" | |
29 #include "skin.h" | |
30 #include "widget.h" | |
31 | |
32 static const gfloat vis_afalloff_speeds[] = { 0.34, 0.5, 1.0, 1.3, 1.6 }; | |
33 static const gfloat vis_pfalloff_speeds[] = { 1.2, 1.3, 1.4, 1.5, 1.6 }; | |
34 static const gint vis_redraw_delays[] = { 1, 2, 4, 8 }; | |
35 static const guint8 vis_scope_colors[] = | |
36 { 21, 21, 20, 20, 19, 19, 18, 19, 19, 20, 20, 21, 21 }; | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
37 static guint8 vs_data_ext[1216]; |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
38 |
1653 | 39 |
40 void | |
41 vis_timeout_func(Vis * vis, guchar * data) | |
42 { | |
43 static GTimer *timer = NULL; | |
44 gulong micros = 9999999; | |
45 gboolean falloff = FALSE; | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
46 gint i, n; |
1653 | 47 |
48 if (!timer) { | |
49 timer = g_timer_new(); | |
50 g_timer_start(timer); | |
51 } | |
52 else { | |
53 g_timer_elapsed(timer, µs); | |
54 if (micros > 14000) | |
55 g_timer_reset(timer); | |
56 | |
57 } | |
58 | |
59 if (cfg.vis_type == VIS_ANALYZER) { | |
60 if (micros > 14000) | |
61 falloff = TRUE; | |
62 if (data || falloff) { | |
63 for (i = 0; i < 75; i++) { | |
64 if (data && data[i] > vis->vs_data[i]) { | |
65 vis->vs_data[i] = data[i]; | |
66 if (vis->vs_data[i] > vis->vs_peak[i]) { | |
67 vis->vs_peak[i] = vis->vs_data[i]; | |
68 vis->vs_peak_speed[i] = 0.01; | |
69 | |
70 } | |
71 else if (vis->vs_peak[i] > 0.0) { | |
72 vis->vs_peak[i] -= vis->vs_peak_speed[i]; | |
73 vis->vs_peak_speed[i] *= | |
74 vis_pfalloff_speeds[cfg.peaks_falloff]; | |
75 if (vis->vs_peak[i] < vis->vs_data[i]) | |
76 vis->vs_peak[i] = vis->vs_data[i]; | |
77 if (vis->vs_peak[i] < 0.0) | |
78 vis->vs_peak[i] = 0.0; | |
79 } | |
80 } | |
81 else if (falloff) { | |
82 if (vis->vs_data[i] > 0.0) { | |
83 vis->vs_data[i] -= | |
84 vis_afalloff_speeds[cfg.analyzer_falloff]; | |
85 if (vis->vs_data[i] < 0.0) | |
86 vis->vs_data[i] = 0.0; | |
87 } | |
88 if (vis->vs_peak[i] > 0.0) { | |
89 vis->vs_peak[i] -= vis->vs_peak_speed[i]; | |
90 vis->vs_peak_speed[i] *= | |
91 vis_pfalloff_speeds[cfg.peaks_falloff]; | |
92 if (vis->vs_peak[i] < vis->vs_data[i]) | |
93 vis->vs_peak[i] = vis->vs_data[i]; | |
94 if (vis->vs_peak[i] < 0.0) | |
95 vis->vs_peak[i] = 0.0; | |
96 } | |
97 } | |
98 } | |
99 } | |
100 } | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
101 else if (cfg.vis_type == VIS_VOICEPRINT && data){ |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
102 for(i = 0; i < 16; i++) |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
103 { |
2179
8bdcac47760b
[svn] Keep the voiceprint inside the range for the theme.
marvin
parents:
2171
diff
changeset
|
104 /*The color palette is in the range [0-17]. This makes sure we stay there.*/ |
8bdcac47760b
[svn] Keep the voiceprint inside the range for the theme.
marvin
parents:
2171
diff
changeset
|
105 vis->vs_data[i] = data[15 - i] > 17 ? 17 : data[15-i]; |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
106 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
107 } |
1653 | 108 else if (data) { |
109 for (i = 0; i < 75; i++) | |
110 vis->vs_data[i] = data[i]; | |
111 } | |
112 | |
113 if (micros > 14000) { | |
114 if (!vis->vs_refresh_delay) { | |
115 vis_draw((Widget *) vis); | |
116 vis->vs_refresh_delay = vis_redraw_delays[cfg.vis_refresh]; | |
117 | |
118 } | |
119 vis->vs_refresh_delay--; | |
120 } | |
121 } | |
122 | |
123 void | |
124 vis_draw(Widget * w) | |
125 { | |
126 Vis *vis = (Vis *) w; | |
127 gint x, y, h = 0, h2; | |
128 guchar vis_color[24][3]; | |
129 guchar rgb_data[152 * 32], *ptr, c; | |
130 guint32 colors[24]; | |
131 GdkRgbCmap *cmap; | |
132 | |
133 if (!vis->vs_widget.visible) | |
134 return; | |
135 | |
136 skin_get_viscolor(bmp_active_skin, vis_color); | |
137 for (y = 0; y < 24; y++) { | |
138 colors[y] = | |
139 vis_color[y][0] << 16 | vis_color[y][1] << 8 | vis_color[y][2]; | |
140 } | |
141 cmap = gdk_rgb_cmap_new(colors, 24); | |
142 | |
1938 | 143 if (!vis->vs_doublesize) { |
144 memset(rgb_data, 0, 76 * 16); | |
145 for (y = 1; y < 16; y += 2) { | |
146 ptr = rgb_data + (y * 76); | |
147 for (x = 0; x < 76; x += 2, ptr += 2) | |
148 *ptr = 1; | |
149 } | |
150 if (cfg.vis_type == VIS_ANALYZER) { | |
151 for (x = 0; x < 75; x++) { | |
152 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) | |
153 h = vis->vs_data[x >> 2]; | |
154 else if (cfg.analyzer_type == ANALYZER_LINES) | |
155 h = vis->vs_data[x]; | |
156 if (h && (cfg.analyzer_type == ANALYZER_LINES || | |
157 (x % 4) != 3)) { | |
158 ptr = rgb_data + ((16 - h) * 76) + x; | |
159 switch (cfg.analyzer_mode) { | |
160 case ANALYZER_NORMAL: | |
161 for (y = 0; y < h; y++, ptr += 76) | |
162 *ptr = 18 - h + y; | |
163 break; | |
164 case ANALYZER_FIRE: | |
165 for (y = 0; y < h; y++, ptr += 76) | |
166 *ptr = y + 2; | |
167 break; | |
168 case ANALYZER_VLINES: | |
169 for (y = 0; y < h; y++, ptr += 76) | |
170 *ptr = 18 - h; | |
171 break; | |
172 } | |
173 } | |
174 } | |
175 if (cfg.analyzer_peaks) { | |
176 for (x = 0; x < 75; x++) { | |
177 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) | |
178 h = vis->vs_peak[x >> 2]; | |
179 else if (cfg.analyzer_type == ANALYZER_LINES) | |
180 h = vis->vs_peak[x]; | |
181 if (h | |
182 && (cfg.analyzer_type == ANALYZER_LINES | |
183 || (x % 4) != 3)) | |
184 rgb_data[(16 - h) * 76 + x] = 23; | |
1653 | 185 } |
186 } | |
187 } | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
188 else if (cfg.vis_type == VIS_VOICEPRINT) { |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
189 for (y = 0; y < 16; y ++) { |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
190 |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
191 for (x = 74; x > 0; x--) |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
192 { |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
193 vs_data_ext[x + (y * 76)] = vs_data_ext[x-1+(y*76)]; |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
194 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
195 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
196 for(y=0;y<16;y++){ |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
197 vs_data_ext[y * 76] = vis->vs_data[y]; |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
198 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
199 |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
200 memcpy(rgb_data, vs_data_ext,1216); |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
201 |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
202 } |
1938 | 203 else if (cfg.vis_type == VIS_SCOPE) { |
1653 | 204 for (x = 0; x < 75; x++) { |
1938 | 205 switch (cfg.scope_mode) { |
206 case SCOPE_DOT: | |
207 h = vis->vs_data[x]; | |
208 ptr = rgb_data + ((15 - h) * 76) + x; | |
209 *ptr = vis_scope_colors[h]; | |
210 break; | |
211 case SCOPE_LINE: | |
212 if (x != 74) { | |
213 h = 15 - vis->vs_data[x]; | |
214 h2 = 15 - vis->vs_data[x + 1]; | |
215 if (h > h2) { | |
216 y = h; | |
217 h = h2; | |
218 h2 = y; | |
219 } | |
220 ptr = rgb_data + (h * 76) + x; | |
221 for (y = h; y <= h2; y++, ptr += 76) | |
222 *ptr = vis_scope_colors[y - 3]; | |
223 | |
224 } | |
225 else { | |
226 h = 15 - vis->vs_data[x]; | |
227 ptr = rgb_data + (h * 76) + x; | |
228 *ptr = vis_scope_colors[h]; | |
229 } | |
230 break; | |
231 case SCOPE_SOLID: | |
1653 | 232 h = 15 - vis->vs_data[x]; |
1938 | 233 h2 = 9; |
234 c = vis_scope_colors[(gint) vis->vs_data[x]]; | |
1653 | 235 if (h > h2) { |
236 y = h; | |
237 h = h2; | |
238 h2 = y; | |
239 } | |
240 ptr = rgb_data + (h * 76) + x; | |
241 for (y = h; y <= h2; y++, ptr += 76) | |
1938 | 242 *ptr = c; |
243 break; | |
244 } | |
245 } | |
246 } | |
247 | |
248 /* FIXME: The check "shouldn't" be neccessary? */ | |
249 /* if (GTK_IS_WINDOW(vis->vs_window)) { */ | |
250 GDK_THREADS_ENTER(); | |
251 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, | |
252 vis->vs_widget.x, vis->vs_widget.y, | |
253 vis->vs_widget.width, vis->vs_widget.height, | |
254 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, | |
255 76, cmap); | |
256 GDK_THREADS_LEAVE(); | |
257 /* } else { | |
258 vis->vs_window = mainwin->window; | |
259 GDK_THREADS_ENTER(); | |
260 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, | |
261 vis->vs_widget.x, vis->vs_widget.y, | |
262 vis->vs_widget.width, vis->vs_widget.height, | |
263 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data, | |
264 76, cmap); | |
265 GDK_THREADS_LEAVE(); | |
266 } | |
267 */ | |
268 } | |
269 else { | |
270 memset(rgb_data, 0, 152 * 32); | |
271 for (y = 1; y < 16; y += 2) { | |
272 ptr = rgb_data + (y * 304); | |
273 for (x = 0; x < 76; x += 2, ptr += 4) { | |
274 *ptr = 1; | |
275 *(ptr + 1) = 1; | |
276 *(ptr + 152) = 1; | |
277 *(ptr + 153) = 1; | |
278 } | |
279 } | |
280 if (cfg.vis_type == VIS_ANALYZER) { | |
281 for (x = 0; x < 75; x++) { | |
282 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) | |
283 h = vis->vs_data[x >> 2]; | |
284 else if (cfg.analyzer_type == ANALYZER_LINES) | |
285 h = vis->vs_data[x]; | |
286 if (h | |
287 && (cfg.analyzer_type == ANALYZER_LINES | |
288 || (x % 4) != 3)) { | |
289 ptr = rgb_data + ((16 - h) * 304) + (x << 1); | |
290 switch (cfg.analyzer_mode) { | |
291 case ANALYZER_NORMAL: | |
292 for (y = 0; y < h; y++, ptr += 304) { | |
293 *ptr = 18 - h + y; | |
294 *(ptr + 1) = 18 - h + y; | |
295 *(ptr + 152) = 18 - h + y; | |
296 *(ptr + 153) = 18 - h + y; | |
297 } | |
298 break; | |
299 case ANALYZER_FIRE: | |
300 for (y = 0; y < h; y++, ptr += 304) { | |
301 *ptr = y + 2; | |
302 *(ptr + 1) = y + 2; | |
303 *(ptr + 152) = y + 2; | |
304 *(ptr + 153) = y + 2; | |
305 } | |
306 break; | |
307 case ANALYZER_VLINES: | |
308 for (y = 0; y < h; y++, ptr += 304) { | |
309 *ptr = 18 - h; | |
310 *(ptr + 1) = 18 - h; | |
311 *(ptr + 152) = 18 - h; | |
312 *(ptr + 153) = 18 - h; | |
313 } | |
314 | |
315 break; | |
316 } | |
1653 | 317 |
318 } | |
1938 | 319 } |
320 if (cfg.analyzer_peaks) { | |
321 | |
322 for (x = 0; x < 75; x++) { | |
323 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0) | |
324 h = vis->vs_peak[x >> 2]; | |
325 else if (cfg.analyzer_type == ANALYZER_LINES) | |
326 h = vis->vs_peak[x]; | |
327 | |
328 if (h | |
329 && (cfg.analyzer_type == ANALYZER_LINES | |
330 || (x % 4) != 3)) { | |
331 ptr = rgb_data + (16 - h) * 304 + (x << 1); | |
332 *ptr = 23; | |
333 *(ptr + 1) = 23; | |
334 *(ptr + 152) = 23; | |
335 *(ptr + 153) = 23; | |
336 } | |
1653 | 337 } |
338 } | |
339 } | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
340 else if (cfg.vis_type == VIS_VOICEPRINT) { |
2171 | 341 for (y = 0; y < 15; y ++) { |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
342 for (x = 74; x > 0; x--) |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
343 { |
2171 | 344 ptr = rgb_data + (x << 1) + y * 304; |
345 vs_data_ext[x + y * 76] = vs_data_ext[x - 1 + y * 76]; | |
346 *ptr = vs_data_ext[x - 1 + y * 76]; | |
347 *(ptr+1) = vs_data_ext[x - 1 + y * 76]; | |
348 | |
349 //FIXME. Currently only every other line is shown in | |
350 //doublesize mode. | |
351 //*(ptr+304) = vs_data_ext[x + y * 76]; | |
352 //*(ptr+1+304) = vs_data_ext[x - 1 + y * 76]; | |
2161
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
353 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
354 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
355 for(y=0;y<16;y++){ |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
356 vs_data_ext[y * 76] = vis->vs_data[y]; |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
357 } |
c12319817d7e
[svn] - patch to add a scrolling voiceprint to the mini visualizer.
nenolod
parents:
1938
diff
changeset
|
358 } |
1938 | 359 else if (cfg.vis_type == VIS_SCOPE) { |
360 for (x = 0; x < 75; x++) { | |
361 switch (cfg.scope_mode) { | |
362 case SCOPE_DOT: | |
363 h = vis->vs_data[x]; | |
364 ptr = rgb_data + ((15 - h) * 304) + (x << 1); | |
365 *ptr = vis_scope_colors[h]; | |
366 *(ptr + 1) = vis_scope_colors[h]; | |
367 *(ptr + 152) = vis_scope_colors[h]; | |
368 *(ptr + 153) = vis_scope_colors[h]; | |
369 break; | |
370 case SCOPE_LINE: | |
371 if (x != 74) { | |
372 h = 15 - vis->vs_data[x]; | |
373 h2 = 15 - vis->vs_data[x + 1]; | |
374 if (h > h2) { | |
375 y = h; | |
376 h = h2; | |
377 h2 = y; | |
378 } | |
379 ptr = rgb_data + (h * 304) + (x << 1); | |
380 for (y = h; y <= h2; y++, ptr += 304) { | |
381 *ptr = vis_scope_colors[y - 3]; | |
382 *(ptr + 1) = vis_scope_colors[y - 3]; | |
383 *(ptr + 152) = vis_scope_colors[y - 3]; | |
384 *(ptr + 153) = vis_scope_colors[y - 3]; | |
385 } | |
386 } | |
387 else { | |
388 h = 15 - vis->vs_data[x]; | |
389 ptr = rgb_data + (h * 304) + (x << 1); | |
390 *ptr = vis_scope_colors[h]; | |
391 *(ptr + 1) = vis_scope_colors[h]; | |
392 *(ptr + 152) = vis_scope_colors[h]; | |
393 *(ptr + 153) = vis_scope_colors[h]; | |
394 } | |
395 break; | |
396 case SCOPE_SOLID: | |
397 h = 15 - vis->vs_data[x]; | |
398 h2 = 9; | |
399 c = vis_scope_colors[(gint) vis->vs_data[x]]; | |
400 if (h > h2) { | |
401 y = h; | |
402 h = h2; | |
403 h2 = y; | |
404 } | |
405 ptr = rgb_data + (h * 304) + (x << 1); | |
406 for (y = h; y <= h2; y++, ptr += 304) { | |
407 *ptr = c; | |
408 *(ptr + 1) = c; | |
409 *(ptr + 152) = c; | |
410 *(ptr + 153) = c; | |
411 } | |
412 break; | |
413 } | |
414 } | |
415 } | |
1653 | 416 |
417 GDK_THREADS_ENTER(); | |
418 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc, | |
1938 | 419 vis->vs_widget.x << 1, |
420 vis->vs_widget.y << 1, | |
421 vis->vs_widget.width << 1, | |
422 vis->vs_widget.height << 1, | |
423 GDK_RGB_DITHER_NONE, (guchar *) rgb_data, | |
424 152, cmap); | |
1653 | 425 GDK_THREADS_LEAVE(); |
1938 | 426 } |
1653 | 427 |
428 gdk_rgb_cmap_free(cmap); | |
429 } | |
430 | |
431 void | |
432 vis_clear_data(Vis * vis) | |
433 { | |
434 gint i; | |
435 | |
436 if (!vis) | |
437 return; | |
438 | |
439 for (i = 0; i < 75; i++) { | |
440 vis->vs_data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0; | |
441 vis->vs_peak[i] = 0; | |
442 } | |
443 } | |
444 | |
445 void | |
1938 | 446 vis_set_doublesize(Vis * vis, gboolean doublesize) |
447 { | |
448 vis->vs_doublesize = doublesize; | |
449 } | |
450 | |
451 void | |
1653 | 452 vis_clear(Vis * vis) |
453 { | |
1938 | 454 if (!vis->vs_doublesize) |
455 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x, | |
456 vis->vs_widget.y, vis->vs_widget.width, | |
457 vis->vs_widget.height); | |
458 else | |
459 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x << 1, | |
460 vis->vs_widget.y << 1, | |
461 vis->vs_widget.width << 1, | |
462 vis->vs_widget.height << 1); | |
1653 | 463 } |
464 | |
465 void | |
466 vis_set_window(Vis * vis, GdkWindow * window) | |
467 { | |
468 vis->vs_window = window; | |
469 } | |
470 | |
471 Vis * | |
472 create_vis(GList ** wlist, | |
473 GdkPixmap * parent, | |
474 GdkWindow * window, | |
475 GdkGC * gc, | |
476 gint x, gint y, | |
1938 | 477 gint width, |
478 gboolean doublesize) | |
1653 | 479 { |
480 Vis *vis; | |
481 | |
482 vis = g_new0(Vis, 1); | |
483 | |
484 widget_init(&vis->vs_widget, parent, gc, x, y, width, 16, 1); | |
1938 | 485 |
486 vis->vs_doublesize = doublesize; | |
487 | |
1653 | 488 widget_list_add(wlist, WIDGET(vis)); |
489 | |
490 return vis; | |
491 } |