Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wynn
purr-data
Commits
a2e3c333
Commit
a2e3c333
authored
Sep 17, 2015
by
Jonathan Wilkes
Browse files
first stab at changing [group] to [draw group]
parent
3880b58e
Changes
4
Hide whitespace changes
Inline
Side-by-side
pd/src/g_canvas.c
View file @
a2e3c333
...
...
@@ -1106,15 +1106,18 @@ void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv);
void
canvas_restore
(
t_canvas
*
x
,
t_symbol
*
s
,
int
argc
,
t_atom
*
argv
)
{
t_pd
*
z
;
int
is_draw_command
=
0
;
//fprintf(stderr,"canvas_restore %lx\n", x);
/* for [group] we add an inlet to the svg attr proxy */
if
(
argc
>
2
&&
argv
[
2
].
a_w
.
w_symbol
==
gensym
(
"
group
"
))
/* for [
draw
group] we add an inlet to the svg attr proxy */
if
(
argc
>
2
&&
argv
[
2
].
a_w
.
w_symbol
==
gensym
(
"
draw
"
))
{
group_svginit
(
x
);
is_draw_command
=
1
;
}
if
(
argc
>
3
)
if
(
argc
>
3
||
(
is_draw_command
&&
argc
>
4
)
)
{
t_atom
*
ap
=
argv
+
3
;
int
offset
=
is_draw_command
?
4
:
3
;
t_atom
*
ap
=
argv
+
offset
;
if
(
ap
->
a_type
==
A_SYMBOL
)
{
t_canvasenvironment
*
e
=
canvas_getenv
(
canvas_getcurrent
());
...
...
@@ -1348,7 +1351,7 @@ static void *subcanvas_new(t_symbol *s)
return
(
x
);
}
static
void
*
group_new
(
t_symbol
*
s
)
void
*
group_new
(
t_symbol
*
s
)
{
t_canvas
*
x
=
subcanvas_new
(
s
);
group_svginit
(
x
);
...
...
@@ -2335,7 +2338,6 @@ void g_canvas_setup(void)
/* ----- subcanvases, which you get by typing "pd" in a box ---- */
class_addcreator
((
t_newmethod
)
subcanvas_new
,
gensym
(
"pd"
),
A_DEFSYMBOL
,
0
);
class_addcreator
((
t_newmethod
)
subcanvas_new
,
gensym
(
"page"
),
A_DEFSYMBOL
,
0
);
class_addcreator
((
t_newmethod
)
group_new
,
gensym
(
"group"
),
A_DEFSYM
,
0
);
class_addmethod
(
canvas_class
,
(
t_method
)
canvas_click
,
gensym
(
"click"
),
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
A_FLOAT
,
0
);
...
...
@@ -2353,11 +2355,6 @@ void g_canvas_setup(void)
class_addcreator
((
t_newmethod
)
table_new
,
gensym
(
"table"
),
A_DEFSYM
,
A_DEFFLOAT
,
0
);
/*--------------------------- svg groups ---------------------- */
class_addcreator
((
t_newmethod
)
group_new
,
gensym
(
"group"
),
A_DEFSYM
,
A_DEFFLOAT
,
0
);
/*---------------------------- declare ------------------- */
declare_class
=
class_new
(
gensym
(
"declare"
),
(
t_newmethod
)
declare_new
,
(
t_method
)
declare_free
,
sizeof
(
t_declare
),
CLASS_NOINLET
,
A_GIMME
,
0
);
...
...
pd/src/g_readwrite.c
View file @
a2e3c333
...
...
@@ -623,9 +623,17 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
/* have to go to original binbuf to find out how we were named. */
//fprintf(stderr,"saving subpatch\n");
t_binbuf
*
bz
=
binbuf_new
();
t_symbol
*
patchsym
;
t_symbol
*
patchsym
,
*
selector
;
int
name_index
;
binbuf_addbinbuf
(
bz
,
x
->
gl_obj
.
ob_binbuf
);
patchsym
=
atom_getsymbolarg
(
1
,
binbuf_getnatom
(
bz
),
binbuf_getvec
(
bz
));
selector
=
atom_getsymbolarg
(
0
,
binbuf_getnatom
(
bz
),
binbuf_getvec
(
bz
));
/* For [draw group] we save the name as the third argument. This
is rather obscure but it might be handy if people want to
dynamically create objects inside a [draw group] */
if
(
selector
==
gensym
(
"draw"
))
name_index
=
2
;
else
name_index
=
1
;
patchsym
=
atom_getsymbolarg
(
name_index
,
binbuf_getnatom
(
bz
),
binbuf_getvec
(
bz
));
binbuf_free
(
bz
);
binbuf_addv
(
b
,
"ssiiiisi;"
,
gensym
(
"#N"
),
gensym
(
"canvas"
),
(
int
)(
x
->
gl_screenx1
),
...
...
pd/src/g_template.c
View file @
a2e3c333
...
...
@@ -1388,7 +1388,7 @@ static int symbol_isdrawtype(t_symbol *s)
s == gensym("line") || s == gensym("path") ||
s == gensym("polygon") || s == gensym("polyline") ||
s == gensym("rect") || s == gensym("image") ||
s == gensym("sprite"))
s == gensym("sprite")
|| s == gensym("group")
)
{
return 1;
}
...
...
@@ -1397,6 +1397,7 @@ static int symbol_isdrawtype(t_symbol *s)
}
static void *drawimage_new(t_symbol *classsym, int argc, t_atom *argv);
extern void *group_new(t_symbol *s);
static void *draw_new(t_symbol *classsym, t_int argc, t_atom *argv)
{
...
...
@@ -1409,6 +1410,15 @@ static void *draw_new(t_symbol *classsym, t_int argc, t_atom *argv)
have their own class and new function */
if (type == gensym("sprite") || type == gensym("image"))
return (drawimage_new(type, argc, argv));
else if (type == gensym("group"))
{
t_symbol *group_name;
if (argc > 0 && argv->a_type == A_SYMBOL)
group_name = atom_getsymbolarg(0, argc, argv);
else group_name = &s_;
post("group name is %s", group_name->s_name);
return (group_new(group_name));
}
}
else
{
...
...
pd/src/g_text.c
View file @
a2e3c333
...
...
@@ -2466,8 +2466,8 @@ static int compare_subpatch_selectors(t_atom *a, t_atom *b)
return
(
!
strcmp
(
a
[
0
].
a_w
.
w_symbol
->
s_name
,
"pd"
)
&&
!
strcmp
(
b
[
0
].
a_w
.
w_symbol
->
s_name
,
"pd"
))
||
(
!
strcmp
(
a
[
0
].
a_w
.
w_symbol
->
s_name
,
"
group
"
)
&&
!
strcmp
(
b
[
0
].
a_w
.
w_symbol
->
s_name
,
"
group
"
));
(
!
strcmp
(
a
[
0
].
a_w
.
w_symbol
->
s_name
,
"
draw
"
)
&&
!
strcmp
(
b
[
0
].
a_w
.
w_symbol
->
s_name
,
"
draw
"
));
}
else
return
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment