From 44227f1d5ba860790d193348647d9268c0f11f8a Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Sun, 17 Aug 2014 00:12:32 -0400 Subject: [PATCH] *fixed regressions in g_number (hopefully the last of them), and g_mycanvas *improved g_all_guis.c and detection/drawing of handles --- pd/src/g_all_guis.c | 13 ++++++++++++- pd/src/g_mycanvas.c | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c index 2434360ca..e24577169 100644 --- a/pd/src/g_all_guis.c +++ b/pd/src/g_all_guis.c @@ -27,6 +27,7 @@ int iemgui_color_hex[] = { int iemgui_clip_size(int size) {return maxi(size,IEM_GUI_MINSIZE);} int iemgui_clip_font(int size) {return maxi(size,IEM_FONT_MINSIZE);} +static void scalehandle_check_and_redraw(t_iemgui *x); static int iemgui_modulo_color(int col) { @@ -425,6 +426,7 @@ void iemgui_shouldvis(t_iemgui *x, int mode) } //fprintf(stderr,"draw move x->x_w=%d\n", x->x_w); x->x_draw(x, x->x_glist, mode); + scalehandle_check_and_redraw(x); canvas_fixlinesfor(glist_getcanvas(x->x_glist), (t_text*)x); } else if (x->x_vis) @@ -862,6 +864,15 @@ void iemgui__clickhook3(t_scalehandle *sh, int newstate) { sh->h_dragon = newstate; } +// function for updating of handles on iemgui objects +// we don't need glist_getcanvas() because handles are only +// drawn when object is selected on its canvas (instead of GOP) +static void scalehandle_check_and_redraw(t_iemgui *x) +{ + if(x->x_selected == x->x_glist) + scalehandle_draw_select2(x,x->x_glist); +} + //---------------------------------------------------------------- // IEMGUI refactor (by Mathieu) @@ -900,7 +911,7 @@ void iemgui_label_draw_config(t_iemgui *x, t_glist *canvas) { "-fill #%6.6x -text {%s} \n", canvas, x, iemgui_font(x), x->x_lcol, x->x_lab!=s_empty?x->x_lab->s_name:""); - if (x->x_selected) + if (x->x_selected == canvas && x->x_glist == canvas) { t_scalehandle *lh = (t_scalehandle *)(x->x_lhandle); if (x->x_lab==s_empty) diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c index fdce53864..ceb7542c0 100644 --- a/pd/src/g_mycanvas.c +++ b/pd/src/g_mycanvas.c @@ -207,9 +207,9 @@ static void my_canvas_get_pos(t_my_canvas *x) static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv) { - printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); + //printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); - printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); + //printf("cnv_dialog: selected=%d\n",x->x_gui.x_selected); x->x_gui.x_h = x->x_gui.x_w = maxi(atom_getintarg(0, argc, argv),1); x->x_vis_w = maxi(atom_getintarg(2, argc, argv),1); -- GitLab