static void image_imagesize_callback(t_image *x, t_float w, t_float h) { //fprintf(stderr,"received w %f h %f should %d spill %d\n", w, h, gobj_shouldvis((t_gobj *)x, glist_getcanvas(x->x_glist)), x->x_gop_spill); x->x_img_width = w; x->x_img_height = h; if (x->x_img_width + x->x_img_height == 0) { //invalid image if (strcmp("@pd_extra/ggee/empty_image.png", x->x_fname->s_name) != 0) { x->x_fname = gensym("@pd_extra/ggee/empty_image.png"); image_doopen(x); return; } } if (!gobj_shouldvis((t_gobj *)x, x->x_glist) && !x->x_gop_spill) { //fprintf(stderr,"erasing\n"); image_erase(x, glist_getcanvas(x->x_glist)); } else { //sys_vgui("catch {.x%lx.c delete %xMT}\n", glist_getcanvas(x->x_glist), x); // reselect if we are on a toplevel canvas to adjust the selection rectangle, if necessary if (glist_isselected(x->x_glist, (t_gobj *)x) && glist_getcanvas(x->x_glist) == x->x_glist) { image_select((t_gobj *)x, glist_getcanvas(x->x_glist), 0); image_select((t_gobj *)x, glist_getcanvas(x->x_glist), 1); } canvas_fixlinesfor(x->x_glist,(t_text*) x); } }
t_canvas *glist_getcanvas(t_glist *x) { while (x->gl_owner && !x->gl_havewindow && x->gl_isgraph && gobj_shouldvis(&x->gl_gobj, x->gl_owner)) x = x->gl_owner; return((t_canvas *)x); }
void iemgui_vis(t_gobj *z, t_glist *glist, int vis) { t_iemgui *x = (t_iemgui *)z; if (gobj_shouldvis(z, glist)) { if (vis) iemgui_draw_new(x); else { iemgui_draw_erase(x); sys_unqueuegui(z); } x->x_vis = vis; } }
static void odisplay_select(t_gobj *z, t_glist *glist, int state) { //post("%s %d", __func__, state); t_odisplay *x = (t_odisplay *)z; t_canvas *canvas = glist_getcanvas(glist); opd_textbox_select(x->textbox, glist, state); if (glist_isvisible(glist) && gobj_shouldvis(&x->ob.te_g, glist)){ sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->tk_tag, (state? "#006699" : "#0066CC")); // sys_vgui(".x%lx.c itemconfigure %s -outline %s\n", canvas, x->corner_tag, (state? "#006699" : "#0066CC")); sys_vgui(".x%lx.c itemconfigure %sUPDATE -fill %s\n", canvas, x->tk_tag, (x->draw_new_data_indicator? (state? "#006699" : "#0066CC") : x->background_color->hex)); } }
void iemgui_shouldvis(t_iemgui *x, int mode) { gop_redraw = 1; if(gobj_shouldvis((t_gobj *)x, x->x_glist)) { if (!x->x_vis) { //fprintf(stderr,"draw new %d\n", mode); 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)) { /* if we are inside gop and just have had our object's properties changed we'll adjust our layer position to ensure that ordering is honored */ t_canvas *canvas = glist_getcanvas(x->x_glist); t_gobj *y = (t_gobj *)x->x_glist; gobj_vis(y, canvas, 0); gobj_vis(y, canvas, 1); // reorder it visually glist_redraw(canvas); } } //fprintf(stderr,"draw move x->x_w=%d\n", x->x_w); 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_vis = 0; } gop_redraw = 0; }