diff --git a/src/g_canvas.c b/src/g_canvas.c index dd9fdd15747c2ca1837e9679ba4f36cc4a960164..c8b5aa79836a8a7f66aa730399260d36b11cd481 100644 --- a/src/g_canvas.c +++ b/src/g_canvas.c @@ -713,52 +713,28 @@ void canvas_map(t_canvas *x, t_floatarg f) //if (!glist_isvisible(x)) //{ //fprintf(stderr,"canvas_map 1 isvisible\n"); - t_selection *sel; - if (!x->gl_havewindow) - { - bug("canvas_map"); - canvas_vis(x, 1); - } - //else if (x->gl_mapped == 0) - // canvas_vis(x, 1); - - /* if parent has editor enabled and we're a sub-patch, - (but not an abstraction) match its edit mode to that - of its parent patch. */ - /*t_glist *parentx; - if (!canvas_isabstraction(x)) { - if (x->gl_owner) { - parentx = x->gl_owner; - while (parentx->gl_owner) - parentx = parentx->gl_owner; - if (parentx->gl_edit) - canvas_editmode(x, 1); - else if (x->gl_edit) - canvas_editmode(x, 0); - } - }*/ - /* for parent windows, let's make sure the cursor is updated - as soon as the window is open (if in edit mode) */ - //else if (x->gl_edit) { - //canvas_setcursor(x, CURSOR_EDITMODE_NOTHING); - //} - - if (!x->gl_list) { - //if there are no objects on the canvas - //fprintf(stderr,"window is empty\n"); - 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); - sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", 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); + sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x); //} } else @@ -840,13 +816,9 @@ void canvas_free(t_canvas *x) { t_gobj *y; int dspstate = canvas_suspend_dsp(); - // jsarlo + if (x->gl_magic_glass) magicGlass_free(x->gl_magic_glass); - // end jsarlo - - //delete clock for gl_destroy - //if (x->gl_destroy) clock_free(x->gl_destroy); canvas_noundo(x); if (canvas_editing == x) diff --git a/src/g_editor.c b/src/g_editor.c index 938dc1e702c44cb7357f6b8f9c5ae28b49a6891e..e45b797edc5dcd738871b34e9602ed8bd6948755 100644 --- a/src/g_editor.c +++ b/src/g_editor.c @@ -1164,55 +1164,29 @@ typedef struct _undo_canvas_properties unsigned int gl_hidetext:1; /* hide object-name + args when doing graph on parent */ } t_undo_canvas_properties; -t_undo_canvas_properties global_buf; /* we need this to avoid redundant undo creation when pressing apply and then ok in the canvas properties menu */ +t_undo_canvas_properties global_buf; static void *canvas_undo_set_canvas(t_canvas *x) { - //t_undo_canvas_properties *buf; - /* enable editor (in case it is disabled) and select the object we are working on */ if (!x->gl_edit) canvas_editmode(x, 1); - //if (global_buf == NULL) { - // global_buf = (t_undo_canvas_properties *)getbytes(sizeof(*global_buf)); - //fprintf(stderr,"creating a new buffer for canvas properties\n"); - //} - - /*if ( - global_buf->gl_pixwidth != x->gl_pixwidth || - global_buf->gl_pixheight != x->gl_pixheight || - global_buf->gl_x1 != x->gl_x1 || - global_buf->gl_y1 != x->gl_y1 || - global_buf->gl_x2 != x->gl_x2 || - global_buf->gl_y2 != x->gl_y2 || - global_buf->gl_screenx1 != x->gl_screenx1 || - global_buf->gl_screeny1 != x->gl_screeny1 || - global_buf->gl_screenx2 != x->gl_screenx2 || - global_buf->gl_screeny2 != x->gl_screeny2 || - global_buf->gl_xmargin != x->gl_xmargin || - global_buf->gl_ymargin != x->gl_ymargin || - global_buf->gl_goprect != x->gl_goprect || - global_buf->gl_isgraph != x->gl_isgraph || - global_buf->gl_hidetext != x->gl_hidetext) - {*/ - //fprintf(stderr,"changing values\n"); - global_buf.gl_pixwidth = x->gl_pixwidth; - global_buf.gl_pixheight = x->gl_pixheight; - global_buf.gl_x1 = x->gl_x1; - global_buf.gl_y1 = x->gl_y1; - global_buf.gl_x2 = x->gl_x2; - global_buf.gl_y2 = x->gl_y2; - global_buf.gl_screenx1 = x->gl_screenx1; - global_buf.gl_screeny1 = x->gl_screeny1; - global_buf.gl_screenx2 = x->gl_screenx2; - global_buf.gl_screeny2 = x->gl_screeny2; - global_buf.gl_xmargin = x->gl_xmargin; - global_buf.gl_ymargin = x->gl_ymargin; - global_buf.gl_goprect = x->gl_goprect; - global_buf.gl_isgraph = x->gl_isgraph; - global_buf.gl_hidetext = x->gl_hidetext; - //} + global_buf.gl_pixwidth = x->gl_pixwidth; + global_buf.gl_pixheight = x->gl_pixheight; + global_buf.gl_x1 = x->gl_x1; + global_buf.gl_y1 = x->gl_y1; + global_buf.gl_x2 = x->gl_x2; + global_buf.gl_y2 = x->gl_y2; + global_buf.gl_screenx1 = x->gl_screenx1; + global_buf.gl_screeny1 = x->gl_screeny1; + global_buf.gl_screenx2 = x->gl_screenx2; + global_buf.gl_screeny2 = x->gl_screeny2; + global_buf.gl_xmargin = x->gl_xmargin; + global_buf.gl_ymargin = x->gl_ymargin; + global_buf.gl_goprect = x->gl_goprect; + global_buf.gl_isgraph = x->gl_isgraph; + global_buf.gl_hidetext = x->gl_hidetext; return (&global_buf); } @@ -1232,13 +1206,9 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action) //close properties window first t_int properties = gfxstub_haveproperties((void *)x); if (properties) { - //fprintf(stderr,"have it\n"); sys_vgui("destroy .gfxstub%lx\n", properties); } - //create a temporary data holder - //tmp = (t_undo_canvas_properties *)getbytes(sizeof(*tmp)); - //store current canvas values into temporary data holder tmp.gl_pixwidth = x->gl_pixwidth; tmp.gl_pixheight = x->gl_pixheight; @@ -1290,9 +1260,6 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action) buf->gl_isgraph = tmp.gl_isgraph; buf->gl_hidetext = tmp.gl_hidetext; - //delete temporary data holder - //t_freebytes(tmp, sizeof(*tmp)); - //redraw canvas_setgraph(x, x->gl_isgraph, 0); canvas_dirty(x, 1); @@ -1320,8 +1287,7 @@ static void canvas_undo_canvas_apply(t_canvas *x, void *z, int action) else if (action == UNDO_FREE) { - //fprintf(stderr,"free...\n"); - //if (buf != NULL) t_freebytes(buf, sizeof(*buf)); + //do nothing since undo apply uses a global_buf struct rather than a pointer } } @@ -1354,7 +1320,6 @@ void *canvas_undo_set_create(t_canvas *x) for (y = x->gl_list; y; y = y->g_next) { if (glist_isselected(x, y)) { - //fprintf(stderr,"saving object\n"); gobj_save(y, buf->u_objectbuf); } } diff --git a/src/g_graph.c b/src/g_graph.c index b7d1ed8a7e2c304bfb49a3f91284328753c41e4a..f48b0f114c840ee7c6acbd336ca10e7023eeea05 100644 --- a/src/g_graph.c +++ b/src/g_graph.c @@ -141,12 +141,14 @@ void glist_delete(t_glist *x, t_gobj *y) x->gl_list = NULL; } else for (g = x->gl_list; g; g = g->g_next) - if (g->g_next == y) { - if (y->g_next) - g->g_next = y->g_next; - else g->g_next = NULL; - break; + if (g->g_next == y) + { + if (y->g_next) + g->g_next = y->g_next; + else g->g_next = NULL; + break; + } } gobj_delete(y, x); pd_free(&y->g_pd); diff --git a/src/m_binbuf.c b/src/m_binbuf.c index 9c377cbd40a0e507b0cac8870f7b69319a0132e1..6c7a8af943ad426601c081465b72df21a5e66c6f 100644 --- a/src/m_binbuf.c +++ b/src/m_binbuf.c @@ -60,7 +60,7 @@ void binbuf_clear(t_binbuf *x) /* convert text to a binbuf */ void binbuf_text(t_binbuf *x, char *text, size_t size) { - //fprintf(stderr, "current text: %s ||| %c %c %d %d\n", text, text[size-1], text[size], strlen(text), (int)size); + //fprintf(stderr, "current text: %s || %c %d %d\n", text, text[size-1], strlen(text), (int)size); char buf[MAXPDSTRING+1], *bufp, *ebuf = buf+MAXPDSTRING; const char *textp = text, *etext = text+size; t_atom *ap;