Commit bc0d70c7 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

Merge branch 'aggraef/purr-data-release_2.15.0'

parents c4495143 daf883f9
Pipeline #2948 failed with stage
in 209 minutes and 13 seconds
......@@ -103,6 +103,7 @@ void canvas_saved(t_glist *x, t_symbol *s, int argc, t_atom *argv)
}
void canvas_savedeclarationsto(t_canvas *x, t_binbuf *b);
void canvas_saveabdefinitionsto(t_canvas *x, t_binbuf *b);
/* the following routines read "scalars" from a file into a canvas. */
......@@ -830,6 +831,9 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
}
canvas_savedeclarationsto(x, b);
}
canvas_saveabdefinitionsto(x, b);
for (y = x->gl_list; y; y = y->g_next)
gobj_save(y, b);
......@@ -976,26 +980,55 @@ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir,
binbuf_free(b);
}
void canvas_reload_ab(t_canvas *x);
/* updates the shared ab definition and reloads all instances */
static void canvas_save_ab(t_canvas *x, t_floatarg fdestroy)
{
if(!x->gl_absource) bug("canvas_save_ab");
t_binbuf *b = binbuf_new();
canvas_savetemplatesto(x, b, 1);
canvas_saveto(x, b);
binbuf_free(x->gl_absource->ad_source);
x->gl_absource->ad_source = b;
canvas_dirty(x, 0);
canvas_reload_ab(x);
if (fdestroy != 0) //necessary?
vmess(&x->gl_pd, gensym("menuclose"), "f", 1.);
}
static void canvas_menusaveas(t_canvas *x, t_floatarg fdestroy)
{
t_canvas *x2 = canvas_getrootfor(x);
if(!x->gl_isab)
gui_vmess("gui_canvas_saveas", "xssi",
x2,
(strncmp(x2->gl_name->s_name, "Untitled", 8) ?
x2->gl_name->s_name : "title"),
canvas_getdir(x2)->s_name,
fdestroy != 0);
else if(x->gl_dirty)
canvas_save_ab(x2, fdestroy);
}
static void canvas_menusave(t_canvas *x, t_floatarg fdestroy)
{
t_canvas *x2 = canvas_getrootfor(x);
char *name = x2->gl_name->s_name;
if(!x->gl_isab)
{
if (*name && strncmp(name, "Untitled", 8)
&& (strlen(name) < 4 || strcmp(name + strlen(name)-4, ".pat")
|| strcmp(name + strlen(name)-4, ".mxt")))
canvas_savetofile(x2, x2->gl_name, canvas_getdir(x2), fdestroy);
else canvas_menusaveas(x2, fdestroy);
}
else if(x->gl_dirty)
canvas_save_ab(x2, fdestroy);
}
static void canvas_menuprint(t_canvas *x)
......
......@@ -392,7 +392,7 @@ static void slider_click(t_slider *x, t_floatarg xpos, t_floatarg ypos,
x->x_is_last_float=0; // does anyone know how this works with !steady && rcv==snd ?
slider_bang(x);
glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g,
(t_glistmotionfn)slider_motion, 0, xpos, ypos);
(t_glistmotionfn)slider_motion, 0, 0, xpos, ypos);
}
static int slider_newclick(t_gobj *z, struct _glist *glist,
......
......@@ -4475,7 +4475,7 @@ static int draw_click(t_gobj *z, t_glist *glist,
&draw_motion_scalar->sc_gobj);
else gpointer_setarray(&draw_motion_gpointer,
draw_motion_array, draw_motion_wp);
glist_grab(glist, z, draw_motion, 0, xpix, ypix);
glist_grab(glist, z, draw_motion, 0, 0, xpix, ypix);
//outlet_anything(x->x_obj.ob_outlet, gensym("click"), 0, 0);
}
//draw_notifyforscalar(x, glist, sc, gensym("mousedown"), 5, at);
......@@ -4693,7 +4693,7 @@ static int draw_click(t_gobj *z, t_glist *glist,
&draw_motion_scalar->sc_gobj);
else gpointer_setarray(&draw_motion_gpointer,
draw_motion_array, draw_motion_wp);
glist_grab(glist, z, draw_motion, 0, xpix, ypix);
glist_grab(glist, z, draw_motion, 0, 0, xpix, ypix);
}
post("we got clicked");
outlet_anything(x->x_obj.ob_outlet, gensym("click"), 0, 0);
......@@ -5475,7 +5475,7 @@ static int curve_click(t_gobj *z, t_glist *glist,
&curve_motion_scalar->sc_gobj);
else gpointer_setarray(&curve_motion_gpointer,
curve_motion_array, curve_motion_wp);
glist_grab(glist, z, curve_motion, 0, xpix, ypix);
glist_grab(glist, z, curve_motion, 0, 0, xpix, ypix);
}
return (1);
}
......@@ -7505,8 +7505,9 @@ static int drawsymbol_click(t_gobj *z, t_glist *glist,
drawsymbol_motion_glist, &drawsymbol_motion_scalar->sc_gobj);
else gpointer_setarray(&drawsymbol_motion_gpointer,
drawsymbol_motion_array, drawsymbol_motion_wp);
/* ico@vt.edu 20200920: LATER consider also using keyname (currently 0) */
glist_grab(glist, z, drawsymbol_motion, drawsymbol_key,
xpix, ypix);
0, xpix, ypix);
}
return (1);
}
......@@ -7935,8 +7936,9 @@ static int drawimage_click(t_gobj *z, t_glist *glist,
drawimage_motion_glist, &drawimage_motion_scalar->sc_gobj);
else gpointer_setarray(&drawimage_motion_gpointer,
drawimage_motion_array, drawimage_motion_wp);
/* ico@vt.edu 20200920: LATER consider also using keyname (currently 0) */
glist_grab(glist, z, drawimage_motion, drawimage_key,
xpix, ypix);
0, xpix, ypix);
}
return (1);
}
......
......@@ -1191,7 +1191,7 @@ static void gatom_key(void *z, t_floatarg f)
x->a_buf[0] = 0;
/* We want to keep grabbing the keyboard after hitting "Enter", so
we're commenting the following out */
//glist_grab(x->a_glist, 0, 0, 0, 0, 0);
//glist_grab(x->a_glist, 0, 0, 0, 0, 0, 0);
}
else if (len < (ATOMBUFSIZE-1))
{
......@@ -1257,7 +1257,7 @@ static void gatom_click(t_gatom *x,
}
x->a_shift = shift;
glist_grab(x->a_glist, &x->a_text.te_g, gatom_motion, gatom_key,
xpos, ypos);
gatom_list, xpos, ypos);
//post("a_shift_clicked=%d", x->a_shift_clicked);
x->a_shift_clicked = shift;
// second click wipes prior text
......@@ -2230,13 +2230,14 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
t_rtext *y = glist_findrtext(glist, x);
// make a group
text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2);
gui_vmess("gui_gobj_new", "xssiii",
gui_vmess("gui_gobj_new", "xssiiii",
glist_getcanvas(glist),
rtext_gettag(y),
type,
x1,
y1,
glist_istoplevel(glist));
glist_istoplevel(glist),
pd_class(&x->te_pd) == canvas_class);
if (x->te_type == T_ATOM)
glist_retext(glist, x);
text_drawborder(x, glist, rtext_gettag(y),
......
......@@ -14,7 +14,7 @@ extern "C" {
#define PD_MINOR_VERSION 48
#define PD_BUGFIX_VERSION 0
#define PD_TEST_VERSION ""
#define PD_L2ORK_VERSION "2.14.2"
#define PD_L2ORK_VERSION "2.15.0"
#define PDL2ORK
extern int pd_compatibilitylevel; /* e.g., 43 for pd 0.43 compatibility */
......
......@@ -331,6 +331,14 @@ typedef struct _debuginfo {
t_object x_obj;
} t_debuginfo;
static t_class *abinfo_class;
typedef struct _abinfo
{
t_object x_obj;
t_ab_definition *abdef;
} t_abinfo;
/* used by all the *info objects */
static int info_to_console = 0;
......@@ -1629,6 +1637,74 @@ void objectinfo_setup(void)
post("stable objectinfo methods: class");
}
/* -------------------------- abinfo ------------------------------ */
void *abinfo_new(void)
{
t_abinfo *x;
t_canvas *c = canvas_getcurrent();
while(c->gl_owner && !c->gl_isab) c = c->gl_owner;
if(c->gl_isab)
{
x = (t_abinfo *)pd_new(abinfo_class);
x->abdef = c->gl_absource;
outlet_new(&x->x_obj, &s_list);
}
else
{
if(!abframe)
{
error("abinfo: only instantiable inside an ab object");
x = 0;
}
else
x = pd_new(text_class);
}
return (x);
}
void abinfo_name(t_abinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
SETSYMBOL(at, x->abdef->ad_name);
info_out((t_text *)x, s, 1, at);
}
void abinfo_instances(t_abinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
SETFLOAT(at, x->abdef->ad_numinstances);
info_out((t_text *)x, s, 1, at);
}
void abinfo_within(t_abinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_binbuf *buf = binbuf_new();
int i;
for(i = 0; i < x->abdef->ad_numdep; i++)
{
binbuf_addv(buf, "s", x->abdef->ad_dep[i]->ad_name);
}
info_out((t_text *)x, s, binbuf_getnatom(buf), binbuf_getvec(buf));
binbuf_free(buf);
}
//ADD MORE METHODS
void abinfo_setup(void)
{
abinfo_class = class_new(gensym("abinfo"), (t_newmethod)abinfo_new, 0,
sizeof(t_abinfo), CLASS_DEFAULT, 0);
class_addmethod(abinfo_class, (t_method)abinfo_name,
gensym("name"), A_GIMME, 0);
class_addmethod(abinfo_class, (t_method)abinfo_instances,
gensym("instances"), A_GIMME, 0);
class_addmethod(abinfo_class, (t_method)abinfo_within,
gensym("within"), A_GIMME, 0);
}
void debuginfo_print(t_debuginfo *x)
{
info_print((t_text *)x);
......@@ -1665,6 +1741,7 @@ void x_interface_setup(void)
classinfo_setup();
debuginfo_setup();
objectinfo_setup();
abinfo_setup();
pdinfo_setup();
print_setup();
unpost_setup();
......
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