Commit 0556b698 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*added proper tagging to all gui objects

*gop leaving stale vanila objects
*fixed bug where closing subpatcher of gop patch/abstraction redundantly opens gop patcher/abstraction
*fixed bug where reordering did not properly deselect previously arranged elements
parent 93462601
......@@ -834,3 +834,19 @@ int iem_fstyletoint(t_iem_fstyle_flags *fstylep)
{
return ((fstylep->x_font_style << 0) & 63);
}
char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj)
{
t_gobj *y = (t_gobj *)iem_obj;
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(glist_getcanvas(glist), (t_text *)&ob->ob_g);
/* on GOP we cause segfault as text_gettag() returns bogus data */
if (yyyy) return(rtext_gettag(yyyy));
else return("bogus");
}
......@@ -396,5 +396,6 @@ EXTERN void iem_inttosymargs(t_iem_init_symargs *symargp, int n);
EXTERN int iem_symargstoint(t_iem_init_symargs *symargp);
EXTERN void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n);
EXTERN int iem_fstyletoint(t_iem_fstyle_flags *fstylep);
EXTERN char *iem_get_tag(t_canvas *glist, t_iemgui *iem_obj);
EXTERN void canvas_apply_setundo(t_canvas *x, t_gobj *y);
......@@ -58,47 +58,35 @@ void bng_draw_new(t_bng *x, t_glist *glist)
//if (glist_isvisible(canvas)) {
t_gobj *y = (t_gobj *)x;
t_object *ob = pd_checkobject(&y->g_pd);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
/* 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";
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxBNG %lx text}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxBNG text %s}\n",
canvas, xpos, ypos,
xpos + x->x_gui.x_w, ypos + x->x_gui.x_h,
x->x_gui.x_bcol, x, x, x);
x->x_gui.x_bcol, x, x, nlet_tag);
t_float cr = (x->x_gui.x_w-2)/2.0;
t_float cx = xpos+cr+1.5;
t_float cy = ypos+cr+1.5;
sys_vgui(".x%lx.c create circle %f %f -r %f -fill #%6.6x -tags {%lxBUT %lxBNG %lx text}\n",
sys_vgui(".x%lx.c create circle %f %f -r %f -fill #%6.6x -tags {%lxBUT %lxBNG text %s}\n",
canvas, cx, cy, cr,
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, x);
x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, x, x, nlet_tag);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxBNG %lx text}\n",
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxBNG text %s}\n",
canvas, xpos+x->x_gui.x_ldx,
ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x, x);
x->x_gui.x_lcol, x, x, nlet_tag);
if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist) {
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG outlet %s}\n",
canvas, xpos,
ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x);
ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
}
if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist) {
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG inlet %s}\n",
canvas, xpos, ypos,
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x);
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
}
//}
}
......@@ -111,18 +99,7 @@ void bng_draw_move(t_bng *x, t_glist *glist)
if (glist_isvisible(canvas)) {
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";
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n",
canvas, x, xpos, ypos,
......@@ -213,30 +190,19 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags)
if (glist_isvisible(canvas) && canvas == x->x_gui.x_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";
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
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 {%lxBNG%so%d %so%d %lxBNG %lx outlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%so%d %so%d %lxBNG outlet %s}\n",
canvas, xpos,
ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 0, x, x);
ypos + x->x_gui.x_h, x, nlet_tag, 0, nlet_tag, 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 %lxBNG%so%d\n", canvas, x, nlet_tag, 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 {%lxBNG%si%d %si%d %lxBNG %lx inlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxBNG%si%d %si%d %lxBNG inlet %s}\n",
canvas, xpos, ypos,
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x);
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 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 %lxBNG%si%d\n", canvas, x, nlet_tag, 0);
}
......@@ -256,6 +222,8 @@ void bng_draw_select(t_bng* x, t_glist* glist)
// if so, disable highlighting
if (x->x_gui.x_glist == glist_getcanvas(glist)) {
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
sys_vgui(".x%lx.c itemconfigure %lxBASE -stroke $select_color\n", canvas, x);
sys_vgui(".x%lx.c itemconfigure %lxBUT -stroke $select_color\n", canvas, x);
sys_vgui(".x%lx.c itemconfigure %lxLABEL -fill $select_color\n", canvas, x);
......@@ -267,11 +235,11 @@ void bng_draw_select(t_bng* x, t_glist* glist)
sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxBNG %lx}\n",
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxBNG %s}\n",
canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w - SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, x);
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
......@@ -289,11 +257,11 @@ void bng_draw_select(t_bng* x, t_glist* glist)
sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxLABELH %lxBNG %lx}\n",
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxLABELH %lxBNG %s}\n",
canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, x);
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
......
......@@ -773,7 +773,7 @@ void canvas_drawredrect(t_canvas *x, int doit)
called from the GUI after the fact to "notify" us that we're mapped. */
void canvas_map(t_canvas *x, t_floatarg f)
{
//fprintf(stderr,"canvas_map\n");
//fprintf(stderr,"canvas_map %lx %f\n", (t_int)x, f);
int flag = (f != 0);
t_gobj *y;
if (flag)
......@@ -823,7 +823,7 @@ void canvas_map(t_canvas *x, t_floatarg f)
void canvas_redraw(t_canvas *x)
{
if (do_not_redraw) return;
//fprintf(stderr,"canvas_redraw\n");
//fprintf(stderr,"canvas_redraw %lx\n", (t_int)x);
if (glist_isvisible(x))
{
//fprintf(stderr,"canvas_redraw glist_isvisible=true\n");
......
......@@ -224,6 +224,7 @@ int gobj_click(t_gobj *x, struct _glist *glist,
int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag, int dir)
{
// we do this instead to save us costly redraw of the canvas
//fprintf(stderr,"canvas_restore_original_position %lx %lx %s %d\n", (t_int)x, (t_int)y, objtag, dir);
t_object *ob = NULL;
t_rtext *yrnxt = NULL, *yr = NULL;
int ret = 0;
......@@ -244,13 +245,7 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
}
if (ret != 1) {
if (dir == -1) {
if (yrnxt) {
// lower into middle
if (objtag)
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag);
else
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s 0\n", x, rtext_gettag(yrnxt), rtext_gettag(yr));
} else if (x->gl_list == y) {
if (x->gl_list == y) {
// we get here if we are supposed to go all the way to the bottom
if (objtag)
sys_vgui(".x%lx.c addtag arrange withtag %s\n", x, objtag);
......@@ -261,6 +256,14 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
sys_vgui(".x%lx.c dtag %s arrange\n", x, objtag);
else
sys_vgui(".x%lx.c dtag selected arrange\n", x);
} else if (yrnxt) {
// lower into middle
if (objtag)
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag);
else {
sys_vgui(".x%lx.c addtag arrange withtag selected\n", x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s 0\n", x, rtext_gettag(yrnxt), rtext_gettag(yr));
}
} else {
// fall back to legacy redraw for objects that are not patchable
canvas_redraw(x);
......@@ -271,8 +274,10 @@ int canvas_restore_original_position(t_glist *x, t_gobj *y, const char* objtag,
// raise into middle
if (objtag)
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s %s\n", x, rtext_gettag(yrnxt), rtext_gettag(yr), objtag);
else
else {
sys_vgui(".x%lx.c addtag arrange withtag selected\n", x);
sys_vgui("pdtk_find_lowest_widget_withtag_and_arrange .x%lx.c %s %s 0\n", x, rtext_gettag(yrnxt), rtext_gettag(yr));
}
} else if (y->g_next == NULL) {
// we get here if we are supposed to go all the way to the top
if (objtag)
......@@ -2191,7 +2196,7 @@ void canvas_vis(t_canvas *x, t_floatarg f)
* a gl_editor already, if its not, it will not have a gl_editor.
* canvas_create_editor(x) checks if a gl_editor is already created,
* so its ok to run it on a canvas that already has a gl_editor. */
if (x->gl_editor && x->gl_havewindow)
if (x->gl_editor && x->gl_havewindow && glist_isvisible(x))
{ /* just put us in front */
//fprintf(stderr,"existing\n");
sys_vgui("raise .x%lx\n", x);
......@@ -2578,6 +2583,7 @@ static void canvas_doarrange(t_canvas *x, t_float which, t_gobj *oldy, t_gobj *o
also added "To Front" and "To Back" */
static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos)
{
//fprintf(stderr,"canvas_done_pupup %lx\n", (t_int)x);
char pathbuf[FILENAME_MAX], namebuf[FILENAME_MAX];
t_gobj *y=NULL, *oldy=NULL, *oldy_prev=NULL, *oldy_next=NULL, *y_begin, *y_end=NULL;
int x1, y1, x2, y2;
......@@ -2610,13 +2616,16 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
if (!glist_isselected(x, y))
glist_select(x, y);
}
// this was a bogus/unsupported call--get me out of here!
if (!x->gl_editor->e_selection) {
post("Popup action could not be performed because multiple items were selected...");
return;
}
}
//}
// this was a bogus/unsupported call for tofront/back--get me out of here!
// we don't have to check for multiple objects being selected since we did noselect
// above explicitly for cases 3 and 4 when detecting more than one selected object
if ((which == 3 || which == 4) && !x->gl_editor->e_selection) {
post("Popup action could not be performed because no object was found under the cursor...");
return;
}
for (y = x->gl_list; y; y = y->g_next)
{
......@@ -2652,11 +2661,12 @@ static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float
//if (!glist_isselected(x, y))
// glist_select(x, y);
(*class_getpropertiesfn(pd_class(&y->g_pd)))(y, x);
return;
}
return;
}
else if (which == 1) /* open */
{
//fprintf(stderr,"OPEN\n");
if (!zgetfn(&y->g_pd, gensym("menu-open")))
continue;
vmess(&y->g_pd, gensym("menu-open"), "");
......@@ -4226,8 +4236,9 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
{
//fprintf(stderr,"canvas_displaceselection %d %d\n", dx, dy);
t_selection *y;
char *tag = NULL;
int resortin = 0, resortout = 0;
//old_displace = 0;
old_displace = 0;
if (!we_are_undoing && !canvas_undo_already_set_move && x->gl_editor->e_selection)
{
//canvas_setundo(x, canvas_undo_move, canvas_undo_set_move(x, 1),
......@@ -4245,11 +4256,17 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
//fprintf(stderr, "displaceselection with tag\n");
}
else {
/* we will move the non-conforming objects the old way */
/* we will move the non-conforming objects the old way THIS SHOULD GO AWAY SOON*/
gobj_displace(y->sel_what, x, dx, dy);
canvas_restore_original_position(x, y->sel_what, 0, -1);
//old_displace = 1;
//fprintf(stderr, "displaceselection\n");
t_object *ob = pd_checkobject(&y->sel_what->g_pd);
t_rtext *yyyy = glist_findrtext(x, (t_text *)&ob->ob_g);
if (yyyy) tag = rtext_gettag(yyyy);
if (tag)
canvas_restore_original_position(x, y->sel_what, tag, -1);
else
old_displace = 1;
tag = NULL;
//fprintf(stderr, "displaceselection old_displace=%d\n", old_displace);
}
t_class *cl = pd_class(&y->sel_what->g_pd);
if (cl == vinlet_class) resortin = 1;
......@@ -4267,8 +4284,8 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
// to proper ordering of objects as they have been redrawn on top
// of everything else rather than where they were supposed to be
// (e.g. possibly in the middle or at the bottom)
//if (old_displace) canvas_redraw(x);
//old_displace = 0;
if (old_displace) canvas_redraw(x);
old_displace = 0;
}
/* this routine is called whenever a key is pressed or released. "x"
......@@ -4712,10 +4729,13 @@ void glob_verifyquit(void *dummy, t_floatarg f)
*/
void canvas_menuclose(t_canvas *x, t_floatarg fforce)
{
//fprintf(stderr,"canvas_menuclose %lx %f\n", (t_int)x, fforce);
int force = fforce;
t_glist *g;
if (x->gl_owner && (force == 0 || force == 1))
if (x->gl_owner && (force == 0 || force == 1)) {
fprintf(stderr," invis\n");
canvas_vis(x, 0); /* if subpatch, just invis it */
}
else if (force == 0)
{
g = glist_finddirty(x);
......@@ -4726,7 +4746,7 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce)
/* if this is an abstraction */
vmess(&g->gl_pd, gensym("menu-open"), "");
} else {
/* is this even necessary? */
// is this even necessary?
canvas_vis(g, 1);
}
if (!glist_istoplevel(g) && g->gl_env) {
......@@ -4895,9 +4915,9 @@ static void canvas_find_parent(t_canvas *x)
{
if (x->gl_owner) {
t_glist *owner = x->gl_owner;
while (!glist_isvisible(owner) && owner->gl_owner)
while (!glist_isvisible(owner) && !owner->gl_havewindow && owner->gl_owner)
owner = owner->gl_owner;
if (glist_isvisible(owner))
if (glist_isvisible(owner) && owner->gl_havewindow)
canvas_vis(owner, 1);
}
else {
......
......@@ -778,7 +778,7 @@ int garray_getname(t_garray *x, t_symbol **namep);
static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
{
t_glist *x = (t_glist *)gr;
//fprintf(stderr,"graph vis gobj=.x%lx %d\n", (t_int)gr, vis);
//fprintf(stderr,"graph vis canvas=%lx gobj=%lx %d\n", (t_int)parent_glist, (t_int)gr, vis);
//fprintf(stderr,"graph_vis gr=.x%lx parent_glist=.x%lx glist_getcanvas(x->gl_owner)=.x%lx vis=%d\n", (t_int)gr, (t_int)parent_glist, (t_int)glist_getcanvas(x->gl_owner), vis);
char tag[50];
t_gobj *g;
......@@ -817,10 +817,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
if (vis && gobj_shouldvis(gr, parent_glist))
{
sys_vgui(".x%lx.c create ppolygon\
%d %d %d %d %d %d %d %d %d %d -tags {%sfill} -fill $graph_outline\n",
%d %d %d %d %d %d %d %d %d %d -tags {%sfill} -fill $graph_outline -stroke $graph_outline\n",
glist_getcanvas(x->gl_owner),
//parent_glist,
x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag);
glist_noselect(x->gl_owner);
}
else if (gobj_shouldvis(gr, parent_glist))
{
......@@ -1204,9 +1205,9 @@ static void graph_select(t_gobj *z, t_glist *glist, int state)
canvas, rtext_gettag(y),
(state? "$select_color" : "$graph_outline"));
sys_vgui(".x%lx.c itemconfigure %sfill -stroke %s\n",
sys_vgui(".x%lx.c itemconfigure %sfill -stroke %s -fill %s\n",
canvas, rtext_gettag(y),
(state? "$select_color" : "$graph_outline"));
(state? "$select_color" : "$graph_outline"), (state? "$select_color" : "$graph_outline"));
}
t_gobj *g;
......
......@@ -71,45 +71,34 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
//if (glist_isvisible(canvas)) {
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";
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
for(i=0; i<n; i++)
{
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxHRDO %lx text}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE%d %lxHRDO %s text}\n",
canvas, xx11, yy11, xx11+dx, yy12,
x->x_gui.x_bcol, x, i, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxBUT%d %lxHRDO %lx text}\n",
x->x_gui.x_bcol, x, i, x, nlet_tag);
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -stroke #%6.6x -tags {%lxBUT%d %lxHRDO %s text}\n",
canvas, xx21, yy21, xx22, yy22,
(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, i, x, x);
(x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, x, i, x, nlet_tag);
xx11 += dx;
xx21 += dx;
xx22 += dx;
x->x_drawn = x->x_on;
}
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxHRDO %lx text}\n",
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxHRDO %s text}\n",
canvas, xx11b+x->x_gui.x_ldx, yy11+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x, x);
x->x_gui.x_lcol, x, x, nlet_tag);
if(!x->x_gui.x_fsf.x_snd_able && canvas == x->x_gui.x_glist)
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n",
canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, x, nlet_tag, 0, nlet_tag, 0, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %s outlet}\n",
canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
if(!x->x_gui.x_fsf.x_rcv_able && canvas == x->x_gui.x_glist)
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n",
canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, nlet_tag, 0, nlet_tag, 0, x, x);
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %s inlet}\n",
canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, nlet_tag, 0, nlet_tag, 0, x, nlet_tag);
//}
}
......@@ -124,18 +113,7 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
if (glist_isvisible(canvas)) {
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";
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
xx11 = xx11b;
xx21=xx11b+s4;
......@@ -235,32 +213,21 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
if (glist_isvisible(canvas) && canvas == x->x_gui.x_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";
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
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 {%lxHRDO%so%d %so%d %lxHRDO %lx outlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%so%d %so%d %lxHRDO %s outlet}\n",
canvas,
xpos, ypos + x->x_gui.x_w-1,
xpos + IOWIDTH, ypos + x->x_gui.x_w,
x, nlet_tag, 0, nlet_tag, 0, x, x);
x, nlet_tag, 0, nlet_tag, 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 %lxHRDO%so%d\n", canvas, x, nlet_tag, 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 {%lxHRDO%si%d %si%d %lxHRDO %lx inlet}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -tags {%lxHRDO%si%d %si%d %lxHRDO %s inlet}\n",
canvas,
xpos, ypos,
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 0, x, x);
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, nlet_tag, 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 %lxHRDO%si%d\n", canvas, x, nlet_tag, 0);
}
......@@ -281,6 +248,8 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
// if so, disable highlighting
if (x->x_gui.x_glist == glist_getcanvas(glist)) {
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
for(i=0; i<n; i++)
{
sys_vgui(".x%lx.c itemconfigure %lxBASE%d -stroke $select_color\n", canvas, x, i);
......@@ -294,11 +263,11 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor bottom_right_corner\n",
sh->h_pathname, SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHRDO %lx}\n",
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxSCALE %lxHRDO %s}\n",
canvas, x->x_gui.x_obj.te_xpix + x->x_gui.x_w * x->x_number - SCALEHANDLE_WIDTH - 1,
x->x_gui.x_obj.te_ypix + x->x_gui.x_h - SCALEHANDLE_HEIGHT - 1,
SCALEHANDLE_WIDTH, SCALEHANDLE_HEIGHT,
sh->h_pathname, x, x, x);
sh->h_pathname, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
sh->h_pathname, sh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
......@@ -315,11 +284,11 @@ void hradio_draw_select(t_hradio* x, t_glist* glist)
sys_vgui("canvas %s -width %d -height %d -bg $select_color -bd 0 -cursor crosshair\n",
lh->h_pathname, LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT);
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxLABELH %lxHRDO %lx}\n",
sys_vgui(".x%x.c create window %d %d -anchor nw -width %d -height %d -window %s -tags {%lxLABEL %lxLABELH %lxHRDO %s}\n",
canvas, x->x_gui.x_obj.te_xpix+ x->x_gui.x_ldx - LABELHANDLE_WIDTH,
x->x_gui.x_obj.te_ypix + x->x_gui.x_ldy - LABELHANDLE_HEIGHT,
LABELHANDLE_WIDTH, LABELHANDLE_HEIGHT,
lh->h_pathname, x, x, x, x);
lh->h_pathname, x, x, x, nlet_tag);
sys_vgui("bind %s <Button> {pd [concat %s _click 1 %%x %%y \\;]}\n",
lh->h_pathname, lh->h_bindsym->s_name);
sys_vgui("bind %s <ButtonRelease> {pd [concat %s _click 0 0 0 \\;]}\n",
......
......@@ -83,41 +83,30 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist)
//if (glist_isvisible(canvas)) {
t_gobj *y = (t_gobj *)x;
t_object *ob = pd_checkobject(&y->g_pd);
char *nlet_tag = iem_get_tag(glist, (t_iemgui *)x);
/* 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";
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxHSLDR %lx text}\n",
sys_vgui(".x%lx.c create prect %d %d %d %d -fill #%6.6x -tags {%lxBASE %lxHSLDR %s text}\n",
canvas, xpos, ypos,
xpos + x->x_gui.x_w+5, ypos + x->x_gui.x_h,
x->x_gui.x_bcol, x, x, x);
sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 -stroke #%6.6x -tags {%lxKNOB %lxHSLDR %lx text}\n",
x->x_gui.x_bcol, x, x, nlet_tag);
sys_vgui(".x%lx.c create polyline %d %d %d %d -strokewidth 3 -stroke #%6.6x -tags {%lxKNOB %lxHSLDR %s text}\n",
canvas, r, ypos+2, r,
ypos + x->x_gui.x_h-2, x->x_gui.x_fcol, x, x, x);
ypos + x->x_gui.x_h-2, x->x_gui.x_fcol, x, x, nlet_tag);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w \
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxHSLDR %lx text}\n",
-font {{%s} -%d %s} -fill #%6.6x -tags {%lxLABEL %lxHSLDR % text}\n",
canvas, xpos+x->x_gui.x_ldx,
ypos+x->x_gui.x_ldy,
strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"",
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x, x);