Commit 6c7e163a authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

slider scalehandle in operation

parent 3b7a8e0e
......@@ -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)
......
......@@ -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)
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment