Commit 3d2da186 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

transitional state-- adding focusfn callback, deconstructing numbox UX,

and getting ready to handle [nbx] runmode key entry entirely in the GUI
parent e697e70d
......@@ -1496,7 +1496,8 @@ void scrollbar_synchronous_update(t_glist *glist)
"x", glist_getcanvas(glist));
}
void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl)
void iemgui_wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl,
t_focusfn f)
{
wb->w_getrectfn = gr;
wb->w_displacefn = iemgui_displace;
......@@ -1506,6 +1507,7 @@ void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl)
wb->w_visfn = iemgui_vis;
wb->w_clickfn = cl;
wb->w_displacefnwtag = iemgui_displace_withtag;
wb->w_focusfn = f;
}
const char *iemgui_typeface(t_iemgui *x)
......
......@@ -179,7 +179,6 @@ typedef struct _vu
typedef struct _my_numbox
{
t_iemgui x_gui;
t_clock *x_clock_reset;
t_clock *x_clock_wait;
double x_val;
double x_min;
......@@ -194,7 +193,7 @@ typedef struct _my_numbox
int x_tmpfontsize; /* temporary value for scalehandle */
int x_num_fontsize;/* font size for the number only that should
automatically adjust to the box size */
int x_focused; /* helps us determine when and how we are editing value
int x_focused; /* helps us determine when user is editing value
0 no focus, 1 keyboard focus, 2 mouse focus */
int x_log_height;
int x_drawstyle; /* 0 default, 1 just frame, 2, just arrow, 3 number only */
......@@ -277,7 +276,8 @@ EXTERN void iemgui_draw_new(t_iemgui *x);
EXTERN void iemgui_draw_config(t_iemgui *x);
EXTERN void iemgui_draw_move(t_iemgui *x);
EXTERN void iemgui_draw_erase(t_iemgui *x);
EXTERN void wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl); // rename this to iemgui_wb_init
EXTERN void iemgui_wb_init(t_widgetbehavior *wb, t_getrectfn gr, t_clickfn cl,
t_focusfn f); // rename this to iemgui_wb_init
extern t_symbol *s_empty;
EXTERN const char *selection_color;
......
......@@ -382,6 +382,11 @@ static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix,
return (1);
}
static void bng_focus(t_gobj *z, struct _glist *glist, int state)
{
/* not yet */
}
static void bng_float(t_bng *x, t_floatarg f) {bng_bang2(x);}
static void bng_symbol(t_bng *x, t_symbol *s) {bng_bang2(x);}
static void bng_pointer(t_bng *x, t_gpointer *gp) {bng_bang2(x);}
......@@ -534,7 +539,7 @@ void g_bang_setup(void)
A_GIMME, 0);
class_addmethod(bng_class, (t_method)iemgui_init, gensym("init"), A_FLOAT, 0);
wb_init(&bng_widgetbehavior,bng_getrect,bng_newclick);
iemgui_wb_init(&bng_widgetbehavior, bng_getrect, bng_newclick, bng_focus);
class_setwidget(bng_class, &bng_widgetbehavior);
class_sethelpsymbol(bng_class, gensym("bng"));
class_setsavefn(bng_class, bng_save);
......
......@@ -359,7 +359,11 @@ typedef void (*t_getrectfn)(t_gobj *x, struct _glist *glist,
typedef void (*t_displacefn)(t_gobj *x, struct _glist *glist, int dx, int dy);
/* change color to show selection: */
typedef void (*t_selectfn)(t_gobj *x, struct _glist *glist, int state);
/* change appearance to show activation/deactivation: */
/* change appearance to show activation/deactivation. For example,
default widget behavior is to be able to edit the box text when
a gobj is activated. Another example: iemguis set this callback
to NULL-- this means you can't activate an iemgui when clicking
in editmode. */
typedef void (*t_activatefn)(t_gobj *x, struct _glist *glist, int state);
/* warn a gobj it's about to be deleted */
typedef void (*t_deletefn)(t_gobj *x, struct _glist *glist);
......@@ -370,6 +374,8 @@ typedef int (*t_clickfn)(t_gobj *x, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit);
/* and this to displace a gobj using tags: */
typedef void (*t_displacefnwtag)(t_gobj *x, struct _glist *glist, int dx, int dy);
/* grab mouse/keyboard focus in runmode */
typedef void (*t_focusfn)(t_gobj *x, struct _glist *glist, int state);
/* ... and later, resizing; getting/setting font or color... */
struct _widgetbehavior
......@@ -382,6 +388,7 @@ struct _widgetbehavior
t_visfn w_visfn;
t_clickfn w_clickfn;
t_displacefnwtag w_displacefnwtag;
t_focusfn w_focusfn;
};
/* -------- behaviors for scalars defined by objects in template --------- */
......@@ -488,6 +495,12 @@ EXTERN void glist_retext(t_glist *x, t_text *y);
EXTERN void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn,
t_glistkeyfn keyfn, t_glistkeynameafn keynameafn,
int xpos, int ypos);
/* grab keyfn from glist without changing the motionfn callback */
EXTERN void glist_grab_key(t_glist *x, t_gobj *y, t_glistkeyfn keyfn,
t_glistkeynameafn keynameafn);
/* similarly, grab mouse without changing the glist's keyfn callback */
EXTERN void glist_grab_mouse(t_glist *x, t_gobj *y, t_glistmotionfn motionfn,
int xpos, int ypos);
EXTERN int glist_isvisible(t_glist *x);
EXTERN int glist_istoplevel(t_glist *x);
EXTERN t_glist *glist_findgraph(t_glist *x);
......
......@@ -307,6 +307,12 @@ int gobj_click(t_gobj *x, struct _glist *glist,
else return (0);
}
void gobj_focus(t_gobj *x, struct _glist *glist, int state)
{
if (x->g_pd->c_wb && x->g_pd->c_wb->w_focusfn)
(*x->g_pd->c_wb->w_focusfn)(x, glist, state);
}
/* ------------------------ managing the selection ----------------- */
// direction -1 = lower, 1 = raise
......@@ -3686,10 +3692,18 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which,
canvas_undo_already_set_move = 0;
// if keyboard was grabbed, notify grabber and cancel the grab
if (doit && x->gl_editor->e_grab && x->gl_editor->e_keyfn)
{
(* x->gl_editor->e_keyfn) (x->gl_editor->e_grab, 0);
/* For reasons unclear to me, Pd Vanilla sends a sentinel value
"0" to the keyfn of an object to signal it has lost focus. */
(*x->gl_editor->e_keyfn) (x->gl_editor->e_grab, 0);
/* Going forward, let's use the much cleaner, self-documenting
interface of calling the object's focusfn with state = 0.
We're assuming that all classes which have a focusfn
also set a keyfn; all current gobjs that use glist_grab do this.
But if that changes we'll need to decouple the following call
from this conditional. */
gobj_focus(x->gl_editor->e_grab, x, 0);
glist_grab(x, 0, 0, 0, 0, 0, 0);
}
......@@ -5365,6 +5379,17 @@ void canvas_mouseup(t_canvas *x,
if (canvas_last_glist_mod == -1)
canvas_doclick(x, xpos, ypos, 0,
(glob_shift + glob_ctrl*2 + glob_alt*4), 0);
/* if an object has grabbed focus, go ahead and call the clickfn for the
mouseup event.
For now (and for compatibility) we abuse the "dbl" parameter which
apparently isn't used by anything. Later figure out how to make this
look like a half-decent event callback interface without breaking
everything */
if (x->gl_editor->e_grab)
gobj_click(x->gl_editor->e_grab, x, xpos, ypos, glob_shift, glob_alt,
1, 0);
// now dispatch to any click listeners
canvas_dispatch_mouseclick(0., xpos, ypos, which);
}
......@@ -5633,15 +5658,15 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av)
if (x->gl_editor->e_grab)
{
if (x->gl_editor->e_keyfn && keynum && focus)
(* x->gl_editor->e_keyfn)
(*x->gl_editor->e_keyfn)
(x->gl_editor->e_grab, (t_float)keynum);
if (x->gl_editor->e_keynameafn && gotkeysym && focus)
{
at[0] = av[0];
SETFLOAT(at, down);
SETSYMBOL(at+1, gotkeysym);
(* x->gl_editor->e_keynameafn) (x->gl_editor->e_grab, 0, 2, at);
}
if (x->gl_editor->e_keynameafn && gotkeysym && focus)
{
at[0] = av[0];
SETFLOAT(at, down);
SETSYMBOL(at+1, gotkeysym);
(*x->gl_editor->e_keynameafn)(x->gl_editor->e_grab, 0, 2, at);
}
}
/* if a text editor is open send the key on, as long as
it is either "real" (has a key number) or else is an arrow key. */
......@@ -8464,8 +8489,38 @@ static void canvas_buftotext(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
binbuf_clear(newobjbuf);
}
/* just a single global... we'll put this in glist later */
glist_last_focused_gobj;
static void canvas_focusobj(t_canvas *x)
{
t_gobj *y;
/* let's just start with a single time through the thingy */
if (glist_last_focused_gobj)
{
y = glist_last_focused_gobj;
gobj_focus(y, x, 0);
y = y->g_next;
}
else
{
y = x->gl_list;
}
for (; y; y = y->g_next)
{
/* just make focusfn return int so we can know if it got the focus */
if (y->g_pd->c_wb && y->g_pd->c_wb->w_focusfn)
{
gobj_focus(y, x, 1);
glist_last_focused_gobj = y;
break;
}
}
}
void g_editor_setup(void)
{
/* ------------------------ events ---------------------------------- */
class_addmethod(canvas_class, (t_method)canvas_mousedown, gensym("mouse"),
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
......@@ -8493,6 +8548,8 @@ void g_editor_setup(void)
gensym("obj_addtobuf"), A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_buftotext,
gensym("obj_buftotext"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_focusobj,
gensym("focus"), A_NULL);
/* ------------------------ menu actions ---------------------------- */
class_addmethod(canvas_class, (t_method)canvas_menuclose,
gensym("menuclose"), A_DEFFLOAT, 0);
......
......@@ -372,6 +372,7 @@ void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, t_glistkeyfn ke
t_glistkeynameafn keynameafn, int xpos, int ypos)
{
//fprintf(stderr,"glist_grab\n");
t_glist *x2 = glist_getcanvas(x);
if (motionfn)
x2->gl_editor->e_onmotion = MA_PASSOUT;
......@@ -384,6 +385,23 @@ void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, t_glistkeyfn ke
x2->gl_editor->e_ywas = ypos;
}
/* separate key and mouse calls for convenience with focusfn */
void glist_grab_key(t_glist *x, t_gobj *y, t_glistkeyfn keyfn,
t_glistkeynameafn keynameafn)
{
t_glist *x2 = glist_getcanvas(x);
glist_grab(x, y, x2->gl_editor->e_motionfn, keyfn, keynameafn, 0, 0);
}
void glist_grab_mouse(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, int xpos,
int ypos)
{
t_glist *x2 = glist_getcanvas(x);
glist_grab(x, y, motionfn, x2->gl_editor->e_keyfn,
x2->gl_editor->e_keynameafn, xpos, ypos);
}
t_canvas *glist_getcanvas(t_glist *x)
{
//fprintf(stderr,"glist_getcanvas\n");
......@@ -1770,6 +1788,7 @@ t_widgetbehavior graph_widgetbehavior =
graph_vis,
graph_click,
graph_displace_withtag,
NULL
};
/* find the graph most recently added to this glist;
......
......@@ -381,7 +381,7 @@ void g_mycanvas_setup(void)
class_addmethod(my_canvas_class, (t_method)my_canvas_get_pos,
gensym("get_pos"), 0);
wb_init(&my_canvas_widgetbehavior,my_canvas_getrect,0);
iemgui_wb_init(&my_canvas_widgetbehavior, my_canvas_getrect, 0, NULL);
class_setwidget(my_canvas_class, &my_canvas_widgetbehavior);
class_sethelpsymbol(my_canvas_class, gensym("my_canvas"));
class_setsavefn(my_canvas_class, my_canvas_save);
......
......@@ -39,7 +39,7 @@ static void my_numbox_tick_reset(t_my_numbox *x)
if(x->x_gui.x_change && x->x_gui.x_glist)
{
//post(" success\n");
my_numbox_set_change(x, 0);
x->x_gui.x_change = 0;
my_numbox_ftoa(x, 0);
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
......@@ -53,18 +53,19 @@ static void my_numbox_tick_wait(t_my_numbox *x)
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
/* this can be removed... */
// to enable ability to change values using arrow keys (only when focused)
static void my_numbox_set_change(t_my_numbox *x, t_floatarg f)
{
if (f == 0 && x->x_gui.x_change != 0)
{
x->x_gui.x_change = 0;
pd_unbind(&x->x_gui.x_obj.ob_pd, numbox_keyname_sym_a);
// pd_unbind(&x->x_gui.x_obj.ob_pd, numbox_keyname_sym_a);
}
else if (f == 1 && x->x_gui.x_change != 1)
{
x->x_gui.x_change = 1;
pd_bind(&x->x_gui.x_obj.ob_pd, numbox_keyname_sym_a);
// pd_bind(&x->x_gui.x_obj.ob_pd, numbox_keyname_sym_a);
}
}
......@@ -153,6 +154,13 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist)
{
t_my_numbox *x = (t_my_numbox *)client;
/* the following comment and related changes to this function body are pure
spaghetti.
For now we route around this spaghetti by simply calling a single
GUI method to set the focus style. Later, this should be inspected
and cleaned up so that it's readable/reasonable again. */
// we cannot ignore this call even if there is no change
// since that will mess up number highlighting while editing
// the code is left here as it is similar to other iemguis
......@@ -161,53 +169,53 @@ static void my_numbox_draw_update(t_gobj *client, t_glist *glist)
x->x_gui.x_changed = 0;
if (!glist_isvisible(glist)) return;
if(x->x_gui.x_change && x->x_buf[0])
if (x->x_buf[0])
{
//post("draw_update 1 : focused=%d", x->x_focused);
char *cp=x->x_buf;
char *cp = x->x_buf;
int sl = strlen(x->x_buf);
if (x->x_focused == 1)
{
x->x_buf[sl] = '>';
x->x_buf[sl+1] = 0;
} else if (x->x_focused == 2) {
// if (x->x_focused == 1)
// {
// x->x_buf[sl] = '>';
// x->x_buf[sl+1] = 0;
// }
// else if (x->x_focused == 2)
// {
// this is triggered when one presses return while retaining the focus of the number
// so, we make sure to subtract the '>' that has disappeared and adjust visible digits
// accordingly below
x->x_buf[sl] = 0;
sl--;
}
if(sl >= x->x_gui.x_w)
// sl--;
// }
if (sl >= x->x_gui.x_w)
cp += sl - x->x_gui.x_w + 1;
gui_vmess("gui_text_set_mynumbox", "xxsi",
gui_vmess("gui_text_set", "xxs",
glist_getcanvas(glist),
x,
cp,
1);
cp);
// here we check that we are not in the focused mode 2 that has this already taken care of above
if (x->x_focused != 2)
x->x_buf[sl] = 0;
// if (x->x_focused != 2)
// x->x_buf[sl] = 0;
}
else
{
//if (!x->x_focused || x->x_focused == 2)
//post("draw_update 2: x->x_buf=<%s> focused=%d change=%d", x->x_buf, x->x_focused, x->x_gui.x_change);
if (!x->x_buf[0] && x->x_focused == 1 && x->x_gui.x_change == 1)
{
x->x_buf[0] = '>';
x->x_buf[1] = 0;
}
else
{
//if (!x->x_buf[0])
//{
// x->x_buf[0] = '0';
// x->x_buf[1] = 0;
//}
//else
//{
/* side effect-- set x->x_buf to the computed value... */
my_numbox_ftoa(x, 0); /* mmm... side-effects */
}
gui_vmess("gui_text_set_mynumbox", "xxsi",
//}
gui_vmess("gui_text_set", "xxs",
glist_getcanvas(glist),
x,
x->x_buf,
x->x_gui.x_selected == glist_getcanvas(glist) &&
!x->x_gui.x_change && x->x_gui.x_glist == glist_getcanvas(glist) ?
2 : (x->x_gui.x_change ? 1 : 0));
x->x_buf);
/* ... thus we have to clean up the buf for future key callbacks */
x->x_buf[0] = 0; /* mmm... more side-effects... no clue why we'd need
to mutate a struct member in order to draw stuff */
}
......@@ -300,8 +308,8 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist)
int issel = x->x_gui.x_selected == canvas && x->x_gui.x_glist == canvas;
if(x->x_gui.x_selected && x->x_gui.x_change)
{
my_numbox_set_change(x, 0);
clock_unset(x->x_clock_reset);
x->x_gui.x_change = 0;
// clock_unset(x->x_clock_reset);
x->x_buf[0] = 0;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
......@@ -451,8 +459,8 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b)
iemgui_save(&x->x_gui, srl, bflcol);
if(x->x_gui.x_change)
{
my_numbox_set_change(x, 0);
clock_unset(x->x_clock_reset);
x->x_gui.x_change = 0;
// clock_unset(x->x_clock_reset);
x->x_gui.x_changed = 1;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
......@@ -514,8 +522,8 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner)
iemgui_properties(&x->x_gui, srl);
if(x->x_gui.x_change)
{
my_numbox_set_change(x, 0);
clock_unset(x->x_clock_reset);
x->x_gui.x_change = 0;
// clock_unset(x->x_clock_reset);
x->x_gui.x_changed = 1;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
......@@ -599,6 +607,7 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc,
static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy)
{
fprintf(stderr, "motion...\n");
x->x_focused = 2;
double k2=1.0;
int old = x->x_val;
......@@ -617,37 +626,78 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy)
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
my_numbox_bang(x);
}
clock_unset(x->x_clock_reset);
clock_delay(x->x_clock_reset, 3000);
// clock_unset(x->x_clock_reset);
// clock_delay(x->x_clock_reset, 3000);
}
/* Still unsure where this gets used */
static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
{
glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
(t_glistmotionfn)my_numbox_motion, my_numbox_key, my_numbox_list, xpos, ypos);
(t_glistmotionfn)my_numbox_motion, my_numbox_key, my_numbox_list,
xpos, ypos);
}
static void my_numbox_draw_focus(t_my_numbox *x, int state)
{
gui_vmess("gui_numbox_focus", "xxi", x->x_gui.x_glist, x, state);
}
static void my_numbox_focus(t_gobj *z, struct _glist *glist, int state)
{
fprintf(stderr, "we got focus!\n");
if (state)
{
/* set our own glist_grab with only the key callback. focus on click
is handled separately below since it needs to also set a motion
callback */
/* grab keyfn from glist without changing the motionfn callback */
glist_grab_key(glist, z, my_numbox_key, my_numbox_list);
// x->x_gui.x_change = 1;
//
}
else
{
/* if we're losing keyboard focus lose mouse focus, too */
glist_grab(glist, 0, 0, 0, 0, 0, 0);
}
/* now set the gui focus */
t_my_numbox* x = (t_my_numbox *)z;
my_numbox_draw_focus(x, state);
}
static int my_numbox_newclick(t_gobj *z, struct _glist *glist,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
t_my_numbox* x = (t_my_numbox *)z;
if(doit)
fprintf(stderr, "x_change is %d\n", x->x_gui.x_change);
int mouse_up = dbl;
if (doit)
{
//printf("newclick doit\n");
my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix,
(t_floatarg)shift, 0, (t_floatarg)alt);
if(shift)
/* grab mouse without changing the glist's keyfn callback */
glist_grab_mouse(glist, z, (t_glistmotionfn)my_numbox_motion,
(t_floatarg)xpix, (t_floatarg)ypix);
/* grab the focus */
my_numbox_focus(z, glist, 1);
if (shift)
{
x->x_gui.x_finemoved = 1;
}
else
x->x_gui.x_finemoved = 0;
if(!x->x_gui.x_change)
{
clock_delay(x->x_clock_wait, 50);
my_numbox_set_change(x, 1);
clock_delay(x->x_clock_reset, 3000);
// if (!x->x_gui.x_change)
// {
/* unrolled callback hell:
x->x_clock_wait ->
my_numbox_tick_wait ->
my_numbox_draw_update
*/
// clock_delay(x->x_clock_wait, 50);
x->x_gui.x_change = 1;
// clock_delay(x->x_clock_reset, 3000);
if (shift)
my_numbox_ftoa(x, 1);
......@@ -655,15 +705,15 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist,
x->x_buf[0] = 0;
x->x_focused = 2;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
else
{
my_numbox_set_change(x, 0);
clock_unset(x->x_clock_reset);
x->x_buf[0] = 0;
x->x_gui.x_changed = 1;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
}
// }
// else
// {
// x->x_gui.x_change = 0;
// clock_unset(x->x_clock_reset);
// x->x_buf[0] = 0;
// x->x_gui.x_changed = 1;
// sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
// }
}
else
{
......@@ -769,6 +819,7 @@ static void my_numbox_loadbang(t_my_numbox *x, t_floatarg action)
static void my_numbox_key(void *z, t_floatarg fkey)
{
fprintf(stderr, "got it. key is %g\n", fkey);
t_my_numbox *x = z;
if (fkey != 0)
x->x_focused = 1;
......@@ -776,10 +827,10 @@ static void my_numbox_key(void *z, t_floatarg fkey)
// this is used for arrow up and down
if (fkey == -1)
{
clock_unset(x->x_clock_reset);
// clock_unset(x->x_clock_reset);
x->x_gui.x_changed = 1;
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
clock_delay(x->x_clock_reset, 3000);
// clock_delay(x->x_clock_reset, 3000);
return;
}
......@@ -791,10 +842,9 @@ static void my_numbox_key(void *z, t_floatarg fkey)
// and therefore loses focus
if (c == 0)
{
my_numbox_set_change(x, 0);
clock_unset(x->x_clock_reset);
// clock_unset(x->x_clock_reset);
x->x_gui.x_changed = 1;
clock_delay(x->x_clock_reset, 0);
// clock_delay(x->x_clock_reset, 0);
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
return;
}
......@@ -817,6 +867,7 @@ static void my_numbox_key(void *z, t_floatarg fkey)
else
sl=strlen(x->x_buf)-1;
fprintf(stderr, "strlen of x_buf is %d\n", sl);
if(sl < 0)
sl = 0;
x->x_buf[sl] = 0;
......@@ -826,9 +877,10 @@ static void my_numbox_key(void *z, t_floatarg fkey)
else if((c=='\n')||(c==13))
{
x->x_val = atof(x->x_buf);
//x->x_buf[0] = 0;
my_numbox_set_change(x, 1);
clock_unset(x->x_clock_reset);
fprintf(stderr, "atof'ing the value... it is %g\n", x->x_val);
x->x_buf[0] = 0;
x->x_gui.x_change = 1;
// clock_unset(x->x_clock_reset);
my_numbox_clip(x);