Commit fb17c23f authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

clean up g_radio.c

parent b009d585
...@@ -2067,7 +2067,7 @@ function gui_create_radio(cid,tag,p1,p2,p3,p4,i,basex,basey) { ...@@ -2067,7 +2067,7 @@ function gui_create_radio(cid,tag,p1,p2,p3,p4,i,basex,basey) {
g.appendChild(cell); g.appendChild(cell);
} }
function gui_create_radio_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state) { function gui_create_radio_buttons(cid,tag,x_color,p1,p2,p3,p4,basex,basey,i,state) {
var g = get_gobj(cid, tag), var g = get_gobj(cid, tag),
b; b;
b = create_item(cid, "rect", { b = create_item(cid, "rect", {
...@@ -2075,8 +2075,8 @@ function gui_create_radio_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state) ...@@ -2075,8 +2075,8 @@ function gui_create_radio_buttons(cid,tag,color,p1,p2,p3,p4,basex,basey,i,state)
y: p2 - basey, y: p2 - basey,
width: p3 - p1, width: p3 - p1,
height: p4 - p2, height: p4 - p2,
stroke: color, stroke: x2h(x_color),
fill: color, fill: x2h(x_color),
id: tag + "button_" + i, id: tag + "button_" + i,
display: state ? "inline" : "none" display: state ? "inline" : "none"
}); });
...@@ -2104,11 +2104,15 @@ function gui_radio_button_coords(cid, tag, x1, y1, xi, yi, i, s, d, orient) { ...@@ -2104,11 +2104,15 @@ function gui_radio_button_coords(cid, tag, x1, y1, xi, yi, i, s, d, orient) {
}); });
} }
function gui_radio_update(cid,tag,bgcolor,prev,next) { function gui_radio_update(cid,tag,x_fgcolor,prev,next) {
var prev = get_item(cid, tag + "button_" + prev), var prev = get_item(cid, tag + "button_" + prev),
next = get_item(cid, tag + "button_" + next); next = get_item(cid, tag + "button_" + next);
configure_item(prev, { display: "none", fill: bgcolor, stroke: bgcolor }); configure_item(prev, { display: "none" });
configure_item(next, { display: "inline", fill: bgcolor, stroke: bgcolor }); configure_item(next, {
display: "inline",
fill: x2h(x_fgcolor),
stroke: x2h(x_fgcolor)
});
} }
function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey) { function gui_create_vumeter_text(cid,tag,color,xpos,ypos,text,index,basex,basey) {
......
...@@ -26,13 +26,14 @@ t_class *vradio_class, *vradio_old_class; ...@@ -26,13 +26,14 @@ t_class *vradio_class, *vradio_old_class;
void radio_draw_update(t_gobj *client, t_glist *glist) void radio_draw_update(t_gobj *client, t_glist *glist)
{ {
t_radio *x = (t_radio *)client; t_radio *x = (t_radio *)client;
if(!glist_isvisible(glist)) return; if (!glist_isvisible(glist)) return;
t_canvas *canvas=glist_getcanvas(glist); t_canvas *canvas=glist_getcanvas(glist);
char fcol[8], bcol[8]; gui_vmess("gui_radio_update", "xxxii",
sprintf(fcol, "#%6.6x", x->x_gui.x_fcol); canvas,
sprintf(bcol, "#%6.6x", x->x_gui.x_bcol); x,
gui_vmess("gui_radio_update", "xxsii", canvas, x->x_gui.x_fcol,
x, fcol, x->x_drawn, x->x_on); x->x_drawn,
x->x_on);
x->x_drawn = x->x_on; x->x_drawn = x->x_on;
} }
...@@ -44,34 +45,36 @@ void radio_draw_new(t_radio *x, t_glist *glist) ...@@ -44,34 +45,36 @@ void radio_draw_new(t_radio *x, t_glist *glist)
int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1; int y1=text_ypix(&x->x_gui.x_obj, glist), yi=y1;
iemgui_base_draw_new(&x->x_gui); iemgui_base_draw_new(&x->x_gui);
for(i=0; i<n; i++) if (x->x_orient) { for (i=0; i<n; i++)
if (i) {
if (x->x_orient)
{ {
gui_vmess("gui_create_radio", "xxiiiiiii", if (i)
canvas, x, x1, yi, x1+d, yi, i, x1, y1); {
gui_vmess("gui_create_radio", "xxiiiiiii",
canvas, x, x1, yi, x1+d, yi, i, x1, y1);
}
gui_vmess("gui_create_radio_buttons", "xxxiiiiiiii",
canvas, x,
x->x_gui.x_fcol,
x1+s, yi+s, x1+d-s, yi+d-s, x1, y1, i, x->x_on==i);
yi += d;
x->x_drawn = x->x_on;
} }
char tagbuf[MAXPDSTRING]; else
sprintf(tagbuf, "x%lx", (long unsigned int)x);
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_fcol);
gui_vmess("gui_create_radio_buttons", "xxsiiiiiiii",
canvas, x,
colorbuf, x1+s, yi+s, x1+d-s, yi+d-s, x1, y1, i, x->x_on==i);
yi += d;
x->x_drawn = x->x_on;
} else {
if (i)
{ {
gui_vmess("gui_create_radio", "xxiiiiiii", canvas, if (i)
x, xi, y1, xi, y1+d, i, x1, y1); {
gui_vmess("gui_create_radio", "xxiiiiiii", canvas,
x, xi, y1, xi, y1+d, i, x1, y1);
}
gui_vmess("gui_create_radio_buttons", "xxxiiiiiiii",
canvas, x,
x->x_gui.x_fcol,
xi+s, y1+s, xi+d-s, yi+d-s, x1, y1, i, x->x_on==i);
xi += d;
x->x_drawn = x->x_on;
} }
char colorbuf[MAXPDSTRING];
sprintf(colorbuf, "#%6.6x", x->x_gui.x_fcol);
gui_vmess("gui_create_radio_buttons", "xxsiiiiiiii",
canvas, x,
colorbuf, xi+s, y1+s, xi+d-s, yi+d-s, x1, y1, i, x->x_on==i);
xi += d;
x->x_drawn = x->x_on;
} }
} }
...@@ -83,16 +86,19 @@ void radio_draw_move(t_radio *x, t_glist *glist) ...@@ -83,16 +86,19 @@ void radio_draw_move(t_radio *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist), xi=0; int x1=text_xpix(&x->x_gui.x_obj, glist), xi=0;
int y1=text_ypix(&x->x_gui.x_obj, glist), yi=0; int y1=text_ypix(&x->x_gui.x_obj, glist), yi=0;
iemgui_base_draw_move(&x->x_gui); iemgui_base_draw_move(&x->x_gui);
for(i=0; i<n; i++) if (x->x_orient) { for (i=0; i<n; i++)
gui_vmess("gui_radio_button_coords", "xxiiiiiiii", {
canvas, x, if (x->x_orient) {
x1, y1, xi, yi, i, s, d, x->x_orient); gui_vmess("gui_radio_button_coords", "xxiiiiiiii",
yi += d; canvas, x,
} else { x1, y1, xi, yi, i, s, d, x->x_orient);
gui_vmess("gui_radio_button_coords", "xxiiiiiiii", yi += d;
canvas, x, } else {
x1, y1, xi, yi, i, s, d, x->x_orient); gui_vmess("gui_radio_button_coords", "xxiiiiiiii",
xi += d; canvas, x,
x1, y1, xi, yi, i, s, d, x->x_orient);
xi += d;
}
} }
} }
...@@ -101,17 +107,15 @@ void radio_draw_config(t_radio *x, t_glist *glist) ...@@ -101,17 +107,15 @@ void radio_draw_config(t_radio *x, t_glist *glist)
t_canvas *canvas=glist_getcanvas(glist); t_canvas *canvas=glist_getcanvas(glist);
int n=x->x_number, i; int n=x->x_number, i;
iemgui_base_draw_config(&x->x_gui); iemgui_base_draw_config(&x->x_gui);
for(i=0; i<n; i++) for (i=0; i<n; i++)
{ {
//sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n", //sys_vgui(".x%lx.c itemconfigure %lxBUT%d -fill #%6.6x -stroke #%6.6x\n",
// canvas, x, i, // canvas, x, i,
// (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol, // (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol,
// (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol); // (x->x_on==i) ? x->x_gui.x_fcol : x->x_gui.x_bcol);
} }
char col[8]; gui_vmess("gui_radio_update", "xxxii",
sprintf(col, "#%6.6x", x->x_gui.x_fcol); canvas, x, x->x_gui.x_fcol, 0, x->x_on);
gui_vmess("gui_radio_update", "xxsii",
canvas, x, col, 0, x->x_on);
} }
......
Supports Markdown
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