diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c index f400da7f77d3329bee80d1748559794518b86cd5..f053f25be7de2f366cdf0d0521c4c87be942837b 100644 --- a/pd/src/g_vumeter.c +++ b/pd/src/g_vumeter.c @@ -314,7 +314,11 @@ static void vu_draw_select(t_vu* x,t_glist* glist) static void vu__clickhook(t_scalehandle *sh, int newstate) { t_vu *x = (t_vu *)(sh->h_master); - if (sh->h_dragon && newstate == 0 && sh->h_scale) + if (newstate && sh->h_scale) + { + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + } + else if (sh->h_dragon && newstate == 0 && sh->h_scale) { canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); if (sh->h_dragx || sh->h_dragy) @@ -335,18 +339,32 @@ static void vu__clickhook(t_scalehandle *sh, int newstate) iemgui__clickhook3(sh,newstate); } -static void vu__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2) +static void vu__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg mouse_y) { - if (sh->h_dragon && sh->h_scale) + if (sh->h_scale) { t_vu *x = (t_vu *)(sh->h_master); - int dx = (int)f1, dy = (int)f2; + int dx = (int)(mouse_x - sh->h_offset_x), + dy = (int)(mouse_y - sh->h_offset_y); dx = maxi(dx, 8-x->x_gui.x_w); - dy = maxi(dy,80-x->x_gui.x_h); + dy = maxi(dy,80-x->x_gui.x_h); sh->h_dragx = dx; sh->h_dragy = dy; scalehandle_drag_scale(sh); + x->x_gui.x_w += dx; + x->x_gui.x_h += dy; + + if (glist_isvisible(x->x_gui.x_glist)) + { + /* draw_move doesn't seem to cut it for vu, so we + just toggle visibility */ + //vu_draw_move(x, x->x_gui.x_glist); + gobj_vis((t_gobj *)x, x->x_gui.x_glist, 0); + gobj_vis((t_gobj *)x, x->x_gui.x_glist, 1); + scalehandle_unclick_scale(sh); + } + int properties = gfxstub_haveproperties((void *)x); if (properties) { @@ -356,7 +374,7 @@ static void vu__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2) properties_set_field_int(properties,"dim.h_ent",new_h); } } - scalehandle_dragon_label(sh,f1,f2); + scalehandle_dragon_label(sh,mouse_x - sh->h_offset_x, mouse_y - sh->h_offset_y); } void vu_draw(t_vu *x, t_glist *glist, int mode)