annotate audacious/widgets/vis.c @ 1557:dc3ae578e7b6 trunk

[svn] - make it compile
author nenolod
date Thu, 10 Aug 2006 19:21:37 -0700
parents ec4d858524fa
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1541
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
3 *
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
4 * Based on XMMS:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
6 *
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
10 * (at your option) any later version.
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
11 *
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
16 *
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
20 */
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
21
1556
ec4d858524fa [svn] - cleanup
nenolod
parents: 1541
diff changeset
22 #include "widgetcore.h"
1541
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
23
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
24 #include <glib.h>
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
25 #include <gdk/gdk.h>
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
26 #include <string.h>
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
27
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
28 #include "main.h"
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
29 #include "skin.h"
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
30 #include "widget.h"
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
31
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
32 static const gfloat vis_afalloff_speeds[] = { 0.34, 0.5, 1.0, 1.3, 1.6 };
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
33 static const gfloat vis_pfalloff_speeds[] = { 1.2, 1.3, 1.4, 1.5, 1.6 };
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
34 static const gint vis_redraw_delays[] = { 1, 2, 4, 8 };
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
35 static const guint8 vis_scope_colors[] =
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
36 { 21, 21, 20, 20, 19, 19, 18, 19, 19, 20, 20, 21, 21 };
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
37
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
38 void
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
39 vis_timeout_func(Vis * vis, guchar * data)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
40 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
41 static GTimer *timer = NULL;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
42 gulong micros = 9999999;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
43 gboolean falloff = FALSE;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
44 gint i;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
45
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
46 if (!timer) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
47 timer = g_timer_new();
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
48 g_timer_start(timer);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
49 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
50 else {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
51 g_timer_elapsed(timer, &micros);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
52 if (micros > 14000)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
53 g_timer_reset(timer);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
54
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
55 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
56
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
57 if (cfg.vis_type == VIS_ANALYZER) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
58 if (micros > 14000)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
59 falloff = TRUE;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
60 if (data || falloff) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
61 for (i = 0; i < 75; i++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
62 if (data && data[i] > vis->vs_data[i]) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
63 vis->vs_data[i] = data[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
64 if (vis->vs_data[i] > vis->vs_peak[i]) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
65 vis->vs_peak[i] = vis->vs_data[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
66 vis->vs_peak_speed[i] = 0.01;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
67
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
68 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
69 else if (vis->vs_peak[i] > 0.0) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
70 vis->vs_peak[i] -= vis->vs_peak_speed[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
71 vis->vs_peak_speed[i] *=
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
72 vis_pfalloff_speeds[cfg.peaks_falloff];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
73 if (vis->vs_peak[i] < vis->vs_data[i])
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
74 vis->vs_peak[i] = vis->vs_data[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
75 if (vis->vs_peak[i] < 0.0)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
76 vis->vs_peak[i] = 0.0;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
77 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
78 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
79 else if (falloff) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
80 if (vis->vs_data[i] > 0.0) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
81 vis->vs_data[i] -=
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
82 vis_afalloff_speeds[cfg.analyzer_falloff];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
83 if (vis->vs_data[i] < 0.0)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
84 vis->vs_data[i] = 0.0;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
85 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
86 if (vis->vs_peak[i] > 0.0) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
87 vis->vs_peak[i] -= vis->vs_peak_speed[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
88 vis->vs_peak_speed[i] *=
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
89 vis_pfalloff_speeds[cfg.peaks_falloff];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
90 if (vis->vs_peak[i] < vis->vs_data[i])
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
91 vis->vs_peak[i] = vis->vs_data[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
92 if (vis->vs_peak[i] < 0.0)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
93 vis->vs_peak[i] = 0.0;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
94 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
95 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
96 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
97 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
98 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
99 else if (data) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
100 for (i = 0; i < 75; i++)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
101 vis->vs_data[i] = data[i];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
102 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
103
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
104 if (micros > 14000) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
105 if (!vis->vs_refresh_delay) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
106 vis_draw((Widget *) vis);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
107 vis->vs_refresh_delay = vis_redraw_delays[cfg.vis_refresh];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
108
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
109 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
110 vis->vs_refresh_delay--;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
111 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
112 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
113
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
114 void
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
115 vis_draw(Widget * w)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
116 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
117 Vis *vis = (Vis *) w;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
118 gint x, y, h = 0, h2;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
119 guchar vis_color[24][3];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
120 guchar rgb_data[152 * 32], *ptr, c;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
121 guint32 colors[24];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
122 GdkRgbCmap *cmap;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
123
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
124 if (!vis->vs_widget.visible)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
125 return;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
126
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
127 skin_get_viscolor(bmp_active_skin, vis_color);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
128 for (y = 0; y < 24; y++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
129 colors[y] =
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
130 vis_color[y][0] << 16 | vis_color[y][1] << 8 | vis_color[y][2];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
131 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
132 cmap = gdk_rgb_cmap_new(colors, 24);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
133
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
134 memset(rgb_data, 0, 76 * 16);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
135 for (y = 1; y < 16; y += 2) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
136 ptr = rgb_data + (y * 76);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
137 for (x = 0; x < 76; x += 2, ptr += 2)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
138 *ptr = 1;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
139 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
140 if (cfg.vis_type == VIS_ANALYZER) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
141 for (x = 0; x < 75; x++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
142 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
143 h = vis->vs_data[x >> 2];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
144 else if (cfg.analyzer_type == ANALYZER_LINES)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
145 h = vis->vs_data[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
146 if (h && (cfg.analyzer_type == ANALYZER_LINES ||
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
147 (x % 4) != 3)) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
148 ptr = rgb_data + ((16 - h) * 76) + x;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
149 switch (cfg.analyzer_mode) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
150 case ANALYZER_NORMAL:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
151 for (y = 0; y < h; y++, ptr += 76)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
152 *ptr = 18 - h + y;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
153 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
154 case ANALYZER_FIRE:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
155 for (y = 0; y < h; y++, ptr += 76)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
156 *ptr = y + 2;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
157 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
158 case ANALYZER_VLINES:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
159 for (y = 0; y < h; y++, ptr += 76)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
160 *ptr = 18 - h;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
161 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
162 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
163 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
164 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
165 if (cfg.analyzer_peaks) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
166 for (x = 0; x < 75; x++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
167 if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
168 h = vis->vs_peak[x >> 2];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
169 else if (cfg.analyzer_type == ANALYZER_LINES)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
170 h = vis->vs_peak[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
171 if (h
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
172 && (cfg.analyzer_type == ANALYZER_LINES
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
173 || (x % 4) != 3))
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
174 rgb_data[(16 - h) * 76 + x] = 23;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
175 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
176 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
177 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
178 else if (cfg.vis_type == VIS_SCOPE) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
179 for (x = 0; x < 75; x++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
180 switch (cfg.scope_mode) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
181 case SCOPE_DOT:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
182 h = vis->vs_data[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
183 ptr = rgb_data + ((15 - h) * 76) + x;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
184 *ptr = vis_scope_colors[h];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
185 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
186 case SCOPE_LINE:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
187 if (x != 74) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
188 h = 15 - vis->vs_data[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
189 h2 = 15 - vis->vs_data[x + 1];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
190 if (h > h2) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
191 y = h;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
192 h = h2;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
193 h2 = y;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
194 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
195 ptr = rgb_data + (h * 76) + x;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
196 for (y = h; y <= h2; y++, ptr += 76)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
197 *ptr = vis_scope_colors[y - 3];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
198
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
199 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
200 else {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
201 h = 15 - vis->vs_data[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
202 ptr = rgb_data + (h * 76) + x;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
203 *ptr = vis_scope_colors[h];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
204 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
205 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
206 case SCOPE_SOLID:
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
207 h = 15 - vis->vs_data[x];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
208 h2 = 9;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
209 c = vis_scope_colors[(gint) vis->vs_data[x]];
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
210 if (h > h2) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
211 y = h;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
212 h = h2;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
213 h2 = y;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
214 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
215 ptr = rgb_data + (h * 76) + x;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
216 for (y = h; y <= h2; y++, ptr += 76)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
217 *ptr = c;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
218 break;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
219 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
220 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
221 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
222
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
223 /* FIXME: The check "shouldn't" be neccessary? */
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
224 /* if (GTK_IS_WINDOW(vis->vs_window)) { */
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
225 GDK_THREADS_ENTER();
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
226 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
227 vis->vs_widget.x, vis->vs_widget.y,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
228 vis->vs_widget.width, vis->vs_widget.height,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
229 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
230 76, cmap);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
231 GDK_THREADS_LEAVE();
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
232 /* } else {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
233 vis->vs_window = mainwin->window;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
234 GDK_THREADS_ENTER();
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
235 gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
236 vis->vs_widget.x, vis->vs_widget.y,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
237 vis->vs_widget.width, vis->vs_widget.height,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
238 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
239 76, cmap);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
240 GDK_THREADS_LEAVE();
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
241 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
242 */
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
243
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
244 gdk_rgb_cmap_free(cmap);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
245 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
246
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
247 void
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
248 vis_clear_data(Vis * vis)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
249 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
250 gint i;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
251
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
252 if (!vis)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
253 return;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
254
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
255 for (i = 0; i < 75; i++) {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
256 vis->vs_data[i] = (cfg.vis_type == VIS_SCOPE) ? 6 : 0;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
257 vis->vs_peak[i] = 0;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
258 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
259 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
260
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
261 void
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
262 vis_clear(Vis * vis)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
263 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
264 gdk_window_clear_area(vis->vs_window, vis->vs_widget.x,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
265 vis->vs_widget.y, vis->vs_widget.width,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
266 vis->vs_widget.height);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
267 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
268
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
269 void
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
270 vis_set_window(Vis * vis, GdkWindow * window)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
271 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
272 vis->vs_window = window;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
273 }
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
274
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
275 Vis *
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
276 create_vis(GList ** wlist,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
277 GdkPixmap * parent,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
278 GdkWindow * window,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
279 GdkGC * gc,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
280 gint x, gint y,
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
281 gint width)
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
282 {
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
283 Vis *vis;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
284
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
285 vis = g_new0(Vis, 1);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
286
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
287 widget_init(&vis->vs_widget, parent, gc, x, y, width, 16, 1);
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
288 widget_list_add(wlist, WIDGET(vis));
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
289
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
290 return vis;
06329cbf186a [svn] this massive commit does the following:
nenolod
parents:
diff changeset
291 }