Commit 6fab9027 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

added ability for gop to intelligently detect when iemgui objects fit (or...

added ability for gop to intelligently detect when iemgui objects fit (or don't) inside gop window. the same also applies to dynamic changes to iemgui properties (size, font, label, delta, position, etc.)
parent 15812c2b
......@@ -415,21 +415,25 @@ void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
iemgui->x_lab_unexpanded = lab;
iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
if(glist_isvisible(iemgui->x_glist))
if(glist_isvisible(iemgui->x_glist)) {
sys_vgui(".x%lx.c itemconfigure %lxLABEL -text {%s} \n",
glist_getcanvas(iemgui->x_glist), x,
strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:"");
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_CONFIG);
}
}
void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
{
iemgui->x_ldx = (int)atom_getintarg(0, ac, av);
iemgui->x_ldy = (int)atom_getintarg(1, ac, av);
if(glist_isvisible(iemgui->x_glist))
if(glist_isvisible(iemgui->x_glist)) {
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
glist_getcanvas(iemgui->x_glist), x,
text_xpix((t_object *)x,iemgui->x_glist)+iemgui->x_ldx,
text_ypix((t_object *)x,iemgui->x_glist)+iemgui->x_ldy);
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_CONFIG);
}
}
void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
......@@ -448,18 +452,109 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a
if(f < 4)
f = 4;
iemgui->x_fontsize = f;
if(glist_isvisible(iemgui->x_glist))
if(glist_isvisible(iemgui->x_glist)) {
sys_vgui(".x%lx.c itemconfigure %lxLABEL -font {{%s} -%d %s}\n",
glist_getcanvas(iemgui->x_glist), x, iemgui->x_font,
iemgui->x_fontsize, sys_fontweight);
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_CONFIG);
}
}
//Sans: 84 x 10 (14) -> 6 x 10 -> 1.0
//Helvetica: 70 x 10 (14) -> 5 x 10 -> 0.83333
//Times: 61 x 10 (14) -> 4.357 x 10 -> 0.72619; 0.735 appears to work better
void iemgui_label_getrect(t_iemgui x_gui, t_glist *x, int *xp1, int *yp1, int *xp2, int *yp2)
{
t_float width_multiplier;
int label_length;
int label_x1;
int label_y1;
int label_x2;
int label_y2;
int actual_fontsize; //seems tk does its own thing when it comes to rendering
int actual_height;
if (x->gl_isgraph && !glist_istoplevel(x)) {
//fprintf(stderr,"iemgui_label_getrect\n");
if (strcmp(x_gui.x_lab->s_name, "empty")) {
switch(x_gui.x_fsf.x_font_style) {
case 1:
width_multiplier = 0.83333;
break;
case 2:
width_multiplier = 0.735;
break;
default:
width_multiplier = 1.0;
break;
}
if (x_gui.x_fontsize % 2 == 0) {
actual_fontsize = x_gui.x_fontsize;
} else {
actual_fontsize = x_gui.x_fontsize;
}
actual_height = actual_fontsize;
//exceptions
if (x_gui.x_fsf.x_font_style == 0 && (actual_fontsize == 8 || actual_fontsize == 13 || actual_fontsize % 10 == 1 || actual_fontsize % 10 == 6 || (actual_fontsize > 48 && actual_fontsize < 100 && (actual_fontsize %10 == 4 || actual_fontsize %10 == 9))) ) {
actual_fontsize += 1;
}
else if (x_gui.x_fsf.x_font_style == 1 && actual_fontsize >= 5 && actual_fontsize < 13 && actual_fontsize % 2 == 1)
actual_fontsize += 1;
else if (x_gui.x_fsf.x_font_style == 2 && actual_fontsize >= 5 && actual_fontsize % 2 == 1)
actual_fontsize += 1;
if (actual_height == 9)
actual_height += 1;
//done with exceptions
width_multiplier = width_multiplier * (actual_fontsize * 0.6);
label_length = strlen(x_gui.x_lab->s_name);
label_x1 = *xp1 + x_gui.x_ldx;
label_y1 = *yp1 + x_gui.x_ldy - actual_height/2;
label_x2 = label_x1 + (label_length * width_multiplier);
label_y2 = label_y1 + actual_height*1.1;
//DEBUG
//fprintf(stderr,"%f %d %d\n", width_multiplier, label_length, x_gui.x_fsf.x_font_style);
//sys_vgui(".x%lx.c delete iemguiDEBUG\n", x);
//sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags iemguiDEBUG\n", x, label_x1, label_y1, label_x2, label_y2);
if (label_x1 < *xp1) *xp1 = label_x1;
if (label_x2 > *xp2) *xp2 = label_x2;
if (label_y1 < *yp1) *yp1 = label_y1;
if (label_y2 > *yp2) *yp2 = label_y2;
//DEBUG
//sys_vgui(".x%lx.c delete iemguiDEBUG\n", x);
//sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags iemguiDEBUG\n", x, *xp1, *yp1, *xp2, *yp2);
}
}
}
void iemgui_shouldvis(void *x, t_iemgui *iemgui, int mode)
{
if(gobj_shouldvis(x, iemgui->x_glist)) {
if (!iemgui->x_vis) {
//fprintf(stderr,"draw new\n");
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_NEW);
canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
iemgui->x_vis = 1;
}
//fprintf(stderr,"draw move iemgui->x_w=%d\n", iemgui->x_w);
(*iemgui->x_draw)(x, iemgui->x_glist, mode);
canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
} else if (iemgui->x_vis) {
//fprintf(stderr,"draw erase\n");
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_ERASE);
iemgui->x_vis = 0;
}
}
void iemgui_size(void *x, t_iemgui *iemgui)
{
if(glist_isvisible(iemgui->x_glist))
{
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_MOVE);
}
}
......@@ -469,8 +564,7 @@ void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
iemgui->x_obj.te_ypix += (int)atom_getintarg(1, ac, av);
if(glist_isvisible(iemgui->x_glist))
{
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_MOVE);
}
}
......@@ -479,10 +573,7 @@ void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av);
iemgui->x_obj.te_ypix = (int)atom_getintarg(1, ac, av);
if(glist_isvisible(iemgui->x_glist))
{
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(iemgui->x_glist), (t_text*)x);
}
iemgui_shouldvis(x, iemgui, IEM_GUI_DRAW_MODE_MOVE);
}
void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av)
......@@ -504,8 +595,7 @@ void iemgui_displace(t_gobj *z, t_glist *glist, int dx, int dy)
t_iemguidummy *x = (t_iemguidummy *)z;
x->x_gui.x_obj.te_xpix += dx;
x->x_gui.x_obj.te_ypix += dy;
(*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z);
iemgui_shouldvis(x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
}
void iemgui_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
......@@ -535,12 +625,15 @@ void iemgui_vis(t_gobj *z, t_glist *glist, int vis)
{
t_iemguidummy *x = (t_iemguidummy *)z;
if (gobj_shouldvis(z, glist)) {
if (vis)
if (vis) {
(*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_NEW);
x->x_gui.x_vis = 1;
}
else
{
(*x->x_gui.x_draw)((void *)z, glist, IEM_GUI_DRAW_MODE_ERASE);
sys_unqueuegui(z);
x->x_gui.x_vis = 0;
}
}
}
......
......@@ -214,6 +214,7 @@ typedef struct _iemgui
int label_offset_x;
int label_offset_y;
int label_vis;
int x_vis; /* is the object drawn? */
} t_iemgui;
typedef struct _iemguidummy
......@@ -372,6 +373,8 @@ EXTERN void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s);
EXTERN void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s);
EXTERN void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
EXTERN void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
EXTERN void iemgui_label_getrect(t_iemgui x_gui, t_glist *x, int *xp1, int *yp1, int *xp2, int *yp2);
EXTERN void iemgui_shouldvis(void *x, t_iemgui *iemgui, int mode);
EXTERN void iemgui_size(void *x, t_iemgui *iemgui);
EXTERN void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
EXTERN void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av);
......
......@@ -88,15 +88,15 @@ void bng_draw_new(t_bng *x, t_glist *glist)
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x);
if(!x->x_gui.x_fsf.x_snd_able) {
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%so%d %lxBNG outlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%so%d %lxBNG outlet}\n",
canvas, xpos,
ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
ypos + x->x_gui.x_h, nlet_tag, 0, x);
ypos + x->x_gui.x_h, x, nlet_tag, 0, x);
}
if(!x->x_gui.x_fsf.x_rcv_able) {
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%si%d %lxBNG inlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxBNG%si%d %lxBNG inlet}\n",
canvas, xpos, ypos,
xpos + IOWIDTH, ypos+1, nlet_tag, 0, x);
xpos + IOWIDTH, ypos+1, x, nlet_tag, 0, x);
}
//}
}
......@@ -133,13 +133,13 @@ void bng_draw_move(t_bng *x, t_glist *glist)
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
canvas, nlet_tag, 0, xpos,
sys_vgui(".x%lx.c coords %lxBNG%so%d %d %d %d %d\n",
canvas, x, nlet_tag, 0, xpos,
ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
ypos + x->x_gui.x_h);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
canvas, nlet_tag, 0, xpos, ypos,
sys_vgui(".x%lx.c coords %lxBNG%si%d %d %d %d %d\n",
canvas, x, nlet_tag, 0, xpos, ypos,
xpos + IOWIDTH, ypos+1);
/* redraw scale handle rectangle if selected */
if (x->x_gui.x_fsf.x_selected)
......@@ -221,18 +221,18 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags)
else nlet_tag = "bogus";
if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %so%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxBNG%so%d\n",
canvas, xpos,
ypos + x->x_gui.x_h-1, xpos + IOWIDTH,
ypos + x->x_gui.x_h, nlet_tag, 0);
ypos + x->x_gui.x_h, x, nlet_tag, 0);
if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c delete %so%d\n", canvas, nlet_tag, 0);
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 rectangle %d %d %d %d -tags %si%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxBNG%si%d\n",
canvas, xpos, ypos,
xpos + IOWIDTH, ypos+1, nlet_tag, 0);
xpos + IOWIDTH, ypos+1, 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 delete %si%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxBNG%si%d\n", canvas, x, nlet_tag, 0);
}
}
......@@ -545,6 +545,8 @@ static void bng_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *xp2,
*yp1 = text_ypix(&x->x_gui.x_obj, glist);
*xp2 = *xp1 + x->x_gui.x_w;
*yp2 = *yp1 + x->x_gui.x_h;
iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
}
static void bng_save(t_gobj *z, t_binbuf *b)
......@@ -683,8 +685,9 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv)
bng_check_minmax(x, ftbreak, fthold);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
//canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
/* forcing redraw of the scale handle */
if (x->x_gui.x_fsf.x_selected) {
......
......@@ -2136,13 +2136,16 @@ void canvas_vis(t_canvas *x, t_floatarg f)
}
g = g->g_next;
}
// now check if canvas has its properties open
properties = gfxstub_haveproperties((void *)x);
if (properties) {
//sys_vgui("destroy .gfxstub%lx\n", properties);
gfxstub_deleteforkey((void *)x);
// now check if canvas has its properties open and
// if the canvas is not gop-enabled or its parent is not visible
// close its properties
if (!x->gl_isgraph || x->gl_owner && !glist_isvisible(x->gl_owner)) {
properties = gfxstub_haveproperties((void *)x);
if (properties) {
//sys_vgui("destroy .gfxstub%lx\n", properties);
gfxstub_deleteforkey((void *)x);
}
}
for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++)
;
......
......@@ -105,11 +105,11 @@ void hradio_draw_new(t_hradio *x, t_glist *glist)
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%so%d %lxHRDO outlet}\n",
canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, nlet_tag, 0, x);
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%so%d %lxHRDO c outlet}\n",
canvas, xx11b, yy12-1, xx11b + IOWIDTH, yy12, x, nlet_tag, 0, x);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%si%d %lxHRDO inlet}\n",
canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, nlet_tag, 0, x);
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHRDO%si%d %lxHRDO inlet}\n",
canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, nlet_tag, 0, x);
//}
}
......@@ -153,11 +153,11 @@ void hradio_draw_move(t_hradio *x, t_glist *glist)
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
canvas, x, xx11b+x->x_gui.x_ldx, yy11+x->x_gui.x_ldy);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
canvas, nlet_tag, 0, xx11b, yy12-1, xx11b + IOWIDTH, yy12);
sys_vgui(".x%lx.c coords %lxHRDO%so%d %d %d %d %d\n",
canvas, x, nlet_tag, 0, xx11b, yy12-1, xx11b + IOWIDTH, yy12);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
canvas, nlet_tag, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1);
sys_vgui(".x%lx.c coords %lxHRDO%si%d %d %d %d %d\n",
canvas, x, nlet_tag, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1);
/* redraw scale handle rectangle if selected */
if (x->x_gui.x_fsf.x_selected)
hradio_draw_select(x, x->x_gui.x_glist);
......@@ -249,20 +249,20 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags)
else nlet_tag = "bogus";
if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %so%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxHRDO%so%d\n",
canvas,
xpos, ypos + x->x_gui.x_w-1,
xpos + IOWIDTH, ypos + x->x_gui.x_w,
nlet_tag, 0);
x, nlet_tag, 0);
if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c delete %so%d\n", canvas, nlet_tag, 0);
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 rectangle %d %d %d %d -tags %si%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxHRDO%si%d\n",
canvas,
xpos, ypos,
xpos + IOWIDTH, ypos+1, nlet_tag, 0);
xpos + IOWIDTH, ypos+1, 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 delete %si%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxHRDO%si%d\n", canvas, x, nlet_tag, 0);
}
}
......@@ -572,6 +572,8 @@ static void hradio_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int *x
*yp1 = text_ypix(&x->x_gui.x_obj, glist);
*xp2 = *xp1 + x->x_gui.x_w*x->x_number;
*yp2 = *yp1 + x->x_gui.x_h;
iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
}
static void hradio_save(t_gobj *z, t_binbuf *b)
......@@ -652,8 +654,9 @@ static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv)
{
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
//canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
}
/* forcing redraw of the scale handle */
......
......@@ -111,13 +111,13 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist)
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%so%d %lxHSLDR outlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%so%d %lxHSLDR outlet}\n",
canvas, xpos, ypos + x->x_gui.x_h-1,
xpos+7, ypos + x->x_gui.x_h, nlet_tag, 0, x);
xpos+7, ypos + x->x_gui.x_h, x, nlet_tag, 0, x);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%si%d %lxHSLDR inlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxHSLDR%si%d %lxHSLDR inlet}\n",
canvas, xpos, ypos,
xpos+7, ypos+1, nlet_tag, 0, x);
xpos+7, ypos+1, x, nlet_tag, 0, x);
//}
}
......@@ -153,13 +153,13 @@ static void hslider_draw_move(t_hslider *x, t_glist *glist)
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
canvas, nlet_tag, 0,
sys_vgui(".x%lx.c coords %lxHSLDR%so%d %d %d %d %d\n",
canvas, x, nlet_tag, 0,
xpos, ypos + x->x_gui.x_h-1,
xpos+7, ypos + x->x_gui.x_h);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
canvas, nlet_tag, 0,
sys_vgui(".x%lx.c coords %lxHSLDR%si%d %d %d %d %d\n",
canvas, x, nlet_tag, 0,
xpos, ypos,
xpos+7, ypos+1);
/* redraw scale handle rectangle if selected */
......@@ -242,17 +242,17 @@ static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags)
else nlet_tag = "bogus";
if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %so%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxHSLDR%so%d\n",
canvas, xpos, ypos + x->x_gui.x_h-1,
xpos+7, ypos + x->x_gui.x_h, nlet_tag, 0);
xpos+7, ypos + x->x_gui.x_h, x, nlet_tag, 0);
if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c delete %so%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxHSLDR%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 rectangle %d %d %d %d -tags %si%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxHSLDR%si%d\n",
canvas, xpos, ypos,
xpos+7, ypos+1, nlet_tag, 0);
xpos+7, ypos+1, 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 delete %si%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxHSLDR%si%d\n", canvas, x, nlet_tag, 0);
}
}
......@@ -559,6 +559,8 @@ static void hslider_getrect(t_gobj *z, t_glist *glist,
*yp1 = text_ypix(&x->x_gui.x_obj, glist);
*xp2 = *xp1 + x->x_gui.x_w + 8;
*yp2 = *yp1 + x->x_gui.x_h;
iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
}
static void hslider_save(t_gobj *z, t_binbuf *b)
......@@ -727,8 +729,9 @@ static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv)
hslider_check_minmax(x, min, max);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
//canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
/* forcing redraw of the scale handle */
if (x->x_gui.x_fsf.x_selected) {
......
......@@ -439,6 +439,7 @@ static void my_canvas_getrect(t_gobj *z, t_glist *glist, int *xp1, int *yp1, int
*xp2 = *xp1 + x->x_gui.x_w;
*yp2 = *yp1 + x->x_gui.x_h;
}
iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
}
static void my_canvas_save(t_gobj *z, t_binbuf *b)
......@@ -514,7 +515,8 @@ static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv
h = 1;
x->x_vis_h = h;
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
/* forcing redraw of the scale handle */
if (x->x_gui.x_fsf.x_selected) {
......
......@@ -224,17 +224,17 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist)
xpos, ypos + x->x_gui.x_h,
IEM_GUI_COLOR_NORMAL, x->x_gui.x_bcol, x, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%so%d %lxNUM outlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%so%d %lxNUM outlet}\n",
canvas,
xpos, ypos + x->x_gui.x_h-1,
xpos+IOWIDTH, ypos + x->x_gui.x_h,
nlet_tag, 0, x);
x, nlet_tag, 0, x);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%si%d %lxNUM inlet}\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxNUM%si%d %lxNUM inlet}\n",
canvas,
xpos, ypos,
xpos+IOWIDTH, ypos+1,
nlet_tag, 0, x);
x, nlet_tag, 0, x);
} else {
sys_vgui(
".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -outline #%6.6x \
......@@ -298,13 +298,13 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist)
xpos, ypos + x->x_gui.x_h);
if (x->x_hide_frame <= 1) {
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c coords %so%d %d %d %d %d\n",
canvas, nlet_tag, 0,
sys_vgui(".x%lx.c coords %lxNUM%so%d %d %d %d %d\n",
canvas, x, nlet_tag, 0,
xpos, ypos + x->x_gui.x_h-1,
xpos+IOWIDTH, ypos + x->x_gui.x_h);
if(!x->x_gui.x_fsf.x_rcv_able)
sys_vgui(".x%lx.c coords %si%d %d %d %d %d\n",
canvas, nlet_tag, 0,
sys_vgui(".x%lx.c coords %lxNUM%si%d %d %d %d %d\n",
canvas, x, nlet_tag, 0,
xpos, ypos,
xpos+IOWIDTH, ypos+1);
}
......@@ -417,21 +417,21 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla
else nlet_tag = "bogus";
if((old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && !x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %so%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxNUM%so%d\n",
canvas,
xpos, ypos + x->x_gui.x_h-1,
xpos+IOWIDTH, ypos + x->x_gui.x_h,
nlet_tag, 0);
x, nlet_tag, 0);
if(!(old_snd_rcv_flags & IEM_GUI_OLD_SND_FLAG) && x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c delete %so%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxNUM%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 rectangle %d %d %d %d -tags %si%d\n",
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags %lxNUM%si%d\n",
canvas,
xpos, ypos,
xpos+IOWIDTH, ypos+1,
nlet_tag, 0);
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 delete %si%d\n", canvas, nlet_tag, 0);
sys_vgui(".x%lx.c delete %lxNUM%si%d\n", canvas, x, nlet_tag, 0);
}
}
......@@ -784,6 +784,8 @@ static void my_numbox_getrect(t_gobj *z, t_glist *glist,
*yp1 = text_ypix(&x->x_gui.x_obj, glist);
*xp2 = *xp1 + x->x_numwidth;
*yp2 = *yp1 + x->x_gui.x_h;
iemgui_label_getrect(x->x_gui, glist, xp1, yp1, xp2, yp2);
}
static void my_numbox_save(t_gobj *z, t_binbuf *b)
......@@ -928,12 +930,14 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc,
my_numbox_check_minmax(x, min, max);
if (need_to_redraw) {
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_ERASE);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_NEW);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_NEW);
} else {
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_IO + sr_flags);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
//(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_MOVE);
iemgui_shouldvis((void *)x, &x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
}
canvas_fixlinesfor(glist_getcanvas(x->x_gui.x_glist), (t_text*)x);
......
......@@ -96,11 +96,11 @@ void toggle_draw_new(t_toggle *x, t_glist *glist)
x->x_gui.x_font, x->x_gui.x_fontsize, sys_fontweight,
x->x_gui.x_lcol, x, x);
if(!x->x_gui.x_fsf.x_snd_able)
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%so%d %lxTGL outlet}\n",
canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h, nlet_tag, 0, x);
sys_vgui(".x%lx.c create rectangle %d %d %d %d -tags {%lxTGL%so%d %lxTGL outlet}\n",
canvas, xx, yy + x->x_gui.x_h-1, xx + IOWIDTH, yy + x->x_gui.x_h<