Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30597
Modified Files: Tag: desiredata desire.c Log Message: cleanup; remove pd redraw, canvas map
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.204 retrieving revision 1.1.2.217.2.205 diff -C2 -d -r1.1.2.217.2.204 -r1.1.2.217.2.205 *** desire.c 12 Aug 2007 21:07:59 -0000 1.1.2.217.2.204 --- desire.c 13 Aug 2007 00:01:49 -0000 1.1.2.217.2.205 *************** *** 566,569 **** --- 566,571 ---- }
+ template <class T> void swap(T &a, T &b) {T c=a; a=b; b=c;} + #define CANVAS_DEFGRAPHWIDTH 200 #define CANVAS_DEFGRAPHHEIGHT 140 *************** *** 585,592 **** except that the dialog window would be confusing. The "correct" way is to have "py1" be the value that is higher on the screen. */ ! if (py2 < py1) { ! float zz = y2; y2 = y1; y1 = zz; ! zz = py2; py2 = py1; py1 = zz; ! } if (x1 == x2 || y1 == y2) {x1=0; x2=100; y1=1; y2=-1;} if (px1 >= px2 || py1 >= py2) { --- 587,591 ---- except that the dialog window would be confusing. The "correct" way is to have "py1" be the value that is higher on the screen. */ ! if (py2 < py1) {swap(y1,y2); swap(py1,py2);} if (x1 == x2 || y1 == y2) {x1=0; x2=100; y1=1; y2=-1;} if (px1 >= px2 || py1 >= py2) { *************** *** 595,600 **** } x->name = sym; ! SET(x1,x1); SET(y1,y1); SET(x,(short)px1); SET(pixwidth ,(int)(px2-px1)); ! SET(x2,x2); SET(y2,y2); SET(y,(short)py1); SET(pixheight,(int)(py2-py1)); x->font = (canvas_getcurrent() ? canvas_getcurrent()->font : 42 /*sys_defaultfont*/); x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300; --- 594,599 ---- } x->name = sym; ! SET(x1,x1); SET(y1,y1); SET(x,short(px1)); SET(pixwidth ,int(px2-px1)); ! SET(x2,x2); SET(y2,y2); SET(y,short(py1)); SET(pixheight,int(py2-py1)); x->font = (canvas_getcurrent() ? canvas_getcurrent()->font : 42 /*sys_defaultfont*/); x->screenx1 = x->screeny1 = 0; x->screenx2 = 450; x->screeny2 = 300; *************** *** 619,633 **** static void graph_vis(t_gobj *gr, int vis);
- /* this goes with the question: should gobj_changed(x,0) be recursive on a canvas? - if yes, then canvas_redraw should be merged into gobj_changed. */ static void canvas_redraw(t_canvas *x) { - post("canvas isvisible %d",canvas_isvisible(x)); - if (!canvas_isvisible(x)) return; gobj_changed(x,0); ! canvas_each(y,x) { ! if (y->_class==canvas_class) canvas_redraw((t_canvas *)y); else gobj_changed(y,0); ! } } - extern "C" void glob_redraw () {canvases_each(x) canvas_redraw(x);}
/* This is sent from the GUI to inform a toplevel that its window has been moved or resized. */ --- 618,625 ---- static void graph_vis(t_gobj *gr, int vis);
static void canvas_redraw(t_canvas *x) { gobj_changed(x,0); ! canvas_each(y,x) if (y->_class==canvas_class) canvas_redraw((t_canvas *)y); else gobj_changed(y,0); }
/* This is sent from the GUI to inform a toplevel that its window has been moved or resized. */ *************** *** 654,659 **** /* canvas_map(,1) subscribes the client upon canvas_vis(,1) and unminimizing. canvas_map(,0) unsubscribes the client upon canvas_vis(,0) and minimizing. */ ! void canvas_map(t_canvas *x, t_floatarg f) { ! if (f!=0 && !canvas_isvisible(x)) { gobj_subscribe(x,manager); canvas_redraw(x); /* lazy update implies deleting this */ --- 646,651 ---- /* canvas_map(,1) subscribes the client upon canvas_vis(,1) and unminimizing. canvas_map(,0) unsubscribes the client upon canvas_vis(,0) and minimizing. */ ! void canvas_map(t_canvas *x, bool f) { ! if (f && !canvas_isvisible(x)) { gobj_subscribe(x,manager); canvas_redraw(x); /* lazy update implies deleting this */ *************** *** 665,669 **** } if (f==0 && canvas_isvisible(x)) gobj_unsubscribe(x,manager); ! x->mapped = (unsigned)f; }
--- 657,661 ---- } if (f==0 && canvas_isvisible(x)) gobj_unsubscribe(x,manager); ! x->mapped = f; }
*************** *** 686,692 **** int canvas_isvisible(t_canvas *x) {return !x->loading && canvas_getcanvas(x)->mapped;}
! /* we consider a graph "toplevel" if it has its own window ! or if it appears as a box in its parent window so that we ! don't draw the actual contents there. */ int canvas_istoplevel(t_canvas *x) {return x->havewindow || !x->isgraph;}
--- 678,683 ---- int canvas_isvisible(t_canvas *x) {return !x->loading && canvas_getcanvas(x)->mapped;}
! /* we consider a graph "toplevel" if it has its own window or if it appears as a box in its parent window ! so that we don't draw the actual contents there. */ int canvas_istoplevel(t_canvas *x) {return x->havewindow || !x->isgraph;}
*************** *** 1126,1133 **** SET(isgraph,1); SET(hidetext,!!(flag&2)); ! if (!nogoprect && !x->goprect) { ! canvas_each(g,x) if (pd_checkobject(g)) {SET(goprect,1); break;} ! } ! if (canvas_isvisible(x) && x->goprect) canvas_redraw(x); } } --- 1117,1122 ---- SET(isgraph,1); SET(hidetext,!!(flag&2)); ! if (!nogoprect && !x->goprect) canvas_each(g,x) if (pd_checkobject(g)) {SET(goprect,1); break;} ! if (canvas_isvisible(x) && x->goprect) gobj_changed(x,0); } } *************** *** 1485,1491 **** x->realname = canvas_realizedollar(x->canvas, argname); pd_bind(x,x->realname); ! /* redraw the whole canvas, just so the name change shows up */ ! if (x->canvas->havewindow) canvas_redraw(x->canvas); ! else if (canvas_isvisible(x->canvas->owner)) gobj_changed(x,0); } int size = max(1,int(fsize)); --- 1474,1478 ---- x->realname = canvas_realizedollar(x->canvas, argname); pd_bind(x,x->realname); ! gobj_changed(x,0); } int size = max(1,int(fsize)); *************** *** 2192,2202 **** x->x2 = x->y2 = 1; } ! canvas_redraw(x); }
static void graph_xticks(t_canvas *x, t_floatarg point, t_floatarg inc, t_floatarg f) ! {t_tick *t = &x->xtick; t->point = point; t->inc = inc; t->lperb = (int)f; canvas_redraw(x);} static void graph_yticks(t_canvas *x, t_floatarg point, t_floatarg inc, t_floatarg f) ! {t_tick *t = &x->ytick; t->point = point; t->inc = inc; t->lperb = (int)f; canvas_redraw(x);}
static void graph_xlabel(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { --- 2179,2189 ---- x->x2 = x->y2 = 1; } ! gobj_changed(x,0); }
static void graph_xticks(t_canvas *x, t_floatarg point, t_floatarg inc, t_floatarg f) ! {t_tick *t = &x->xtick; t->point = point; t->inc = inc; t->lperb = (int)f; gobj_changed(x,"xticks");} static void graph_yticks(t_canvas *x, t_floatarg point, t_floatarg inc, t_floatarg f) ! {t_tick *t = &x->ytick; t->point = point; t->inc = inc; t->lperb = (int)f; gobj_changed(x,"yticks");}
static void graph_xlabel(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { *************** *** 2206,2210 **** x->nxlabels = argc; for (int i=0; i < argc; i++) x->xlabel[i] = atom_gensym(&argv[i]); ! canvas_redraw(x); } static void graph_ylabel(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { --- 2193,2197 ---- x->nxlabels = argc; for (int i=0; i < argc; i++) x->xlabel[i] = atom_gensym(&argv[i]); ! gobj_changed(x,"xlabel"); } static void graph_ylabel(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { *************** *** 2214,2218 **** x->nylabels = argc; for (int i=0; i < argc; i++) x->ylabel[i] = atom_gensym(&argv[i]); ! canvas_redraw(x); }
--- 2201,2205 ---- x->nylabels = argc; for (int i=0; i < argc; i++) x->ylabel[i] = atom_gensym(&argv[i]); ! gobj_changed(x,"ylabel"); }
*************** *** 2221,2226 **** if we're a graph when shown on parent, but own our own window right now, our range in our coordinates (x1, etc.) is spread over the visible window size, given by screenx1, etc. ! otherwise, we appear in a graph within a parent canvas, ! so get our screen rectangle on parent and transform. */ static float canvas_pixelstox(t_canvas *x, float xpix) { int x1, y1, x2, y2; float width = x->x2-x->x1; --- 2208,2212 ---- if we're a graph when shown on parent, but own our own window right now, our range in our coordinates (x1, etc.) is spread over the visible window size, given by screenx1, etc. ! otherwise, we appear in a graph within a parent canvas, so get our screen rectangle on parent and transform. */ static float canvas_pixelstox(t_canvas *x, float xpix) { int x1, y1, x2, y2; float width = x->x2-x->x1; *************** *** 6833,6837 **** class_addmethod2(c,canvas_vis,"vis","f"); class_addmethod2(c,canvas_menu_open,"menu-open",""); - class_addmethod2(c,canvas_map,"map","f"); class_addmethod2(c,canvas_clear,"clear",""); class_addcreator2("pd",subcanvas_new,"S"); --- 6819,6822 ---- *************** *** 7278,7282 **** class_addmethod2(c,glob_update_path, "update-path", ""); class_addmethod2(c,glob_help, "help", "s"); - class_addmethod2(c,glob_redraw, "redraw", ""); class_addmethod2(c,glob_object_table,"object_table",""); class_addanything(c, max_default); --- 7263,7266 ----