Commit 38c855f1 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

revamped iemgui nlet color detection by embedding var in t_text

parent 61370de4
......@@ -906,6 +906,8 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -102,33 +102,9 @@ static t_canvas *c_selection;
/* iemgui uses black inlets and outlets while default objects use gray ones
add here more as necessary */
int gobj_filter_highlight_behavior(t_rtext *y) {
int gobj_filter_highlight_behavior(t_text *y) {
char *buf;
char name[4];
int bufsize, i;
rtext_gettext(y, &buf, &bufsize);
if (bufsize > 3) bufsize = 3;
for (i = 0; i < bufsize; i++) {
name[i] = buf[i];
}
name[i]='\0';
//fprintf(stderr,"object name = >%s<\n", name);
if (!strcmp(name, "bng") ||
!strcmp(name, "nbx") ||
!strcmp(name, "hdl") ||
!strcmp(name, "hsl") ||
!strcmp(name, "tgl") ||
!strcmp(name, "vdl") ||
!strcmp(name, "vsl") ||
!strcmp(name, "vu ") ||
/* alternative names for hradio and vradio when invoked from the menu */
!strcmp(name, "hra") ||
!strcmp(name, "vra")
)
return 1;
return 0;
return (y->te_iemgui);
}
/* ---------------- generic widget behavior ------------------------- */
......@@ -2967,7 +2943,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
}
if (yr)
{
last_outlet_filter = gobj_filter_highlight_behavior(yr);
last_outlet_filter = gobj_filter_highlight_behavior((t_text *)&ob->ob_g);
//fprintf(stderr,"last_outlet_filter == %d\n", last_outlet_filter);
sprintf(x->gl_editor->canvas_cnct_outlet_tag,
"%so%d",
......@@ -3025,7 +3001,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
if (yr)
{
last_inlet_filter = gobj_filter_highlight_behavior(yr);
last_inlet_filter = gobj_filter_highlight_behavior((t_text *)&ob->ob_g);
//fprintf(stderr,"last_inlet_filter == %d\n", last_inlet_filter);
sprintf(x->gl_editor->canvas_cnct_inlet_tag,
"%si%d",
......@@ -3973,7 +3949,7 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit)
}
if (y)
{
last_inlet_filter = gobj_filter_highlight_behavior(y);
last_inlet_filter = gobj_filter_highlight_behavior((t_text *)&ob2->ob_g);
//fprintf(stderr,"last_inlet_filter == %d\n", last_inlet_filter);
sprintf(x->gl_editor->canvas_cnct_inlet_tag,
"%si%d",
......@@ -4251,7 +4227,7 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
//fprintf(stderr,"canvas_displaceselection %d %d\n", dx, dy);
t_selection *y;
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),
......@@ -4271,7 +4247,8 @@ static void canvas_displaceselection(t_canvas *x, int dx, int dy)
else {
/* we will move the non-conforming objects the old way */
gobj_displace(y->sel_what, x, dx, dy);
old_displace = 1;
canvas_restore_original_position(x, y->sel_what, 0, -1);
//old_displace = 1;
//fprintf(stderr, "displaceselection\n");
}
t_class *cl = pd_class(&y->sel_what->g_pd);
......@@ -4290,8 +4267,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"
......
......@@ -1001,6 +1001,8 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -1010,6 +1010,8 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -699,6 +699,8 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -1320,6 +1320,8 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
x->x_scaleheight = 0;
x->x_tmpfontsize = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -56,6 +56,7 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
t_atom at;
x->te_width = 0; /* don't know it yet. */
x->te_type = T_TEXT;
x->te_iemgui = 0;
x->te_binbuf = binbuf_new();
if (argc > 1)
{
......@@ -168,6 +169,9 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
x->te_ypix = ypix;
x->te_width = 0;
x->te_type = T_OBJECT;
/* let's see if iemgui objects did not already set the value to 1, otherwise set it explicitly to 0 */
if (x->te_iemgui != 1)
x->te_iemgui = 0;
glist_add(gl, &x->te_g);
if (selected)
......@@ -640,6 +644,7 @@ void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv)
x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float);
x->m_text.te_width = 0; /* don't know it yet. */
x->m_text.te_type = T_MESSAGE;
x->m_text.te_iemgui = 0;
x->m_text.te_binbuf = binbuf_new();
x->m_glist = gl;
x->m_clock = clock_new(x, (t_method)message_tick);
......@@ -1093,6 +1098,7 @@ void canvas_atom(t_glist *gl, t_atomtype type,
t_atom at;
x->a_text.te_width = 0; /* don't know it yet. */
x->a_text.te_type = T_ATOM;
x->a_text.te_iemgui = 0;
x->a_text.te_binbuf = binbuf_new();
x->a_glist = gl;
x->a_atom.a_type = type;
......
......@@ -837,6 +837,8 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -1005,6 +1005,8 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -999,6 +999,8 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
......@@ -1181,6 +1181,8 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.label_offset_y = 0;
x->x_gui.label_vis = 0;
x->x_gui.x_obj.te_iemgui = 1;
return (x);
}
......
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