Commit a90ba604 authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

Added Jonathan Wilkes' patch for improved classinfo, canvasinfo, and pdinfo objects.

parent fa3a645f
......@@ -11,7 +11,7 @@ extern "C" {
#define PD_MAJOR_VERSION 0
#define PD_MINOR_VERSION 42
#define PD_BUGFIX_VERSION 7
#define PD_TEST_VERSION "20130906"
#define PD_TEST_VERSION "20131117"
#define PDL2ORK
/* old name for "MSW" flag -- we have to take it for the sake of many old
......@@ -448,6 +448,9 @@ EXTERN void class_set_extern_dir(t_symbol *s);
#define CLASS_MAINSIGNALIN(c, type, field) \
class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
/* classtable functions */
EXTERN t_class *classtable_findbyname(t_symbol *s);
/* prototype for functions to save Pd's to a binbuf */
typedef void (*t_savefn)(t_gobj *x, t_binbuf *b);
EXTERN void class_setsavefn(t_class *c, t_savefn f);
......
......@@ -17,8 +17,6 @@
#define MAXNDEV 20
#define DEVDESCSIZE 80
extern t_class *classtable_findbyname(t_symbol *s);
/* -------------------------- print ------------------------------ */
t_class *print_class;
......@@ -268,18 +266,22 @@ void canvasinfo_filename(t_canvasinfo *x, t_symbol *s, int argc, t_atom *argv)
void canvasinfo_hitbox(t_canvasinfo *x, t_floatarg xpos, t_floatarg ypos)
{
t_canvas *c = canvasinfo_dig(x);
int x1, y1, x2, y2;
int x1, y1, x2, y2, indexno;
t_gobj *ob = canvas_findhitbox(c, xpos, ypos, &x1, &y1, &x2, &y2);
if (ob)
{
t_atom at[5];
t_gobj *y;
for (indexno = 0, y = c->gl_list; y && y != ob; y = y->g_next)
indexno++;
t_atom at[6];
char *classname = class_getname(ob->g_pd);
SETSYMBOL(at, gensym(classname));
SETFLOAT(at+1, (t_float)x1);
SETFLOAT(at+2, (t_float)y1);
SETFLOAT(at+3, (t_float)x2);
SETFLOAT(at+4, (t_float)y2);
info_out((t_text *)x, gensym("hitbox"), 5, at);
SETFLOAT(at+1, (t_float)indexno);
SETFLOAT(at+2, (t_float)x1);
SETFLOAT(at+3, (t_float)y1);
SETFLOAT(at+4, (t_float)x2);
SETFLOAT(at+5, (t_float)y2);
info_out((t_text *)x, gensym("hitbox"), 6, at);
}
else
info_out((t_text *)x, gensym("hitbox"), 0, 0);
......@@ -953,13 +955,16 @@ void classinfo_setup(void)
post("classinfo: v.0.1");
post("stable classinfo methods: size");
/* todo: add "instance" method to return instances of a class on a canvas */
/*
todo: make an objectinfo class to get the kind of info that canvasinfo "hitbox"
currently gives
*/
}
void x_interface_setup(void)
{
print_setup();
canvasinfo_setup();
pdinfo_setup();
classinfo_setup();
print_setup();
canvasinfo_setup();
pdinfo_setup();
classinfo_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