Commit 999ddd87 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

clean up g_vumeter.c

parent 3574860f
......@@ -2115,7 +2115,7 @@ function gui_radio_update(cid,tag,x_fgcolor,prev,next) {
});
}
function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey) {
function gui_create_vumeter_text(cid,tag,x_color,xpos,ypos,text,index,basex,basey) {
var g = get_gobj(cid, tag),
svg_text = create_item(cid, "text", {
x: xpos - basex,
......@@ -2137,12 +2137,12 @@ function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey)
// c) recreate all the missing labels
// To get on to other work we just parrot the insanity here,
// and silently ignore calls to update non-existent text.
function gui_update_vumeter_text(cid, tag, text, font, selected, color, i) {
function gui_update_vumeter_text(cid, tag, text, font, selected, x_color, i) {
var svg_text = get_item(cid, tag + "text_" + i);
if (!selected) {
// Hack...
if (svg_text !== null) {
configure_item(svg_text, { fill: color });
configure_item(svg_text, { fill: x2h(x_color) });
}
}
}
......@@ -2157,7 +2157,7 @@ function gui_erase_vumeter_text(cid, tag, i) {
t.parentNode.removeChild(t);
}
function gui_create_vumeter_steps(cid,tag,color,p1,p2,p3,p4,width,index,basex,basey,i) {
function gui_create_vumeter_steps(cid,tag,x_color,p1,p2,p3,p4,width,index,basex,basey,i) {
var g = get_gobj(cid, tag),
l;
l = create_item(cid, "line", {
......@@ -2165,7 +2165,7 @@ function gui_create_vumeter_steps(cid,tag,color,p1,p2,p3,p4,width,index,basex,ba
y1: p2 - basey,
x2: p3 - basex,
y2: p4 - basey,
stroke: color,
stroke: x2h(x_color),
"stroke-width": width,
"id": tag + "led_" + i
});
......@@ -2187,7 +2187,7 @@ function gui_update_vumeter_step_coords(cid,tag,i,x1,y1,x2,y2,basex,basey) {
});
}
function gui_create_vumeter_rect(cid,tag,color,p1,p2,p3,p4,basex,basey) {
function gui_create_vumeter_rect(cid,tag,x_color,p1,p2,p3,p4,basex,basey) {
var g = get_gobj(cid, tag),
rect;
rect = create_item(cid, "rect", {
......@@ -2195,16 +2195,16 @@ function gui_create_vumeter_rect(cid,tag,color,p1,p2,p3,p4,basex,basey) {
y: p2 - basey,
width: p3 - p1,
height: p4 + 1 - p2,
stroke: color,
fill: color,
stroke: x2h(x_color),
fill: x2h(x_color),
id: tag + "rect"
});
g.appendChild(rect);
}
function gui_update_vumeter_rect(cid, tag, color) {
function gui_update_vumeter_rect(cid, tag, x_color) {
var r = get_item(cid, tag + "rect");
configure_item(r, { fill: color, stroke: color });
configure_item(r, { fill: x2h(x_color), stroke: x2h(x_color) });
}
// Oh hack upon hack... why doesn't the iemgui base_config just take care
......@@ -2249,14 +2249,14 @@ function gui_vumeter_update_rms(cid,tag,p1,p2,p3,p4,basex,basey) {
});
}
function gui_vumeter_update_peak(cid,tag,color,p1,p2,p3,p4,basex,basey) {
function gui_vumeter_update_peak(cid,tag,x_color,p1,p2,p3,p4,basex,basey) {
var line = get_item(cid, tag + "peak");
configure_item(line, {
x1: p1 - basex,
y1: p2 - basey,
x2: p3 - basex,
y2: p4 - basey,
stroke: color
stroke: x2h(x_color)
});
}
......
......@@ -96,21 +96,15 @@ static void vu_update_peak(t_vu *x, t_glist *glist)
int j = y1 + (x->x_led_size + 1) * (IEM_VU_STEPS + 1 - x->x_peak)
- (x->x_led_size + 1) / 2;
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", iemgui_color_hex[i]);
gui_vmess("gui_vumeter_update_peak", "xxsiiiiii",
canvas, x, colorbuf,
gui_vmess("gui_vumeter_update_peak", "xxxiiiiii",
canvas, x, iemgui_color_hex[i],
x1 + 1, j + 2, x1 + x->x_gui.x_w + 2, j + 2, x1, y1);
}
else
{
int mid = x1 + x->x_gui.x_w / 2;
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_vumeter_update_peak", "xxsiiiiii",
canvas, x, colorbuf,
gui_vmess("gui_vumeter_update_peak", "xxxiiiiii",
canvas, x, x->x_gui.x_bcol,
mid+1, y1+22, mid+1, y1+22, x1, y1);
}
}
......@@ -147,33 +141,26 @@ static void vu_draw_new(t_vu *x, t_glist *glist)
yyy = k4 + k1 * (k2-i);
if((i&3)==1 && (x->x_scale))
{
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_lcol);
// not handling font size yet
gui_vmess("gui_create_vumeter_text", "xxsiisiii",
gui_vmess("gui_create_vumeter_text", "xxxiisiii",
canvas, x,
colorbuf, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
x->x_gui.x_lcol, end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
i, x1, y1);
}
led_col = iemgui_vu_col[i];
if (i<=IEM_VU_STEPS)
{
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", iemgui_color_hex[led_col]);
gui_vmess("gui_create_vumeter_steps", "xxsiiiiiiiii",
canvas, x, colorbuf, quad1+1,
gui_vmess("gui_create_vumeter_steps", "xxxiiiiiiiii",
canvas, x, iemgui_color_hex[led_col], quad1+1,
yyy+2, quad3, yyy+2, x->x_led_size, index, x1, y1, i);
}
}
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_create_vumeter_rect", "xxsiiiiii",
gui_vmess("gui_create_vumeter_rect", "xxxiiiiii",
canvas, x,
colorbuf, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, x1, y1);
sprintf(colorbuf, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_create_vumeter_peak", "xxsiiiiiii",
x->x_gui.x_bcol, quad1+1, y1+1, quad3, y1+1 + k1*IEM_VU_STEPS, x1, y1);
gui_vmess("gui_create_vumeter_peak", "xxxiiiiiii",
canvas, x,
colorbuf, mid+1, y1+12, mid+1, y1+12, x->x_led_size, x1, y1);
x->x_gui.x_bcol, mid+1, y1+12, mid+1, y1+12, x->x_led_size, x1, y1);
x->x_updaterms = x->x_updatepeak = 1;
sys_queuegui(x, x->x_gui.x_glist, vu_draw_update);
}
......@@ -223,7 +210,6 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
{
int i;
t_canvas *canvas=glist_getcanvas(glist);
char lcol[8]; sprintf(lcol, "#%6.6x", x->x_gui.x_lcol);
for(i = 1; i <= IEM_VU_STEPS+1; i++)
{
if (i <= IEM_VU_STEPS)
......@@ -236,28 +222,21 @@ static void vu_draw_config(t_vu* x, t_glist* glist)
{
int isselected = x->x_gui.x_selected == canvas &&
x->x_gui.x_glist == canvas && x->x_scale;
gui_vmess("gui_update_vumeter_text", "xxssisi",
gui_vmess("gui_update_vumeter_text", "xxssixi",
canvas, x, iemgui_vu_scale_str[i/4],
iemgui_font(&x->x_gui), isselected, lcol, i);
iemgui_font(&x->x_gui), isselected, x->x_gui.x_lcol, i);
}
}
char bcol[8];
sprintf(bcol, "#%6.6x", x->x_gui.x_bcol);
gui_vmess("gui_update_vumeter_rect", "xxs",
canvas, x, bcol);
gui_vmess("gui_update_vumeter_rect", "xxx",
canvas, x, x->x_gui.x_bcol);
gui_vmess("gui_update_vumeter_peak", "xxi",
canvas, x, x->x_led_size);
iemgui_base_draw_config(&x->x_gui);
}
/* Not sure if this is necessary anymore */
static void vu_draw_select(t_vu* x,t_glist* glist)
{
//t_canvas *canvas=glist_getcanvas(glist);
//char lcol[8]; sprintf(lcol,"#%6.6x", x->x_gui.x_lcol);
//int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
//sys_vgui(".x%lx.c itemconfigure %lxSCALEN -fill %s\n",
// canvas, x, issel ? selection_color : lcol);
/* Not needed anymore */
}
static void vu__clickhook(t_scalehandle *sh, int newstate)
......@@ -477,20 +456,16 @@ static void vu_scale(t_vu *x, t_floatarg fscale)
yyy = k4 + k1*(k2-i);
if((i&3)==1)
{
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_lcol);
gui_vmess("gui_create_vumeter_text", "xxsiisiii",
canvas, x, colorbuf,
gui_vmess("gui_create_vumeter_text", "xxxiisiii",
canvas, x, x->x_gui.x_lcol,
end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
i, end, yyy);
}
}
i = IEM_VU_STEPS + 1;
yyy = k4 + k1*(k2-i);
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_lcol);
gui_vmess("gui_create_vumeter_text", "xxsiisiii",
canvas, x, colorbuf,
gui_vmess("gui_create_vumeter_text", "xxxiisiii",
canvas, x, x->x_gui.x_lcol,
end+1, yyy+k3+2, iemgui_vu_scale_str[i/4],
i, end, yyy);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment