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

some more work toward arbitrary-sized object box content from GUI->Pd

* simplify GUI API
* get rid of canvas_createobj
parent 761cd972
......@@ -402,12 +402,6 @@ var canvas_events = (function() {
text_keyup: function(evt) {
evt.stopPropagation();
//evt.preventDefault();
// ctrl-Enter to instantiate object
// if (evt.keyCode === 13 && cmd_or_ctrl_key(evt)) {
// canvas_events.text(); // anchor the object
// canvas_events.set_obj();
// pdgui.pdsend(name, "reselect");
// }
return false;
},
text_keypress: function(evt) {
......@@ -506,7 +500,7 @@ var canvas_events = (function() {
}
},
utils = {
set_obj: function() {
create_obj: function() {
var fudi_msg = text_to_fudi(textbox().innerText),
fudi_array = string_to_array_of_chunks(fudi_msg),
i;
......@@ -514,10 +508,6 @@ var canvas_events = (function() {
pdgui.pdsend(name, "obj_addtobuf", fudi_array[i].join(" "));
}
pdgui.pdsend(name, "obj_buftotext");
},
create_obj: function() {
canvas_events.set_obj();
pdgui.pdsend(name, "obj_createobj");
}
}
;
......@@ -775,9 +765,6 @@ var canvas_events = (function() {
get_previous_state: function() {
return previous_state;
},
set_obj: function() {
utils.set_obj();
},
create_obj: function() {
utils.create_obj();
},
......@@ -905,7 +892,7 @@ function have_live_box() {
// If there's a box being edited, send the box's text to Pd
function update_live_box() {
if (have_live_box()) {
canvas_events.set_obj();
canvas_events.create_obj();
}
}
......@@ -1076,7 +1063,7 @@ function nw_create_patch_window_menus(gui, w, name) {
if (canvas_events.get_state() === "floating_text" ||
canvas_events.get_state() === "text") {
canvas_events.text(); // anchor the object
canvas_events.set_obj();
canvas_events.create_obj();
}
pdgui.pdsend(name, "reselect");
}
......
......@@ -7377,7 +7377,6 @@ static void canvas_buftotext(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
automatically, so we don't need to free the "buf" here. */
rtext_settext(rtext, buf, length);
binbuf_free(b);
binbuf_clear(newobjbuf);
// Set the dirty flag since we've changed the rtext content...
canvas_dirty(x, 1);
x->gl_editor->e_textdirty = 1;
......@@ -7385,18 +7384,8 @@ static void canvas_buftotext(t_canvas *x, t_symbol *s, int argc, t_atom *argv)
break;
}
}
}
static void canvas_createobj(t_canvas *x)
{
t_gobj *y;
t_rtext *rtext;
if (!x->gl_editor) return;
for (y = x->gl_list; y; y = y->g_next)
{
if (glist_isselected(x, y) && (rtext = glist_findrtext(x, (t_text *)y)))
glist_deselect(x, y); // instantiate
}
/* Clear the buffer */
binbuf_clear(newobjbuf);
}
void g_editor_setup(void)
......@@ -7424,8 +7413,6 @@ void g_editor_setup(void)
gensym("obj_addtobuf"), A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_buftotext,
gensym("obj_buftotext"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_createobj,
gensym("obj_createobj"), A_NULL);
/* ------------------------ menu actions ---------------------------- */
class_addmethod(canvas_class, (t_method)canvas_menuclose,
gensym("menuclose"), A_DEFFLOAT, 0);
......
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