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

Merge branch 'drawsvg'

parents 69e2a5af e16e7453
#N struct draw-svg-help-struct float x float y;
#N canvas 157 53 555 619 10;
#X obj 0 595 cnv 15 552 21 empty \$0-pddp.cnv.footer empty 20 12 0
14 -228856 -66577 0;
#X obj 0 0 cnv 15 552 40 empty \$0-pddp.cnv.header draw\ svg 3 12 0
18 -204280 -1 0;
#X obj 0 347 cnv 3 550 3 empty \$0-pddp.cnv.inlets inlets 8 12 0 13
-228856 -1 0;
#N canvas 494 296 482 332 META 0;
#X text 12 115 LIBRARY internal;
#X text 12 25 LICENSE SIBSD;
#X text 12 5 KEYWORDS control GUI data-structure;
#X text 12 45 DESCRIPTION draw an svg shape to represent a scalar;
#X text 12 65 INLET_0 float fill fill-opacity fill-rule stroke stroke-dasharray
stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width
rx ry;
#X text 12 135 AUTHOR Jonathan Wilkes;
#X text 13 155 HELP_PATCH_AUTHORS Jonathan Wilkes;
#X restore 500 597 pd META;
#X obj 0 444 cnv 3 550 3 empty \$0-pddp.cnv.outlets outlets 8 12 0
13 -228856 -1 0;
#X obj 0 481 cnv 3 550 3 empty \$0-pddp.cnv.argument arguments 8 12
0 13 -228856 -1 0;
#X obj 0 542 cnv 3 550 3 empty \$0-pddp.cnv.more_info more_info 8 12
0 13 -228856 -1 0;
#X obj 78 355 cnv 17 3 80 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#N canvas 212 516 428 108 Related_objects 0;
#X obj 1 1 cnv 15 425 20 empty \$0-pddp.cnv.subheading empty 3 12 0
14 -204280 -1 0;
#X obj 27 35 draw;
#X text 7 1 [draw svg] Related Objects;
#X restore 101 597 pd Related_objects;
#X obj 78 453 cnv 17 3 17 empty \$0-pddp.cnv.let.0 0 5 9 0 16 -228856
-162280 0;
#X obj 4 597 pddp/pddplink all_about_help_patches.pd -text Usage Guide
;
#X text 98 394 [draw] also takes a number of messages. These are svg
attributes that define how the object is drawn. See the subpatch above
for a full list.;
#X obj 172 552 pddp/pddplink drawarray-help.pd -text draw array;
#X text 101 554 See also:;
#X obj 172 572 pddp/pddplink drawimage-help.pd -text draw image;
#X obj 242 552 pddp/pddplink drawsprite-help.pd -text draw sprite;
#X text 11 20 draw shapes inside an svg container;
#X obj 146 52 struct draw-svg-help-struct float x float y;
#X scalar draw-svg-help-struct 207 120 \;;
#X obj 34 137 r \$0-drag;
#X obj 34 159 route drag;
#N canvas 0 0 450 300 pan 0;
#X obj 50 51 unpack p 0 0;
#X floatatom 82 75 5 0 0 0 - - -, f 5;
#X floatatom 123 72 5 0 0 0 - - -, f 5;
#X obj 47 20 inlet;
#X obj 71 122 * -1;
#X obj 128 120 * -1;
#X obj 71 154 +;
#X obj 128 152 +;
#X obj 71 176 t a;
#X obj 128 174 t a;
#X obj 71 198 outlet;
#X obj 128 196 outlet;
#X connect 0 1 1 0;
#X connect 0 1 4 0;
#X connect 0 2 2 0;
#X connect 0 2 5 0;
#X connect 3 0 0 0;
#X connect 4 0 6 0;
#X connect 5 0 7 0;
#X connect 6 0 8 0;
#X connect 7 0 9 0;
#X connect 8 0 6 1;
#X connect 8 0 10 0;
#X connect 9 0 7 1;
#X connect 9 0 11 0;
#X restore 34 181 pd pan;
#X obj 33 211 pack;
#X text 98 354 viewBox;
#X text 168 355 - Four floats to define the viewport of the container:
xOrigin yOrigin width height. See svg spec for more details;
#X text 99 453 anything;
#X text 169 453 - messages in response to any events set for the object
;
#X text 81 498 1) float;
#X text 171 498 - initial width of the container;
#X text 81 515 2) float;
#X text 171 515 - initial height of the container;
#N canvas 492 53 686 639 (subpatch) 0;
#X obj 41 52 draw path m 5 194.088 l 666.819 0 l 0 -36.9314 l -3.12158
0 l 0 3.03125 l -5.96875 0 l 0 -1.5 l -7.40625 0 l 0 5.40625 l -5.65625
0 l 0 1.6875 l -3.125 0 l 0 -1.65625 l -5.40625 0 l -6.84375 -6.84375
l -1.84375 3.21875 l -2.5625 0 l 0 -19.1562 c 1.11498 -0.60865 1.90625
-1.76523 1.90625 -3.125 c 0 -1.35977 -0.79127 -2.51635 -1.90625 -3.125
l 0 -13.4375 l 2.03125 0 l 0 -2.3125 l -2.6938 0 l -0.99404 -12.4839
l -0.90632 12.4839 l -3.62459 0 l 0 1.84375 l 2.51562 0 l 0 1.79466
l -1.23437 0 l 0 1.99861 l 1.5625 0 l 0 10.0817 c -1.14211 0.60033
-1.9375 1.77639 -1.9375 3.15625 c 0 1.37986 0.79539 2.55592 1.9375
3.15625 l 0 19.625 l -2.90625 0 l 0 -5.59375 l -3.875 -3.90625 l -6.65625
3.84375 l 0 -2.5 l -3.53125 0.96875 l 0 7.4375 l -2.59375 0 l 0 -3.8125
l -17.5938 0 l 0 4 l -5.03125 0 l 0 -3.75 l -11.875 0 l 0 3.3125 l
-3.78125 0 l -0.78125 -26.4688 l -0.78125 25.1875 l -2.3125 0 l 0 -3.96875
l -2.9375 0 l 0 3.5 l -3.5 0 l 0 -2.1875 l -5.21875 0 l 0 5.1875 l
-7.8125 0 l 0 -2.53125 l -7.53125 0 l 0.25 -20.8438 l -1.28125 21.3438
l -4.09375 0 l 0 -6.3125 l -3.1875 0 l -0.9375 3.5 l -3.875 0 l 0 4.3125
l -2.3125 0 l 0 -6.34375 l -2.03125 -0.53125 l 0 4.875 l -1.28125 0
l 0 2.40625 l -1.59375 0 l 0 3.5 l -4.59375 0 l 0 -23.125 l -11.6875
0 l 0 -3.15625 l -3.46875 0 l 0 3.15625 l -3.875 0 l 0 8.71875 l -4.09375
0 l 0 5.15625 l -3.09375 0 l 0 4.375 l -2.125 0 l 0 -3.375 l -1.71875
0 l 0 -5.40625 l -6.59375 0 l 0 2.59375 l -8.59375 0 l 0 3.34375 l
-9.75 0 l 0 -14.7188 l -3.90625 0 l 0 -1.71875 l -3.5625 0 l 0 2.3125
l -2.0625 0 l 0 -2.59375 l -6.15625 0 l 0 6.96875 l -3.125 0 l 0 5.1875
l -1.5625 0 l 0 -9 l -1.5 0 l 0 -2.15625 l -5.75 0 l -0.65625 -2.53125
l -12.0938 0 l 0 5.15625 l -2.0625 0 l 0 6.6875 l -4.375 0 l -1.84375
-3.09375 l 0 -77.75 l -1.46875 0 l 0 -1.96875 l 3.15625 0 l 0 -5.1875
l 1.6875 0 l 0 -3.84375 l -1.6875 0 l 0 -8.28125 l -1.375 0 l 0 -3.5
l 6.03125 0 l 0 -2.5625 l -2.4375 0 l 0 -5.0625 l 2.1875 0 l 0 -2.1875
l -4.03125 0 l 0 -1.21875 l -2.78125 0 l 0 -3.125 l 1.71875 0 l 0 -1.9375
l -4.28125 0 L 405.166 5 l -1.40625 26.7812 l -5.34375 0 l 0 1.9375
l 1.96875 0 l 0 3.4375 c -2.95107 0.40253 -5.2699 1.439 -6.375 3.6875
l 0 2.96875 l 2.03125 0 l 0 2.78125 l -1.40625 0 l 0 1.78125 l 5.09375
0 l 0 3 l -2.125 0 l 0 8.28125 l -1.9375 0 l 0 3.84375 l 1.9375 0 l
0 4.6875 l 3.53125 0 l 0 2.46875 l -2.0625 0 l 0 78.25 l -12.4062 0
l 0 11.8438 l -5.65625 0 l 0 -22.125 l -5.40625 0 l 0 -1.53125 l -6.375
0 l -0.46875 -9.625 l -0.4375 9.625 l -8.57193 0 l 0 3.09375 l -3.0625
0 l 0 5.375 l -16.6191 0 l 0 5.65625 l -5.125 0 l 0 -2.90625 l -0.78125
-3 l -5.65625 0 l 0 2.84375 l -1.37218 0 l 0 15.3442 l -3.41612 0 l
0 -18.438 l -8.0867 0 l 0 -3.59375 l -4 0 l 0 3.78125 l -1.90625 1.09375
l 0 5.65625 l -33.2439 0 l 0 1.3125 l -1.8125 0 l 0 -4.40625 l -4.875
0 l 0 -1.03125 l -3.875 0 l 0 -2.5625 l -4.375 0 l 0 6.6875 l -12.1514
0 l 0 -2.5625 l -3.84375 0 l 0 -3.34375 l -4.25 0 l 0 10.4062 l -3.21875
-3.21875 l 0 -25.9688 l -6.15625 0 l 0 -6.15625 l -5.15625 0 l 0 13.375
l -6.99996 0 l 0 28.0945 l -6.09379 0 l 0 -8.06316 l -2.90625 -3.28125
l -3.53125 3.28125 l 0 -8.8125 l -5.28125 0 l 0 -2.875 l -5.59375 0
l 0 3.96875 l -3.5625 0 l 0 4.6875 l -1.5 0 l 0 -1.84375 l -10.7927
0 l 0 3.125 l -17.4334 0 l 0 -3.34375 l -3.96875 0 l 0 -2.34375 l -6.9375
0 l 0 -3.34375 l -3.84375 0 l -0.90625 -32.4375 c 1.7461 -0.54309 3.03125
-2.16894 3.03125 -4.09375 c 0 -2.01445 -1.409 -3.66423 -3.28125 -4.125
l -0.84375 -30.25 l -1.375 30.2812 c -1.77984 0.52232 -3.09375 2.14493
-3.09375 4.09375 c 0 1.81116 1.13148 3.37093 2.71875 4 l -1.96875 43.7812
l -4.46905 4.75707 l 0 3.18537 l -6.03095 -4.03614 l 0 -11.5625 l -19.25
0 l 0 6.0625 l -2.59375 0 l 0 -78.5 l -32.9688 0 l 0 74.2188 l -4.53125
0 l 0 2.5625 l -4.03125 0 l 0 2.34375 l -3.46875 0 l 0 -4.375 l -2.3125
0 l 0 -5.40625 l -3.34375 0 l 0 -6.6875 l -6.0746 0 l 0 22.754 l -4.59819
0 l 0 -1.83383 l -8.10846 0.0134 l 0 1.97273 l -4.875 0 l 0 8.96875
l -4.875 0 l 0 -8.96878 l -4.15862 0 l 0 -3.01004 l -2.34138 0 l 0
3.01004 l -11.75 0 l 0 7.43748 l -2.3125 0 l 0 3.34375 l -5.50958 0
z;
#X obj 41 9 loadbang;
#X msg 41 31 drag 1;
#X obj 41 981 s \$0-drag;
#X text 135 6 Skyline from:;
#X obj 135 26 pddp/pddplink https://upload.wikimedia.org/wikipedia/commons/1/13/JohannesburgArtisticSilhouette.svg
;
#X connect 0 0 3 0;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X restore 33 285 draw svg 300 200;
#X msg 33 233 viewBox \$1 \$2 300 200;
#X obj 34 52 loadbang;
#X msg 34 84 fill none \, stroke-width 2 \, stroke black \, stroke-dasharray
5 5, f 61;
#X obj 34 107 draw rect 300 200;
#X text 270 322 Click to drag the skyline;
#X connect 19 0 20 0;
#X connect 20 0 21 0;
#X connect 21 0 22 0;
#X connect 21 1 22 1;
#X connect 22 0 32 0;
#X connect 32 0 31 0;
#X connect 33 0 34 0;
#X connect 34 0 35 0;
......@@ -381,7 +381,7 @@ text {
stroke: #ccc;
}
/* A little hack for special canvas of [cnv].
/* A little hack for special case of [cnv].
All other iemguis have a black border, but
[cnv] sets its selection rectangle to the
user-supplied fill color when the object
......
......@@ -3264,9 +3264,9 @@ function gui_scalar_draw_select_rect(cid, tag, state, x1, y1, x2, y2, basex, bas
}
}
function gui_scalar_draw_group(cid, tag, parent_tag, attr_array) {
function gui_scalar_draw_group(cid, tag, parent_tag, type, attr_array) {
var parent_elem,
g;
group;
if (!patchwin[cid]) {
return;
}
......@@ -3275,9 +3275,9 @@ function gui_scalar_draw_group(cid, tag, parent_tag, attr_array) {
attr_array = [];
}
attr_array.push("id", tag);
g = create_item(cid, "g", attr_array);
parent_elem.appendChild(g);
return g;
group = create_item(cid, type, attr_array);
parent_elem.appendChild(group);
return group;
}
function gui_scalar_configure_gobj(cid, tag, isselected, t1, t2, t3, t4, t5, t6) {
......@@ -3383,6 +3383,19 @@ function gui_draw_configure(cid, tag, attr, val) {
configure_item(item, obj);
}
// Special case for viewBox which, in addition to its inexplicably inconsistent
// camelcasing also has no "none" value in the spec. This requires us to create
// a special case to remove the attribute if the user wants to get back to
// the default behavior.
function gui_draw_viewbox(cid, tag, attr, val) {
// Value will be an empty array if the user provided no values
if (val.length) {
gui_draw_configure(cid, tag, attr, val)
} else {
get_item(cid, tag).removeAttribute("viewBox");
}
}
// Configure multiple attr/val pairs (this should be merged with gui_draw_configure at some point
function gui_draw_configure_all(cid, tag, attr_array) {
var item = get_item(cid, tag);
......@@ -3507,55 +3520,58 @@ function gui_drawimage_new(obj_tag, file_path, canvasdir, flags) {
var drawsprite = 1,
drawimage_data = [], // array for base64 image data
image_seq,
i,
count = 0,
matchchar = "*",
files,
ext,
img_types = [".gif", ".jpeg", ".jpg", ".png", ".svg"],
img; // dummy image to measure width and height
image_seq = flags & drawsprite;
if (!path.isAbsolute(file_path)) {
file_path = path.join(canvasdir, file_path);
if (file_path !== "") {
if(!path.isAbsolute(file_path)) {
file_path = path.join(canvasdir, file_path);
}
file_path = path.normalize(file_path);
}
file_path = path.normalize(file_path);
if (fs.existsSync(file_path) && fs.lstatSync(file_path).isDirectory()) {
if (file_path !== "" &&
fs.existsSync(file_path) &&
fs.lstatSync(file_path).isDirectory()) {
files = fs.readdirSync(file_path)
.sort(); // Note that js's "sort" method doesn't do the
// "right thing" for numbers. For that we'd need
// to provide our own sorting function
// todo: warn about image sequence with > 999
for (i = 0; i < files.length && i < 1000; i++) {
ext = path.extname(files[i]);
// todo: tolower()
if (ext === ".gif" ||
ext === ".jpg" ||
ext === ".png" ||
ext === ".jpeg" ||
ext === ".svg") {
files.forEach(function(file) {
ext = path.extname(file).toLowerCase();
if (img_types.indexOf(ext) != -1) {
// Now add an element to that array with the image data
drawimage_data.push({
type: ext === ".jpeg" ? "jpg" : ext.slice(1),
data: fs.readFileSync(path.join(file_path, files[i]),"base64")
data: fs.readFileSync(path.join(file_path, file),"base64")
});
count++;
}
}
} else {
i = 0;
});
}
//post("no of files: " + i);
post("no of files: " + count);
if (i > 0) {
img = new pd_window.Image(); // create an image in the pd_window context
img.onload = function() {
pdsend(obj_tag, "size", this.width, this.height);
};
img.src = "data:image/" + drawimage_data[0].type +
";base64," + drawimage_data[0].data;
} else {
post("drawimage: warning: no images loaded");
if (count === 0) {
// set a default image
drawimage_data.push({
type: "png",
data: get_default_png_data()
});
if (file_path !== "") {
post("draw image: error: couldn't load image");
}
post("draw image: warning: no image loaded. Using default png");
}
img = new pd_window.Image(); // create an image in the pd_window context
img.onload = function() {
pdsend(obj_tag, "size", this.width, this.height);
};
img.src = "data:image/" + drawimage_data[0].type +
";base64," + drawimage_data[0].data;
pd_cache.set(obj_tag, drawimage_data); // add the data to container
}
......@@ -3648,18 +3664,23 @@ function gui_drawimage_index(cid, obj, data, index) {
configure_item(image, { visibility: "visible" });
}
// Default png image data
function get_default_png_data() {
return ["iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAb1BMVEWBgYHX19",
"f///8vLy/8/Pzx8PH3+Pf19fXz8/Pu7u7l5eXj4+Pn5+fs7Oza2tr6+vnq6urh",
"4eHe3t7c3Nza2dr6+fro6Og1NTXr6+xYWFi1tbWjo6OWl5aLjItDQ0PPz8+/v7",
"+wsLCenZ5zc3NOTk4Rpd0DAAAAqElEQVQoz62L2Q6CMBBFhcFdCsomq+v/f6Mn",
"bdOSBn3ypNO5Nyez+kG0zN9NWZZK8RRbB/2XmMLSvSZp2mehTMVcLGIYbcWcLW",
"1/U4PIZCvmOCMSaWzEHGaMIq2NmJNn4ORuMybP6xxYD0SnE4NJDdc0fYv0LCJg",
"9g4RqV3BrJfB7Bzc+ILZOjC+YDYOjC+YKqsyHlOZAX5Msgwm1iRxgDYBSWjCm+",
"98AAfDEgD0K69gAAAAAElFTkSuQmCC"
].join("");
}
function gui_load_default_image(dummy_cid, key) {
pd_cache.set(key, {
type: "png",
data: ["iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAAAb1BMVEWBgYHX19",
"f///8vLy/8/Pzx8PH3+Pf19fXz8/Pu7u7l5eXj4+Pn5+fs7Oza2tr6+vnq6urh",
"4eHe3t7c3Nza2dr6+fro6Og1NTXr6+xYWFi1tbWjo6OWl5aLjItDQ0PPz8+/v7",
"+wsLCenZ5zc3NOTk4Rpd0DAAAAqElEQVQoz62L2Q6CMBBFhcFdCsomq+v/f6Mn",
"bdOSBn3ypNO5Nyez+kG0zN9NWZZK8RRbB/2XmMLSvSZp2mehTMVcLGIYbcWcLW",
"1/U4PIZCvmOCMSaWzEHGaMIq2NmJNn4ORuMybP6xxYD0SnE4NJDdc0fYv0LCJg",
"9g4RqV3BrJfB7Bzc+ILZOjC+YDYOjC+YKqsyHlOZAX5Msgwm1iRxgDYBSWjCm+",
"98AAfDEgD0K69gAAAAAElFTkSuQmCC"
].join("")
data: get_default_png_data()
});
}
......
......@@ -1101,9 +1101,9 @@ static void canvas_pop(t_canvas *x, t_floatarg fvis)
extern void *svg_new(t_pd *x, t_symbol *s, int argc, t_atom *argv);
extern t_pd *svg_header(t_pd *x);
static void group_svginit(t_glist *gl)
static void group_svginit(t_glist *gl, t_symbol *type, int argc, t_atom *argv)
{
gl->gl_svg = (t_pd *)(svg_new((t_pd *)gl, gensym("g"), 0, 0));
gl->gl_svg = (t_pd *)(svg_new((t_pd *)gl, type, argc, argv));
t_pd *proxy = svg_header(gl->gl_svg);
inlet_new(&gl->gl_obj, proxy, 0, 0);
outlet_new(&gl->gl_obj, &s_anything);
......@@ -1116,10 +1116,14 @@ 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 [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);
/* for [draw g] and [draw svg] we add an inlet to the svg attr proxy */
if (atom_getsymbolarg(2, argc, argv) == gensym("draw"))
{
t_symbol *type = (atom_getsymbolarg(3, argc, argv) == gensym("svg")) ?
gensym("svg") : gensym("g");
group_svginit(x, type,
(type == gensym("svg") && argc > 4) ? argc-4 : 0,
(type == gensym("svg") && argc > 4) ? argv+4 : 0);
is_draw_command = 1;
}
if (argc > 3 || (is_draw_command && argc > 4))
......@@ -1352,12 +1356,18 @@ static void *subcanvas_new(t_symbol *s)
return (x);
}
void *group_new(t_symbol *s)
void *group_new(t_symbol *type, int argc, t_atom *argv)
{
t_canvas *x = subcanvas_new(s);
group_svginit(x);
t_symbol *groupname;
if (type == gensym("g"))
groupname = atom_getsymbolarg(0, argc, argv);
else /* no name for inner svg */
groupname = &s_;
t_canvas *x = subcanvas_new(groupname);
group_svginit(x, type, argc, argv);
return (x);
}
static void canvas_click(t_canvas *x,
t_floatarg xpos, t_floatarg ypos,
t_floatarg shift, t_floatarg ctrl, t_floatarg alt)
......@@ -1376,6 +1386,14 @@ void canvas_fattensub(t_canvas *x,
static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av)
{
/* special case for [draw g] where the 3rd arg is the receiver name */
if (x->gl_svg)
{
if (atom_getsymbolarg(0, ac, av) == gensym("g") && ac > 1)
ac--, av++;
else
ac = 0;
}
if (ac && av->a_type == A_SYMBOL)
canvas_rename(x, av->a_w.w_symbol, 0);
else if (ac && av->a_type == A_DOLLSYM)
......
......@@ -409,6 +409,11 @@ extern int array_joc;
extern void template_notifyforscalar(t_template *template, t_glist *owner,
t_scalar *sc, t_symbol *s, int argc, t_atom *argv);
extern void scalar_getinnersvgrect(t_gobj *z, t_glist *owner, t_word *data,
t_template *template, t_float basex, t_float basey,
int *xp1, int *yp1, int *xp2, int *yp2);
extern t_symbol *group_gettype(t_glist *glist);
static void scalar_getgrouprect(t_glist *owner, t_glist *groupcanvas,
t_word *data, t_template *template, int basex, int basey,
int *x1, int *x2, int *y1, int *y2)
......@@ -420,8 +425,12 @@ static void scalar_getgrouprect(t_glist *owner, t_glist *groupcanvas,
((t_canvas *)y)->gl_svg)
{
/* todo: accumulate basex and basey for correct offset */
scalar_getgrouprect(owner, (t_glist *)y, data, template,
basex, basey, x1, x2, y1, y2);
if (group_gettype((t_canvas *)y) == gensym("g"))
scalar_getgrouprect(owner, (t_glist *)y, data, template,
basex, basey, x1, x2, y1, y2);
else /* inner svg */
scalar_getinnersvgrect(y, owner, data, template, basex, basey,
x1, y1, x2, y2);
}
else
{
......@@ -876,8 +885,9 @@ static void scalar_groupvis(t_scalar *x, t_glist *owner, t_template *template,
char parentbuf[MAXPDSTRING];
sprintf(parentbuf, "dgroup%lx.%lx", (long unsigned int)parent,
(long unsigned int)x->sc_vec);
gui_start_vmess("gui_scalar_draw_group", "xss",
glist_getcanvas(owner), tagbuf, parentbuf);
gui_start_vmess("gui_scalar_draw_group", "xsss",
glist_getcanvas(owner), tagbuf, parentbuf,
group_gettype(gl)->s_name);
svg_grouptogui(gl, template, x->sc_vec);
gui_end_vmess();
......@@ -998,8 +1008,8 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
sprintf(tagbuf, "scalar%lxgobj", (long unsigned int)x->sc_vec);
sprintf(groupbuf, "dgroup%lx.%lx", (long unsigned int)templatecanvas,
(long unsigned int)x->sc_vec);
gui_vmess("gui_scalar_draw_group", "xss",
glist_getcanvas(owner), groupbuf, tagbuf);
gui_vmess("gui_scalar_draw_group", "xsss",
glist_getcanvas(owner), groupbuf, tagbuf, "g");
pd_bind(&x->sc_gobj.g_pd, gensym(buf));
}
......
This diff is collapsed.
......@@ -3018,6 +3018,10 @@ void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize, int pos)
(void *)canvas_undo_set_recreate(glist_getcanvas(glist),
&x->te_g, pos));
typedmess(&x->te_pd, gensym("rename"), natom2-1, vec2+1);
// Special case for [draw svg] -- update the args
if (((t_canvas *)x)->gl_svg)
typedmess(((t_canvas *)x)->gl_svg, gensym("update_svg"),
natom2-1, vec2+1);
binbuf_free(x->te_binbuf);
x->te_binbuf = b;
glob_preset_node_list_seek_hub();
......
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