Commit 11464609 authored by Jonathan Wilkes's avatar Jonathan Wilkes

use canvas_getrootfor instead of glist_getcanvas, guarantee editor gets...

use canvas_getrootfor instead of glist_getcanvas, guarantee editor gets created when reloading abstractions
parent ede2ff7b
......@@ -2376,9 +2376,12 @@ function gui_text_set (cid, tag, text) {
}
function gui_text_redraw_border(cid, tag, x1, y1, x2, y2) {
var g = get_gobj(cid, tag),
b = g.querySelectorAll(".border"),
i;
var g, b, i;
if (!patchwin[cid]) {
return;
}
g = get_gobj(cid, tag);
b = g.querySelectorAll(".border");
for (i = 0; i < b.length; b++) {
configure_item(b[i], {
width: x2 - x1,
......
......@@ -826,28 +826,29 @@ void canvas_map(t_canvas *x, t_floatarg f)
t_gobj *y;
if (flag)
{
t_selection *sel;
if (!x->gl_havewindow)
{
bug("canvas_map");
canvas_vis(x, 1);
}
if (!x->gl_list) {
//if there are no objects on the canvas
canvas_create_editor(x);
}
else for (y = x->gl_list; y; y = y->g_next) {
gobj_vis(y, x, 1);
if (!glist_isvisible(x)) {
t_selection *sel;
if (!x->gl_havewindow)
{
bug("canvas_map");
canvas_vis(x, 1);
}
if (!x->gl_list) {
//if there are no objects on the canvas
canvas_create_editor(x);
}
else for (y = x->gl_list; y; y = y->g_next) {
gobj_vis(y, x, 1);
}
if (x->gl_editor && x->gl_editor->e_selection)
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
gobj_select(sel->sel_what, x, 1);
x->gl_mapped = 1;
canvas_drawlines(x);
if (x->gl_isgraph && x->gl_goprect)
canvas_drawredrect(x, 1);
scrollbar_update(x);
}
if (x->gl_editor && x->gl_editor->e_selection)
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
gobj_select(sel->sel_what, x, 1);
x->gl_mapped = 1;
canvas_drawlines(x);
if (x->gl_isgraph && x->gl_goprect)
canvas_drawredrect(x, 1);
scrollbar_update(x);
}
else
{
......
......@@ -1336,6 +1336,14 @@ static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir,
do g = g->g_next in this case. */
//int j = glist_getindex(gl, g);
//fprintf(stderr, "rebuildlicious %d\n", j);
// Bugfix for cases where canvas_vis doesn't actually create a
// new editor. We need to fix canvas_vis so that the bug doesn't
// get triggered. But since we know this fixes a regression we'll
// keep this as a point in the history as we fix canvas_vis. Once
// that's done we can remove this call.
canvas_create_editor(gl);
if (!gl->gl_havewindow)
{
canvas_vis(glist_getcanvas(gl), 1);
......@@ -1387,7 +1395,7 @@ static void glist_doreload(t_glist *gl, t_symbol *name, t_symbol *dir,
them to reload an abstraction; also suppress window list update */
int glist_amreloadingabstractions = 0;
/* call canvas_doreload on everyone */
/* call glist_doreload on everyone */
void canvas_reload(t_symbol *name, t_symbol *dir, t_gobj *except)
{
t_canvas *x;
......
......@@ -402,6 +402,8 @@ void canvas_doaddtemplate(t_symbol *templatesym,
static void glist_writelist(t_gobj *y, t_binbuf *b);
void binbuf_savetext(t_binbuf *bfrom, t_binbuf *bto);
void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b,
int amarrayelement)
{
......
......@@ -462,7 +462,7 @@ static t_pd *do_create_abstraction(t_symbol*s, int argc, t_atom *argv)
const char *objectname = s->s_name;
char dirbuf[MAXPDSTRING], classslashclass[MAXPDSTRING], *nameptr;
t_glist *glist = (t_glist *)canvas_getcurrent();
t_canvas *canvas = (t_canvas*)glist_getcanvas(glist);
t_canvas *canvas = (t_canvas*)canvas_getrootfor(glist);
int fd = -1;
t_pd *was = s__X.s_thing;
......
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