Commit 6a288e1d authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix moonlib/mknob outlet positioning and display

parent 304848e5
......@@ -215,6 +215,17 @@ static void mknob_draw_new(t_mknob *x, t_glist *glist)
mknob_draw_config(x, glist);
}
static void mknob_move_io(t_mknob *x,t_glist *glist)
{
int xpos = text_xpix(&x->x_gui.x_obj, glist);
int ypos = text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas = glist_getcanvas(glist);
t_gobj *y = (t_gobj *)x;
gui_vmess("gui_mknob_outlet_coords", "xxi", canvas, x, x->x_gui.x_w);
}
static void mknob_draw_move(t_mknob *x, t_glist *glist)
{
int xpos=text_xpix(&x->x_gui.x_obj, glist);
......@@ -232,7 +243,8 @@ static void mknob_draw_move(t_mknob *x, t_glist *glist)
//sys_vgui(".x%lx.c coords %xCENTER %f %f\n",
// canvas, x,
// xc, yc);
mknob_update_knob(x,glist);
mknob_update_knob(x, glist);
mknob_move_io(x, glist);
//sys_vgui(".x%lx.c coords %xLABEL %d %d\n",
// canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy);
//if (canvas == glist) {
......@@ -249,7 +261,7 @@ static void mknob_draw_move(t_mknob *x, t_glist *glist)
static void mknob_draw_erase(t_mknob *x,t_glist *glist)
{
t_canvas *canvas=glist_getcanvas(glist);
t_canvas *canvas = glist_getcanvas(glist);
//sys_vgui(".x%lx.c delete %xBASE\n", canvas, x);
//sys_vgui(".x%lx.c delete %xCENTER\n", canvas, x);
......@@ -263,38 +275,6 @@ static void mknob_draw_erase(t_mknob *x,t_glist *glist)
//}
}
static void mknob_draw_io(t_mknob *x,t_glist *glist, int old_snd_rcv_flags)
{
int xpos=text_xpix(&x->x_gui.x_obj, glist);
int ypos=text_ypix(&x->x_gui.x_obj, glist);
t_canvas *canvas=glist_getcanvas(glist);
t_gobj *y = (t_gobj *)x;
t_object *ob = pd_checkobject(&y->g_pd);
/* GOP objects are unable to call findrtext triggering consistency check error */
t_rtext *yyyy = NULL;
if (!glist->gl_isgraph || glist_istoplevel(glist))
yyyy = glist_findrtext(canvas, (t_text *)&ob->ob_g);
/* on GOP we cause segfault as apparently text_gettag() returns bogus data */
char *nlet_tag;
if (yyyy) nlet_tag = rtext_gettag(yyyy);
else nlet_tag = "bogus";
//if (canvas == glist) {
// if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
// sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%xOUT%d %xMKNOB %so0 outlet}\n",
// canvas, xpos, ypos + x->x_gui.x_w-1, xpos + IOWIDTH, ypos + x->x_gui.x_w, x, 0, x, nlet_tag);
// if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
// sys_vgui(".x%lx.c delete %xOUT%d\n", canvas, x, 0);
// if((old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && !x->x_gui.x_fsf.x_rcv_able)
// sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%xIN%d %xMKNOB %si0 inlet}\n",
// canvas, xpos, ypos-1, xpos + IOWIDTH, ypos, x, 0, x, nlet_tag);
// if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able)
// sys_vgui(".x%lx.c delete %xIN%d\n", canvas, x, 0);
// }
}
//static void mknob_draw_select(t_mknob *x,t_glist *glist)
//{
......
......@@ -3726,22 +3726,12 @@ function gui_mknob_new(cid, tag, x, y, is_toplevel, show_in, show_out) {
line = create_item(cid, "line", {
class: "dial"
}),
in_0 = create_item(cid, "rect", {
class: "in_0",
style: "display: " + (is_toplevel && show_in ? "inline;" : "none;")
}),
out_0 = create_item(cid, "rect", {
class: "out_0",
style: "display: " + (is_toplevel && show_out ? "inline;" : "none;")
}),
label = create_item(cid, "text", {
class: "label"
});
g.appendChild(border);
g.appendChild(circle);
g.appendChild(line);
g.appendChild(in_0);
g.appendChild(out_0);
g.appendChild(label);
}
......@@ -3768,18 +3758,6 @@ function gui_configure_mknob(cid, tag, size, xlet_width, label_x, label_y,
"stroke-width": 2,
stroke: fg_color
});
configure_item(g.querySelector(".in_0"), {
x: 0,
y: -1,
width: xlet_width,
height: 1
});
configure_item(g.querySelector(".out_0"), {
x: 0,
y: size - 1,
width: xlet_width,
height: 1
});
}
function gui_turn_mknob(cid, tag, x1, y1, x2, y2) {
......@@ -3792,6 +3770,17 @@ function gui_turn_mknob(cid, tag, x1, y1, x2, y2) {
});
}
function gui_mknob_outlet_coords(cid, tag, w) {
var g = get_gobj(cid, tag);
g.querySelectorAll(".xlet_iemgui").forEach(function(elem) {
if (elem.getAttributeNS(null, "y") !== "0") {
configure_item(elem, {
y: w - 1
});
}
});
}
function add_popup(cid, popup) {
popup_menu[cid] = popup;
}
......
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