diff --git a/src/g_editor.c b/src/g_editor.c index 3a20edf828f1da710d7694933b92e5919f9315d6..459fafc057afa40b91d4d14de292802f37701e80 100644 --- a/src/g_editor.c +++ b/src/g_editor.c @@ -2285,9 +2285,11 @@ void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy) { int x1, y1, x2, y2; gobj_getrect(y, x, &x1, &y1, &x2, &y2); - if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2 - && !glist_isselected(x, y)) - glist_select(x, y); + if (hix >= x1 && lox <= x2 && hiy >= y1 && loy <= y2) { + if (!glist_isselected(x, y)) + glist_select(x, y); + else glist_deselect(x, y); + } } } @@ -2734,6 +2736,15 @@ void glob_verifyquit(void *dummy, t_floatarg f) /* close a window (or possibly quit Pd), checking for dirty flags. The "force" parameter is interpreted as follows: + + FOR INTERNAL USE (using it explicitly via pd messages induces + a crash because pd_free is called before the previous function + has run its course and thus you end up with hard-to-trace crash) + -1 - request from GUI to close, no verification + (after it returns back from tcl/tk side of things to avoid + freeing before the last method has run its course) + + OFFICIAL USE 0 - request from GUI to close, verifying whether clean or dirty 1 - request from GUI to close, no verification 2 - verified - mark this one clean, then continue as in 1 @@ -2743,7 +2754,9 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce) { int force = fforce; t_glist *g; - if (x->gl_owner && (force == 0 || force == 1)) + if (force == -1) + pd_free(&x->gl_pd); + else if (x->gl_owner && (force == 0 || force == 1)) canvas_vis(x, 0); /* if subpatch, just invis it */ else if (force == 0) { @@ -2776,10 +2789,12 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce) canvas_getrootfor(x), canvas_getrootfor(x)->gl_name->s_name, x); } */ - else pd_free(&x->gl_pd); + else //pd_free(&x->gl_pd); + sys_vgui("pd {.x%lx menuclose -1;}\n", x); } else if (force == 1) - pd_free(&x->gl_pd); + //pd_free(&x->gl_pd); + sys_vgui("pd {.x%lx menuclose -1;}\n", x); else if (force == 2) { canvas_dirty(x, 0); @@ -2801,7 +2816,8 @@ void canvas_menuclose(t_canvas *x, t_floatarg fforce) // canvas_getrootfor(x), g); return; } - else pd_free(&x->gl_pd); + else //pd_free(&x->gl_pd); + sys_vgui("pd {.x%lx menuclose -1;}\n", x); } else if (force == 3) { diff --git a/src/m_pd.h b/src/m_pd.h index 0a757659a957b6ab9d60d1aa6d1e42a9902a997f..ba0173cb7d04a6be8e19c6a4ed891d82575556be 100644 --- a/src/m_pd.h +++ b/src/m_pd.h @@ -11,7 +11,7 @@ extern "C" { #define PD_MAJOR_VERSION 0 #define PD_MINOR_VERSION 42 #define PD_BUGFIX_VERSION 5 -#define PD_TEST_VERSION "extended-l2ork-20110301" +#define PD_TEST_VERSION "extended-l2ork-20110303" /* old name for "MSW" flag -- we have to take it for the sake of many old "nmakefiles" for externs, which will define NT and not MSW */ diff --git a/src/x_connective.c b/src/x_connective.c index e7c5c7912df9bebdccab3180199f0d01da738f4b..c5063c194cd128861f9a4ff3ac53cbd39bee978e 100644 --- a/src/x_connective.c +++ b/src/x_connective.c @@ -931,9 +931,14 @@ static t_class *trigger_class; #define TR_LIST 4 #define TR_ANYTHING 5 +#define TR_STATIC_FLOAT 6 +#define TR_STATIC_SYMBOL 7 + typedef struct triggerout { int u_type; /* outlet type from above */ + t_symbol u_sym; /* static value */ + t_float u_float; /* static value */ t_outlet *u_outlet; } t_triggerout; @@ -963,8 +968,13 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv) { t_atomtype thistype = ap->a_type; char c; - if (thistype == TR_SYMBOL) c = ap->a_w.w_symbol->s_name[0]; - else if (thistype == TR_FLOAT) c = 'f'; + if (thistype == TR_SYMBOL) { + if (strlen(ap->a_w.w_symbol->s_name) == 1) + c = ap->a_w.w_symbol->s_name[0]; + else c = 'S'; + } + else if (thistype == TR_FLOAT) + c = 'F'; else c = 0; if (c == 'p') u->u_type = TR_POINTER, @@ -981,8 +991,18 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv) else if (c == 'a') u->u_type = TR_ANYTHING, u->u_outlet = outlet_new(&x->x_obj, &s_symbol); - else - { + else if (c == 'F') { + //static float + u->u_float = ap->a_w.w_float; + u->u_type = TR_STATIC_FLOAT; + u->u_outlet = outlet_new(&x->x_obj, &s_float); + } + else if (c == 'S') { + //static symbol + u->u_sym = *ap->a_w.w_symbol; + u->u_type = TR_STATIC_SYMBOL; + u->u_outlet = outlet_new(&x->x_obj, &s_symbol); + } else { pd_error(x, "trigger: %s: bad type", ap->a_w.w_symbol->s_name); u->u_type = TR_FLOAT, u->u_outlet = outlet_new(&x->x_obj, &s_float); } @@ -1009,6 +1029,14 @@ static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) pd_error(x, "unpack: bad pointer"); else outlet_pointer(u->u_outlet, argv->a_w.w_gpointer); } + else if (u->u_type == TR_STATIC_FLOAT) + { + outlet_float(u->u_outlet, u->u_float); + } + else if (u->u_type == TR_STATIC_SYMBOL) + { + outlet_symbol(u->u_outlet, &u->u_sym); + } else outlet_list(u->u_outlet, &s_list, argc, argv); } }