diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c index fa74cbd52230974dc96983394568464c8a47c3f4..f097e70f0e9b7ed34a2c61c743e5c1947bf23b94 100644 --- a/pd/src/g_bang.c +++ b/pd/src/g_bang.c @@ -202,9 +202,6 @@ static void bng__motionhook(t_scalehandle *sh, x->x_gui.x_w = width; x->x_gui.x_h = height; - sh->h_offset_x = mouse_x; - sh->h_offset_y = mouse_y; - if (glist_isvisible(x->x_gui.x_glist)) { bng_draw_move(x, x->x_gui.x_glist); @@ -218,7 +215,7 @@ static void bng__motionhook(t_scalehandle *sh, properties_set_field_int(properties,"dim.w_ent",new_w); } } - scalehandle_dragon_label(sh,mouse_x,mouse_y); + scalehandle_dragon_label(sh,mouse_x - sh->h_offset_x, mouse_y - sh->h_offset_y); } void bng_draw(t_bng *x, t_glist *glist, int mode) diff --git a/pd/src/g_slider.c b/pd/src/g_slider.c index eb21a1d945e6bbe25fa05a7b8d4364fbc02768fa..442c6234a1f540ca435b862c86b003f6078612f4 100644 --- a/pd/src/g_slider.c +++ b/pd/src/g_slider.c @@ -150,7 +150,14 @@ static void vslider__clickhook2(t_scalehandle *sh, t_slider *x) { static void slider__clickhook(t_scalehandle *sh, int newstate) { - if (sh->h_dragon && newstate == 0 && sh->h_scale) + t_slider *x = (t_slider *)(sh->h_master); + if (newstate && sh->h_scale) + { + canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); + } + /* the rest is no longer used and can be trashed once all iemguis + are working */ + else if (sh->h_dragon && newstate == 0 && sh->h_scale) { t_slider *x = (t_slider *)(sh->h_master); canvas_apply_setundo(x->x_gui.x_glist, (t_gobj *)x); @@ -169,12 +176,13 @@ static void slider__clickhook(t_scalehandle *sh, int newstate) iemgui__clickhook3(sh,newstate); } -static void slider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2) +static void slider__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg mouse_y) { if (sh->h_dragon && sh->h_scale) { t_slider *x = (t_slider *)(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); int minx = x->x_orient ? IEM_GUI_MINSIZE : IEM_SL_MINSIZE; int miny = x->x_orient ? IEM_SL_MINSIZE : IEM_GUI_MINSIZE; @@ -184,6 +192,15 @@ static void slider__motionhook(t_scalehandle *sh, t_floatarg f1, t_floatarg f2) 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)) + { + slider_draw_move(x, x->x_gui.x_glist); + scalehandle_unclick_scale(sh); + } + int properties = gfxstub_haveproperties((void *)x); if (properties) { @@ -193,7 +210,8 @@ static void slider__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 slider_draw(t_slider *x, t_glist *glist, int mode) diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c index b63ed4edd1185d1c714e72ead20afdfb6d1d3663..c866c9a518430c1d93f5aa63d48459d4eed78e69 100644 --- a/pd/src/g_toggle.c +++ b/pd/src/g_toggle.c @@ -162,9 +162,6 @@ static void toggle__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg x->x_gui.x_w = width; x->x_gui.x_h = height; - sh->h_offset_x = mouse_x; - sh->h_offset_y = mouse_y; - if (glist_isvisible(x->x_gui.x_glist)) { toggle_draw_move(x, x->x_gui.x_glist); @@ -178,7 +175,7 @@ static void toggle__motionhook(t_scalehandle *sh, t_floatarg mouse_x, t_floatarg properties_set_field_int(properties,"dim.w_ent",new_w); } } - scalehandle_dragon_label(sh,mouse_x,mouse_y); + scalehandle_dragon_label(sh,mouse_x - sh->h_offset_x, mouse_y - sh->h_offset_y); }