Commit afb189f4 authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

remove canvas/glist arg in a bunch of recently added iemgui functions, and...

remove canvas/glist arg in a bunch of recently added iemgui functions, and introduce iemgui_draw_move & iemgui_draw_config
parent 44227f1d
......@@ -187,7 +187,7 @@ void iemgui_send(t_iemgui *x, t_symbol *s)
x->x_snd_unexpanded = snd;
x->x_snd = snd = canvas_realizedollar(x->x_glist, snd);
iemgui_verify_snd_ne_rcv(x);
iemgui_draw_io(x, x->x_glist, oldsndrcvable);
iemgui_draw_io(x, oldsndrcvable);
}
void iemgui_receive(t_iemgui *x, t_symbol *s)
......@@ -217,7 +217,7 @@ void iemgui_receive(t_iemgui *x, t_symbol *s)
x->x_rcv = rcv;
}
iemgui_verify_snd_ne_rcv(x);
iemgui_draw_io(x, x->x_glist, oldsndrcvable);
iemgui_draw_io(x, oldsndrcvable);
}
void iemgui_label(t_iemgui *x, t_symbol *s)
......@@ -352,6 +352,49 @@ void iemgui_label_getrect(t_iemgui x_gui, t_glist *x,
}
}
#if 0 // future way of reordering stuff for iemgui_shouldvis
/*
// some day when the object tagging is
// properly done for all GUI objects
glist_noselect(canvas);
glist_select(canvas, y);
t_gobj *yy = canvas->gl_list;
if (yy != y)
{
while (yy && yy->g_next != y)
yy = yy->g_next;
// now we have yy which is right before our y graph
t_rtext *yr = NULL;
if (yy)
{
yr = glist_findrtext(canvas, (t_text *)yy);
}
if (yr)
{
fprintf(stderr,"lower\n");
sys_vgui(".x%lx.c lower selected %s\n", canvas, rtext_gettag(yr));
sys_vgui(".x%lx.c raise selected %s\n", canvas, rtext_gettag(yr));
//canvas_raise_all_cords(canvas);
}
else
{
// fall back to legacy redraw for objects
// that are not patchable
fprintf(stderr,"lower fallback redraw\n");
canvas_redraw(canvas);
}
}
else
{
// we get here if we are supposed to go
// all the way to the bottom
fprintf(stderr,"lower to the bottom\n");
sys_vgui(".x%lx.c lower selected\n", canvas);
}
glist_noselect(canvas);
*/
#endif
void iemgui_shouldvis(t_iemgui *x, int mode)
{
gop_redraw = 1;
......@@ -360,7 +403,7 @@ void iemgui_shouldvis(t_iemgui *x, int mode)
if (!x->x_vis)
{
//fprintf(stderr,"draw new %d\n", mode);
iemgui_draw_new(x, x->x_glist);
iemgui_draw_new(x);
canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x);
x->x_vis = 1;
if (x->x_glist != glist_getcanvas(x->x_glist))
......@@ -375,64 +418,20 @@ void iemgui_shouldvis(t_iemgui *x, int mode)
// reorder it visually
glist_redraw(canvas);
/*
// some day when the object tagging is
// properly done for all GUI objects
glist_noselect(canvas);
glist_select(canvas, y);
t_gobj *yy = canvas->gl_list;
if (yy != y)
{
fprintf(stderr,"not bottom\n");
while (yy && yy->g_next != y)
{
fprintf(stderr,"+\n");
yy = yy->g_next;
}
// now we have yy which is right before our y graph
t_object *ob = NULL;
t_rtext *yr = NULL;
if (yy)
{
yr = glist_findrtext(canvas, (t_text *)yy);
}
if (yr)
{
fprintf(stderr,"lower\n");
sys_vgui(".x%lx.c lower selected %s\n",
canvas, rtext_gettag(yr));
sys_vgui(".x%lx.c raise selected %s\n",
canvas, rtext_gettag(yr));
//canvas_raise_all_cords(canvas);
}
else
{
// fall back to legacy redraw for objects
// that are not patchable
fprintf(stderr,"lower fallback redraw\n");
canvas_redraw(canvas);
}
}
else
{
// we get here if we are supposed to go
// all the way to the bottom
fprintf(stderr,"lower to the bottom\n");
sys_vgui(".x%lx.c lower selected\n", canvas);
}
glist_noselect(canvas);
*/
}
}
//fprintf(stderr,"draw move x->x_w=%d\n", x->x_w);
x->x_draw(x, x->x_glist, mode);
if (mode==IEM_GUI_DRAW_MODE_NEW) iemgui_draw_new( x);
else if (mode==IEM_GUI_DRAW_MODE_MOVE) iemgui_draw_move( x);
else if (mode==IEM_GUI_DRAW_MODE_CONFIG) iemgui_draw_config(x);
else bug("iemgui_shouldvis");
scalehandle_check_and_redraw(x);
canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x);
}
else if (x->x_vis)
{
//fprintf(stderr,"draw erase %d\n", mode);
iemgui_draw_erase(x, x->x_glist);
iemgui_draw_erase(x);
x->x_vis = 0;
}
gop_redraw = 0;
......@@ -487,7 +486,7 @@ void iemgui_displace_withtag(t_gobj *z, t_glist *glist, int dx, int dy)
t_iemgui *x = (t_iemgui *)z;
x->x_obj.te_xpix += dx;
x->x_obj.te_ypix += dy;
//x->x_gui.x_draw((void *)z, glist, IEM_GUI_DRAW_MODE_MOVE);
//iemgui_draw_move(x);
canvas_fixlinesfor(glist_getcanvas(glist), (t_text *)z);
}
......@@ -504,9 +503,9 @@ void iemgui_select(t_gobj *z, t_glist *glist, int selected)
sys_vgui(".x%lx.c itemconfigure {x%lx&&border} -stroke %s\n", canvas, x,
x->x_selected && x->x_glist == canvas ? selection_color : fcol);
x->x_draw((void *)z, glist, IEM_GUI_DRAW_MODE_SELECT);
scalehandle_draw(x,glist);
iemgui_label_draw_select(x,canvas);
iemgui_tag_selected(x,canvas);
scalehandle_draw(x);
iemgui_label_draw_select(x);
iemgui_tag_selected(x);
}
void iemgui_delete(t_gobj *z, t_glist *glist)
......@@ -520,10 +519,10 @@ void iemgui_vis(t_gobj *z, t_glist *glist, int vis)
if (gobj_shouldvis(z, glist))
{
if (vis)
iemgui_draw_new(x, glist);
iemgui_draw_new(x);
else
{
iemgui_draw_erase(x, x->x_glist);
iemgui_draw_erase(x);
sys_unqueuegui(z);
}
x->x_vis = vis;
......@@ -640,9 +639,10 @@ void scalehandle_bind(t_scalehandle *h) {
// in 18 cases only, because canvas does not fit the pattern below.
// canvas has no label handle and has a motion handle
// but in the case of canvas, the "iemgui" tag is added (it wasn't the case originally)
void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py) {
void scalehandle_draw_select(t_scalehandle *h, int px, int py) {
char tags[128]; // BNG may need up to 100 chars in 64-bit mode, for example
t_iemgui *x = (t_iemgui *)h->h_master;
t_canvas *canvas=glist_getcanvas(x->x_glist);
//int px,py;
//t_class *c = pd_class((t_pd *)x);
......@@ -659,7 +659,7 @@ void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py)
int sx = h->h_scale ? SCALEHANDLE_WIDTH : LABELHANDLE_WIDTH;
int sy = h->h_scale ? SCALEHANDLE_HEIGHT : LABELHANDLE_HEIGHT;
scalehandle_draw_erase(h,canvas);
scalehandle_draw_erase(h);
if (!h->h_vis) {
sys_vgui("canvas %s -width %d -height %d -bg $pd_colors(selection) -bd 0 "
......@@ -676,17 +676,18 @@ void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py)
h->h_pathname, tags);
scalehandle_bind(h);
h->h_vis = 1;
/* not yet (this is not supported by current implementation)
} else {
/* not yet (this is not supported by current implementation) */
}/* else {
sys_vgui(".x%x.c coords %s %d %d\n", canvas, h->h_pathname,
x->x_obj.te_xpix+px-sx, x->x_obj.te_ypix+py-sy);
sys_vgui("raise %s\n", h->h_pathname); */
}
sys_vgui("raise %s\n", h->h_pathname);
}*/
}
extern t_class *my_canvas_class;
void scalehandle_draw_select2(t_iemgui *x, t_glist *canvas) {
void scalehandle_draw_select2(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x);
int sx,sy;
if (c==my_canvas_class) {
......@@ -697,12 +698,13 @@ void scalehandle_draw_select2(t_iemgui *x, t_glist *canvas) {
c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
sx=x2-x1; sy=y2-y1;
}
scalehandle_draw_select(x->x_handle,canvas,sx-1,sy-1);
scalehandle_draw_select(x->x_handle,sx-1,sy-1);
if (x->x_lab!=s_empty)
scalehandle_draw_select(x->x_lhandle,canvas,x->x_ldx,x->x_ldy);
scalehandle_draw_select(x->x_lhandle,x->x_ldx,x->x_ldy);
}
void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas) {
void scalehandle_draw_erase(t_scalehandle *h) {
t_canvas *canvas=glist_getcanvas(h->h_glist);
if (!h->h_vis) return;
sys_vgui("destroy %s\n", h->h_pathname);
sys_vgui(".x%lx.c delete %lx%s\n", canvas, h->h_master,
......@@ -710,24 +712,25 @@ void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas) {
h->h_vis = 0;
}
void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas) {
void scalehandle_draw_erase2(t_iemgui *x) {
t_scalehandle *sh = (t_scalehandle *)(x->x_handle);
t_scalehandle *lh = (t_scalehandle *)(x->x_lhandle);
if (sh->h_vis) scalehandle_draw_erase(sh,canvas);
if (lh->h_vis) scalehandle_draw_erase(lh,canvas);
if (sh->h_vis) scalehandle_draw_erase(sh);
if (lh->h_vis) scalehandle_draw_erase(lh);
}
void scalehandle_draw(t_iemgui *x, t_glist *glist) {
if (x->x_glist == glist_getcanvas(glist)) {
if(x->x_selected == x->x_glist) scalehandle_draw_select2(x,glist);
else scalehandle_draw_erase2(x,glist);
void scalehandle_draw(t_iemgui *x) {
if (x->x_glist == glist_getcanvas(x->x_glist)) {
if(x->x_selected == x->x_glist) scalehandle_draw_select2(x);
else scalehandle_draw_erase2(x);
}
}
t_scalehandle *scalehandle_new(t_class *c, t_iemgui *x, int scale) {
t_scalehandle *scalehandle_new(t_class *c, t_gobj *x, t_glist *glist, int scale) {
t_scalehandle *h = (t_scalehandle *)pd_new(c);
char buf[64];
h->h_master = (t_gobj*)x;
h->h_glist = glist;
sprintf(buf, "_h%lx", (t_int)h);
pd_bind((t_pd *)h, h->h_bindsym = gensym(buf));
sprintf(h->h_outlinetag, "h%lx", (t_int)h);
......@@ -736,7 +739,7 @@ t_scalehandle *scalehandle_new(t_class *c, t_iemgui *x, int scale) {
//h->h_offset_x = 0; // unused (maybe keep for later)
//h->h_offset_y = 0; // unused (maybe keep for later)
h->h_vis = 0;
sprintf(h->h_pathname, ".x%lx.h%lx", (t_int)x->x_glist, (t_int)h);
sprintf(h->h_pathname, ".x%lx.h%lx", (t_int)h->h_glist, (t_int)h);
return h;
}
......@@ -838,7 +841,7 @@ void scalehandle_click_scale(t_scalehandle *h) {
void scalehandle_unclick_scale(t_scalehandle *h) {
t_iemgui *x = (t_iemgui *)h->h_master;
sys_vgui(".x%x.c delete %s\n", x->x_glist, h->h_outlinetag);
iemgui_io_draw_move(x, x->x_glist);
iemgui_io_draw_move(x);
iemgui_select((t_gobj *)x, x->x_glist, 1);
canvas_fixlinesfor(x->x_glist, (t_text *)x);
sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x->x_glist);
......@@ -870,20 +873,22 @@ void iemgui__clickhook3(t_scalehandle *sh, int newstate) {
static void scalehandle_check_and_redraw(t_iemgui *x)
{
if(x->x_selected == x->x_glist)
scalehandle_draw_select2(x,x->x_glist);
scalehandle_draw_select2(x);
}
//----------------------------------------------------------------
// IEMGUI refactor (by Mathieu)
void iemgui_tag_selected(t_iemgui *x, t_glist *canvas) {
void iemgui_tag_selected(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
if(x->x_selected)
sys_vgui(".x%lx.c addtag selected withtag x%lx\n", canvas, x);
else
sys_vgui(".x%lx.c dtag x%lx selected\n", canvas, x);
}
void iemgui_label_draw_new(t_iemgui *x, t_glist *canvas) {
void iemgui_label_draw_new(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
int x1=text_xpix(&x->x_obj, x->x_glist);
int y1=text_ypix(&x->x_obj, x->x_glist);
sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor w "
......@@ -893,14 +898,16 @@ void iemgui_label_draw_new(t_iemgui *x, t_glist *canvas) {
iemgui_font(x), x->x_lcol, x, x);
}
void iemgui_label_draw_move(t_iemgui *x, t_glist *canvas) {
void iemgui_label_draw_move(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
int x1=text_xpix(&x->x_obj, x->x_glist);
int y1=text_ypix(&x->x_obj, x->x_glist);
sys_vgui(".x%lx.c coords %lxLABEL %d %d\n",
canvas, x, x1+x->x_ldx, y1+x->x_ldy);
}
void iemgui_label_draw_config(t_iemgui *x, t_glist *canvas) {
void iemgui_label_draw_config(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
if (x->x_selected == canvas && x->x_glist == canvas)
sys_vgui(".x%lx.c itemconfigure %lxLABEL -font %s "
"-fill $pd_colors(selection) -text {%s} \n",
......@@ -915,13 +922,14 @@ void iemgui_label_draw_config(t_iemgui *x, t_glist *canvas) {
{
t_scalehandle *lh = (t_scalehandle *)(x->x_lhandle);
if (x->x_lab==s_empty)
scalehandle_draw_erase((t_scalehandle *)(x->x_lhandle),canvas);
scalehandle_draw_erase(x->x_lhandle);
else if (lh->h_vis == 0)
scalehandle_draw_select(lh,canvas,x->x_ldx,x->x_ldy);
scalehandle_draw_select(lh,x->x_ldx,x->x_ldy);
}
}
void iemgui_label_draw_select(t_iemgui *x, t_glist *canvas) {
void iemgui_label_draw_select(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
if (x->x_selected == canvas && x->x_glist == canvas)
sys_vgui(".x%lx.c itemconfigure %lxLABEL "
"-fill $pd_colors(selection)\n", canvas, x);
......@@ -930,12 +938,14 @@ void iemgui_label_draw_select(t_iemgui *x, t_glist *canvas) {
canvas, x, x->x_lcol);
}
extern t_class *my_numbox_class;
extern t_class *vu_class;
void iemgui_draw_io(t_iemgui *x, t_glist *glist, int old_sr_flags)
void iemgui_draw_io(t_iemgui *x, int old_sr_flags)
{
t_canvas *canvas=glist_getcanvas(glist);
t_canvas *canvas=glist_getcanvas(x->x_glist);
if (x->x_glist != canvas) return; // is gop
t_class *c = pd_class((t_pd *)x);
if (c==my_numbox_class && ((t_my_numbox *)x)->x_hide_frame > 1) return; //sigh
if (!(old_sr_flags&4) && (!glist_isvisible(canvas) || !(canvas == x->x_glist))) {
return;
......@@ -973,7 +983,8 @@ void iemgui_draw_io(t_iemgui *x, t_glist *glist, int old_sr_flags)
sys_vgui(".x%lx.c delete x%lxi%d\n", canvas, x, i);
}
void iemgui_io_draw_move(t_iemgui *x, t_glist *canvas) {
void iemgui_io_draw_move(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2;
c->c_wb->w_getrectfn((t_gobj *)x,canvas,&x1,&y1,&x2,&y2);
......@@ -986,7 +997,8 @@ void iemgui_io_draw_move(t_iemgui *x, t_glist *canvas) {
canvas, x, i, x1+i*k, y1, x1+i*k+IOWIDTH, y1+1);
}
void iemgui_base_draw_new(t_iemgui *x, t_glist *canvas) {
void iemgui_base_draw_new(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
......@@ -997,7 +1009,8 @@ void iemgui_base_draw_new(t_iemgui *x, t_glist *canvas) {
canvas, x1,y1,x2,y2, x->x_bcol, x, x);
}
void iemgui_base_draw_move(t_iemgui *x, t_glist *canvas) {
void iemgui_base_draw_move(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
t_class *c = pd_class((t_pd *)x);
int x1,y1,x2,y2,gr=gop_redraw; gop_redraw=0;
c->c_wb->w_getrectfn((t_gobj *)x,x->x_glist,&x1,&y1,&x2,&y2);
......@@ -1005,21 +1018,40 @@ void iemgui_base_draw_move(t_iemgui *x, t_glist *canvas) {
sys_vgui(".x%lx.c coords %lxBASE %d %d %d %d\n", canvas, x, x1, y1, x2, y2);
}
void iemgui_base_draw_config(t_iemgui *x, t_glist *canvas) {
void iemgui_base_draw_config(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
char fcol[8]; sprintf(fcol,"#%6.6x", x->x_fcol);
sys_vgui(".x%lx.c itemconfigure %lxBASE -fill #%6.6x\n", canvas, x, x->x_bcol);
}
void iemgui_draw_new(t_iemgui *x, t_glist *glist) {
void iemgui_draw_update(t_iemgui *x, t_glist *glist) {
x->x_draw(x, x->x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
void iemgui_draw_new(t_iemgui *x) {
x->x_draw(x, x->x_glist, IEM_GUI_DRAW_MODE_NEW);
t_canvas *canvas=glist_getcanvas(glist);
iemgui_label_draw_new(x,canvas);
iemgui_label_draw_new(x);
iemgui_draw_io(x,7);
canvas_raise_all_cords(glist_getcanvas(x->x_glist)); // used to be inside x_draw
}
void iemgui_draw_erase(t_iemgui *x, t_glist *glist) {
t_canvas *canvas=glist_getcanvas(glist);
void iemgui_draw_config(t_iemgui *x) {
x->x_draw(x, x->x_glist, IEM_GUI_DRAW_MODE_CONFIG);
iemgui_label_draw_config(x);
//iemgui_base_draw_config(x); // can't
}
void iemgui_draw_move(t_iemgui *x) {
x->x_draw(x, x->x_glist, IEM_GUI_DRAW_MODE_MOVE);
iemgui_label_draw_move(x);
//iemgui_base_draw_move(x); // can't
iemgui_io_draw_move(x);
}
void iemgui_draw_erase(t_iemgui *x) {
t_canvas *canvas=glist_getcanvas(x->x_glist);
sys_vgui(".x%lx.c delete x%lx\n", canvas, x);
scalehandle_draw_erase2(x,glist);
scalehandle_draw_erase2(x);
}
void scrollbar_update(t_glist *glist) {
......
......@@ -38,6 +38,7 @@ typedef struct _scalehandle
{
t_pd h_pd;
t_gobj *h_master;
t_glist *h_glist;
t_symbol *h_bindsym;
int h_scale;
char h_pathname[64];
......@@ -220,12 +221,12 @@ EXTERN void canvas_apply_setundo(t_canvas *x, t_gobj *y);
// scalehandle code, as refactored by Mathieu
EXTERN void scalehandle_bind(t_scalehandle *h);
EXTERN void scalehandle_draw_select(t_scalehandle *h, t_glist *canvas, int px, int py);
EXTERN void scalehandle_draw_select2(t_iemgui *x, t_glist *canvas);
EXTERN void scalehandle_draw_erase(t_scalehandle *h, t_glist *canvas);
EXTERN void scalehandle_draw_erase2(t_iemgui *x, t_glist *canvas);
EXTERN void scalehandle_draw(t_iemgui *x, t_glist *glist);
EXTERN t_scalehandle *scalehandle_new(t_class *c, t_iemgui *x, int scale);
EXTERN void scalehandle_draw_select(t_scalehandle *h, int px, int py);
EXTERN void scalehandle_draw_select2(t_iemgui *x);
EXTERN void scalehandle_draw_erase(t_scalehandle *h);
EXTERN void scalehandle_draw_erase2(t_iemgui *x);
EXTERN void scalehandle_draw(t_iemgui *x);
EXTERN t_scalehandle *scalehandle_new(t_class *c, t_gobj *x, t_glist *glist, int scale);
EXTERN void scalehandle_free(t_scalehandle *h);
EXTERN void properties_set_field_int(long props, const char *gui_field, int value);
EXTERN void scalehandle_dragon_label(t_scalehandle *h, float f1, float f2);
......@@ -242,18 +243,20 @@ EXTERN float minf(float a, float b);
EXTERN float maxf(float a, float b);
// other refactor by Mathieu
EXTERN void iemgui_tag_selected( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_new( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_move( t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_config(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_label_draw_select(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_io_draw_move(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_draw_io(t_iemgui *x, t_glist *glist, int old_sr_flags);
EXTERN void iemgui_base_draw_new(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_base_draw_move(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_base_draw_config(t_iemgui *x, t_glist *canvas);
EXTERN void iemgui_draw_new(t_iemgui *x, t_glist *glist);
EXTERN void iemgui_draw_erase(t_iemgui *x, t_glist* glist);
EXTERN void iemgui_tag_selected( t_iemgui *x);
EXTERN void iemgui_label_draw_new( t_iemgui *x);
EXTERN void iemgui_label_draw_move( t_iemgui *x);
EXTERN void iemgui_label_draw_config(t_iemgui *x);
EXTERN void iemgui_label_draw_select(t_iemgui *x);
EXTERN void iemgui_io_draw_move(t_iemgui *x);
EXTERN void iemgui_draw_io(t_iemgui *x, int old_sr_flags);
EXTERN void iemgui_base_draw_new(t_iemgui *x);
EXTERN void iemgui_base_draw_move(t_iemgui *x);
EXTERN void iemgui_base_draw_config(t_iemgui *x);
EXTERN void iemgui_draw_new(t_iemgui *x);
EXTERN void iemgui_draw_config(t_iemgui *x);
EXTERN void iemgui_draw_move(t_iemgui *x);
EXTERN void iemgui_draw_erase(t_iemgui *x);
EXTERN void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl); // rename this to iemgui_wb_init
extern t_symbol *s_empty;
......
......@@ -41,7 +41,7 @@ void bng_draw_new(t_bng *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
iemgui_base_draw_new(&x->x_gui, canvas);
iemgui_base_draw_new(&x->x_gui);
t_float cr = (x->x_gui.x_w-2)/2.0;
t_float cx = x1+cr+1.5;
t_float cy = y1+cr+1.5;
......@@ -59,22 +59,19 @@ void bng_draw_move(t_bng *x, t_glist *glist)
int x1=text_xpix(&x->x_gui.x_obj, glist);
int y1=text_ypix(&x->x_gui.x_obj, glist);
iemgui_base_draw_move(&x->x_gui, canvas);
iemgui_base_draw_move(&x->x_gui);
t_float cr = (x->x_gui.x_w-2)/2.0;
t_float cx = x1+cr+1.5;
t_float cy = y1+cr+1.5;
sys_vgui(".x%lx.c coords %lxBUT %f %f\n", canvas, x, cx, cy);
sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x -r %f\n",
canvas, x, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol, cr);
iemgui_label_draw_move(&x->x_gui,canvas);
iemgui_io_draw_move(&x->x_gui,canvas);
}
void bng_draw_config(t_bng* x, t_glist* glist)
{
t_canvas *canvas=glist_getcanvas(glist);
iemgui_label_draw_config(&x->x_gui,canvas);
iemgui_base_draw_config(&x->x_gui,canvas);
iemgui_base_draw_config(&x->x_gui);
sys_vgui(".x%lx.c itemconfigure %lxBUT -fill #%6.6x\n",
canvas, x, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol);
}
......@@ -243,10 +240,10 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv)
int ftbreak = atom_getintarg(3, argc, argv);
int sr_flags = iemgui_dialog(&x->x_gui, argc, argv);
bng_check_minmax(x, ftbreak, fthold);
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_CONFIG);
iemgui_draw_io(&x->x_gui, x->x_gui.x_glist, sr_flags);
iemgui_draw_config(&x->x_gui);
iemgui_draw_io(&x->x_gui, sr_flags);
iemgui_shouldvis(&x->x_gui, IEM_GUI_DRAW_MODE_MOVE);
scalehandle_draw(&x->x_gui, x->x_gui.x_glist);
scalehandle_draw(&x->x_gui);
scrollbar_update(x->x_gui.x_glist);
}
......@@ -371,8 +368,8 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x->x_clock_lck = clock_new(x, (t_method)bng_tick_lck);
outlet_new(&x->x_gui.x_obj, &s_bang);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
x->x_gui. x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,1);
x->x_gui.x_lhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x->x_gui.x_glist,0);
x->x_gui.x_obj.te_iemgui = 1;
x->x_gui.x_changed = 0;
......
......@@ -441,8 +441,8 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
pd_pushsym(&x->gl_pd);
//dpsaha@vt.edu gop resize (refactored by mathieu)
x-> x_handle = scalehandle_new(scalehandle_class,(t_iemgui *)x,1);
x->x_mhandle = scalehandle_new(scalehandle_class,(t_iemgui *)x,0);
x-> x_handle = scalehandle_new(scalehandle_class,(t_gobj *)x,x,1);
x->x_mhandle = scalehandle_new(scalehandle_class,(t_gobj *)x,x,0);
x->u_queue = canvas_undo_init(x);
return(x);
......@@ -711,18 +711,18 @@ void canvas_draw_gop_resize_hooks(t_canvas* x)
sprintf(sh->h_pathname, ".x%lx.h%lx", (t_int)x, (t_int)sh);
sprintf(mh->h_pathname, ".x%lx.h%lx", (t_int)x, (t_int)mh);
scalehandle_draw_select(sh,x,
scalehandle_draw_select(sh,
-1-x->gl_obj.te_xpix+x->gl_xmargin + x->gl_pixwidth,
-1-x->gl_obj.te_ypix+x->gl_ymargin + x->gl_pixheight/*,GOP_resblob*/);
scalehandle_draw_select(mh,x,
scalehandle_draw_select(mh,
2+SCALEHANDLE_WIDTH -x->gl_obj.te_xpix+x->gl_xmargin,
2+SCALEHANDLE_HEIGHT-x->gl_obj.te_ypix+x->gl_ymargin /*,"GOP_movblob"*/);
}
else
{
//fprintf(stderr,"draw_gop_resize_hooks ERASE\n");
scalehandle_draw_erase(sh,x);
scalehandle_draw_erase(mh,x);
scalehandle_draw_erase(sh);
scalehandle_draw_erase(mh);
}