Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6043
Modified Files: Tag: devel_0_39 desire.c desire.h Log Message: removing some gl_ prefixes
Index: desire.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.h,v retrieving revision 1.1.2.23 retrieving revision 1.1.2.24 diff -C2 -d -r1.1.2.23 -r1.1.2.24 *** desire.h 7 Sep 2006 00:01:51 -0000 1.1.2.23 --- desire.h 7 Sep 2006 00:07:45 -0000 1.1.2.24 *************** *** 101,106 **** int gl_xmargin, gl_ymargin; /* ticks and tick labels */ ! t_tick gl_xtick; int gl_nxlabels; t_symbol **gl_xlabel; float gl_xlabely; ! t_tick gl_ytick; int gl_nylabels; t_symbol **gl_ylabel; float gl_ylabelx; t_editor *gl_editor; /* editor structure when visible */ t_symbol *gl_name; /* symbol bound here */ --- 101,106 ---- int gl_xmargin, gl_ymargin; /* ticks and tick labels */ ! t_tick xtick; int nxlabels; t_symbol **xlabel; float xlabely; ! t_tick ytick; int nylabels; t_symbol **ylabel; float ylabelx; t_editor *gl_editor; /* editor structure when visible */ t_symbol *gl_name; /* symbol bound here */ *************** *** 108,117 **** struct _glist *gl_next; /* link in list of toplevels */ t_canvasenvironment *gl_env; /* for root canvases and abstractions only */ ! unsigned int gl_havewindow:1; /* true if we own a window */ ! unsigned int gl_mapped:1; /* true if, moreover, it's "mapped" */ ! unsigned int gl_loading:1; /* am now loading from file */ ! unsigned int gl_willvis:1; /* make me visible after loading */ ! unsigned int gl_goprect:1; /* draw rectangle for graph-on-parent */ ! unsigned int gl_isgraph:1; /* show as graph on parent */ long gl_next_add; /* insertion point for next call to glist_add (for future use!?) */ }; --- 108,117 ---- struct _glist *gl_next; /* link in list of toplevels */ t_canvasenvironment *gl_env; /* for root canvases and abstractions only */ ! unsigned int havewindow:1; /* true if we own a window */ ! unsigned int mapped:1; /* true if, moreover, it's "mapped" */ ! unsigned int loading:1; /* am now loading from file */ ! unsigned int willvis:1; /* make me visible after loading */ ! unsigned int goprect:1; /* draw rectangle for graph-on-parent */ ! unsigned int isgraph:1; /* show as graph on parent */ long gl_next_add; /* insertion point for next call to glist_add (for future use!?) */ };
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.150 retrieving revision 1.1.2.151 diff -C2 -d -r1.1.2.150 -r1.1.2.151 *** desire.c 7 Sep 2006 00:00:43 -0000 1.1.2.150 --- desire.c 7 Sep 2006 00:07:44 -0000 1.1.2.151 *************** *** 316,320 **** x->gl_next = canvas_list; canvas_list = x; ! if (x->gl_havewindow || x->gl_willvis) { gobj_subscribe((t_gobj *)x,(t_gobj *)manager); gobj_changed(x,0); --- 316,320 ---- x->gl_next = canvas_list; canvas_list = x; ! if (x->havewindow || x->willvis) { gobj_subscribe((t_gobj *)x,(t_gobj *)manager); gobj_changed(x,0); *************** *** 453,458 **** x->gl_stub = gstub_new(x, 0); x->gl_valid = ++glist_valid; ! x->gl_xlabel = (t_symbol **)t_getbytes(0); ! x->gl_ylabel = (t_symbol **)t_getbytes(0); if (hack) { /* only manage this canvas if it's not one of the 3 invisible builtin canvases */ gobj_subscribe((t_gobj *)x,(t_gobj *)manager); --- 453,458 ---- x->gl_stub = gstub_new(x, 0); x->gl_valid = ++glist_valid; ! x->xlabel = (t_symbol **)t_getbytes(0); ! x->ylabel = (t_symbol **)t_getbytes(0); if (hack) { /* only manage this canvas if it's not one of the 3 invisible builtin canvases */ gobj_subscribe((t_gobj *)x,(t_gobj *)manager); *************** *** 507,512 **** if (strcmp(x->gl_name->s_name, "Pd")) pd_bind((t_pd *)x, canvas_makebindsym(x->gl_name)); ! x->gl_loading = 1; ! x->gl_goprect = 0; /* no GOP rectangle unless it's turned on later */ /* cancel "vis" flag if we're a subpatch of an abstraction inside another patch. A separate mechanism prevents --- 507,512 ---- if (strcmp(x->gl_name->s_name, "Pd")) pd_bind((t_pd *)x, canvas_makebindsym(x->gl_name)); ! x->loading = 1; ! x->goprect = 0; /* no GOP rectangle unless it's turned on later */ /* cancel "vis" flag if we're a subpatch of an abstraction inside another patch. A separate mechanism prevents *************** *** 517,521 **** if (zzz && canvas_isabstraction(zzz) && zzz->gl_owner) vis = 0; } ! x->gl_willvis = vis; x->gl_font = sys_nearestfontsize(font); pd_pushsym((t_pd *)x); --- 517,521 ---- if (zzz && canvas_isabstraction(zzz) && zzz->gl_owner) vis = 0; } ! x->willvis = vis; x->gl_font = sys_nearestfontsize(font); pd_pushsym((t_pd *)x); *************** *** 580,585 **** if (strcmp(x->gl_name->s_name, "Pd")) pd_bind((t_pd *)x, canvas_makebindsym(x->gl_name)); x->gl_owner = g; ! x->gl_isgraph = 1; ! x->gl_goprect = 0; x->gl_obj.te_binbuf = binbuf_new(); binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph")); --- 580,585 ---- if (strcmp(x->gl_name->s_name, "Pd")) pd_bind((t_pd *)x, canvas_makebindsym(x->gl_name)); x->gl_owner = g; ! x->isgraph = 1; ! x->goprect = 0; x->gl_obj.te_binbuf = binbuf_new(); binbuf_addv(x->gl_obj.te_binbuf, "s", gensym("graph")); *************** *** 610,614 **** x->gl_screenx2 = x2; x->gl_screeny2 = y2; ! if (!x->gl_isgraph && (x->gl_y2 < x->gl_y1)) { /* if it's flipped so that y grows upward, fix so that zero is bottom edge and redraw. This is --- 610,614 ---- x->gl_screenx2 = x2; x->gl_screeny2 = y2; ! if (!x->isgraph && (x->gl_y2 < x->gl_y1)) { /* if it's flipped so that y grows upward, fix so that zero is bottom edge and redraw. This is *************** *** 641,653 **** void canvas_map(t_canvas *x, t_floatarg f) { if (f!=0 && !glist_isvisible(x)) { ! x->gl_mapped = 1; t_gobj *y; ! if (!x->gl_havewindow) {bug("canvas_map"); canvas_vis(x,1);} glist_each(y,x) gobj_changed(y,0); canvas_drawlines(x); ! if (x->gl_isgraph && x->gl_goprect) canvas_drawredrect(x, 1); } if (f==0 && glist_isvisible(x)) { ! x->gl_mapped = 0; gobj_unsubscribe((t_gobj *)x,(t_gobj *)manager); } --- 641,653 ---- void canvas_map(t_canvas *x, t_floatarg f) { if (f!=0 && !glist_isvisible(x)) { ! x->mapped = 1; t_gobj *y; ! if (!x->havewindow) {bug("canvas_map"); canvas_vis(x,1);} glist_each(y,x) gobj_changed(y,0); canvas_drawlines(x); ! if (x->isgraph && x->goprect) canvas_drawredrect(x, 1); } if (f==0 && glist_isvisible(x)) { ! x->mapped = 0; gobj_unsubscribe((t_gobj *)x,(t_gobj *)manager); } *************** *** 658,662 **** glists_each(x,canvas_list) { canvas_redraw(x); ! x->gl_mapped=0; canvas_map(x,1); } --- 658,662 ---- glists_each(x,canvas_list) { canvas_redraw(x); ! x->mapped=0; canvas_map(x,1); } *************** *** 701,705 **** } glist_each(y,x) { ! if (pd_class(&y->g_pd) == canvas_class && ((t_canvas *)y)->gl_isgraph) canvas_create_editor((t_canvas *)y, createit); } --- 701,705 ---- } glist_each(y,x) { ! if (pd_class(&y->g_pd) == canvas_class && ((t_canvas *)y)->isgraph) canvas_create_editor((t_canvas *)y, createit); } *************** *** 712,716 **** if (f && !x->gl_editor) { canvas_create_editor(x, 1); ! x->gl_havewindow = 1; gobj_subscribe((t_gobj *)x,(t_gobj *)manager); gobj_changed(x,0); --- 712,716 ---- if (f && !x->gl_editor) { canvas_create_editor(x, 1); ! x->havewindow = 1; gobj_subscribe((t_gobj *)x,(t_gobj *)manager); gobj_changed(x,0); *************** *** 721,729 **** if (glist_isvisible(x)) canvas_map(x, 0); /* if we're a graph on our parent and the parent exists and is visible, show ourselves on parent. */ ! if (x->gl_isgraph && x->gl_owner) { canvas_create_editor(x, 1); ! x->gl_havewindow = 0; } else { ! x->gl_havewindow = 0; } } --- 721,729 ---- if (glist_isvisible(x)) canvas_map(x, 0); /* if we're a graph on our parent and the parent exists and is visible, show ourselves on parent. */ ! if (x->isgraph && x->gl_owner) { canvas_create_editor(x, 1); ! x->havewindow = 0; } else { ! x->havewindow = 0; } } *************** *** 738,742 **** else { canvas_create_editor(x,0); ! x->gl_havewindow = 1; gobj_changed(x,0); } --- 738,742 ---- else { canvas_create_editor(x,0); ! x->havewindow = 1; gobj_changed(x,0); } *************** *** 745,754 **** }
! int glist_isvisible(t_glist *x) {return !x->gl_loading && glist_getcanvas(x)->gl_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 glist_istoplevel(t_glist *x) {return x->gl_havewindow || !x->gl_isgraph;}
static int glist_getfont(t_glist *x) { --- 745,754 ---- }
! int glist_isvisible(t_glist *x) {return !x->loading && glist_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 glist_istoplevel(t_glist *x) {return x->havewindow || !x->isgraph;}
static int glist_getfont(t_glist *x) { *************** *** 771,776 **** } canvas_resume_dsp(dspstate); ! freebytes(x->gl_xlabel, x->gl_nxlabels * sizeof(*(x->gl_xlabel))); ! freebytes(x->gl_ylabel, x->gl_nylabels * sizeof(*(x->gl_ylabel))); gstub_cutoff(x->gl_stub); gfxstub_deleteforkey(x); /* probably unnecessary */ --- 771,776 ---- } canvas_resume_dsp(dspstate); ! freebytes(x->xlabel, x->nxlabels * sizeof(*(x->xlabel))); ! freebytes(x->ylabel, x->nylabels * sizeof(*(x->ylabel))); gstub_cutoff(x->gl_stub); gfxstub_deleteforkey(x); /* probably unnecessary */ *************** *** 809,813 **** canvas_resortinlets(x); canvas_resortoutlets(x); ! x->gl_loading = 0; }
--- 809,813 ---- canvas_resortinlets(x); canvas_resortoutlets(x); ! x->loading = 0; }
*************** *** 838,842 **** canvas_rename(x, argv[3].a_w.w_symbol, 0); } ! canvas_pop(x, x->gl_willvis); z = gensym("#X")->s_thing; if (!z) error("canvas_restore: out of context"); --- 838,842 ---- canvas_rename(x, argv[3].a_w.w_symbol, 0); } ! canvas_pop(x, x->willvis); z = gensym("#X")->s_thing; if (!z) error("canvas_restore: out of context"); *************** *** 904,908 **** newest = (t_pd *)x; pd_popsym((t_pd *)x); ! x->gl_loading = 0; canvas_resortinlets(x); canvas_resortoutlets(x); --- 904,908 ---- newest = (t_pd *)x; pd_popsym((t_pd *)x); ! x->loading = 0; canvas_resortinlets(x); canvas_resortoutlets(x); *************** *** 1238,1242 **** do g = g->g_next in this case. */ int j = glist_getindex(gl, g); ! int hadwindow = gl->gl_havewindow; if (!hadwindow) canvas_vis(glist_getcanvas(gl), 1); g = glist_nth(gl, j); --- 1238,1242 ---- do g = g->g_next in this case. */ int j = glist_getindex(gl, g); ! int hadwindow = gl->havewindow; if (!hadwindow) canvas_vis(glist_getcanvas(gl), 1); g = glist_nth(gl, j); *************** *** 1276,1294 **** any missing paramters and redraw things if necessary. */ void canvas_setgraph(t_glist *x, int flag, int nogoprect) { ! if (!flag && x->gl_isgraph) { ! x->gl_isgraph = 0; ! } else if (flag && !x->gl_isgraph) { if (x->gl_pixwidth <= 0) x->gl_pixwidth = GLIST_DEFGRAPHWIDTH; if (x->gl_pixheight <= 0) x->gl_pixheight = GLIST_DEFGRAPHHEIGHT; ! x->gl_isgraph = 1; ! if (!nogoprect && !x->gl_goprect) { t_gobj *g; glist_each(g,x) if (pd_checkobject(&g->g_pd)) { ! x->gl_goprect = 1; break; } } ! if (glist_isvisible(x) && x->gl_goprect) glist_redraw(x); ! if (x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner)) canvas_create_editor(x, 1); } } --- 1276,1294 ---- any missing paramters and redraw things if necessary. */ void canvas_setgraph(t_glist *x, int flag, int nogoprect) { ! if (!flag && x->isgraph) { ! x->isgraph = 0; ! } else if (flag && !x->isgraph) { if (x->gl_pixwidth <= 0) x->gl_pixwidth = GLIST_DEFGRAPHWIDTH; if (x->gl_pixheight <= 0) x->gl_pixheight = GLIST_DEFGRAPHHEIGHT; ! x->isgraph = 1; ! if (!nogoprect && !x->goprect) { t_gobj *g; glist_each(g,x) if (pd_checkobject(&g->g_pd)) { ! x->goprect = 1; break; } } ! if (glist_isvisible(x) && x->goprect) glist_redraw(x); ! if (x->loading && x->gl_owner && glist_isvisible(x->gl_owner)) canvas_create_editor(x, 1); } } *************** *** 1846,1850 **** pd_bind(&x->x_gobj.g_pd, x->x_realname); /* redraw the whole glist, just so the name change shows up */ ! if (x->x_glist->gl_havewindow) canvas_redraw(x->x_glist); else if (glist_isvisible(x->x_glist->gl_owner)) gobj_changed(x,0); } --- 1846,1850 ---- pd_bind(&x->x_gobj.g_pd, x->x_realname); /* redraw the whole glist, just so the name change shows up */ ! if (x->x_glist->havewindow) canvas_redraw(x->x_glist); else if (glist_isvisible(x->x_glist->gl_owner)) gobj_changed(x,0); } *************** *** 2572,2577 **** /* voodoo */ /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */ ! if (x->gl_editor && x->gl_isgraph && !x->gl_goprect && pd_checkobject(&y->g_pd)) { ! x->gl_goprect = 1; canvas_drawredrect(x, 1); } --- 2572,2577 ---- /* voodoo */ /* if (x->gl_editor && (ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); */ ! if (x->gl_editor && x->isgraph && !x->goprect && pd_checkobject(&y->g_pd)) { ! x->goprect = 1; canvas_drawredrect(x, 1); } *************** *** 2626,2630 ****
t_canvas *glist_getcanvas(t_glist *x) { ! while (x->gl_owner && !x->gl_havewindow && x->gl_isgraph) x = x->gl_owner; return x; } --- 2626,2630 ----
t_canvas *glist_getcanvas(t_glist *x) { ! while (x->gl_owner && !x->havewindow && x->isgraph) x = x->gl_owner; return x; } *************** *** 2693,2697 **** t_inlet *ip = inlet_new(&x->gl_obj, who, s, 0); inlet_settip(ip,h); ! if (!x->gl_loading) canvas_resortinlets(x); gobj_changed(x,0); return ip; --- 2693,2697 ---- t_inlet *ip = inlet_new(&x->gl_obj, who, s, 0); inlet_settip(ip,h); ! if (!x->loading) canvas_resortinlets(x); gobj_changed(x,0); return ip; *************** *** 2737,2741 **** static t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s) { t_outlet *op = outlet_new(&x->gl_obj, s); ! if (!x->gl_loading) canvas_resortoutlets(x); gobj_changed(x,0); return op; --- 2737,2741 ---- static t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s) { t_outlet *op = outlet_new(&x->gl_obj, s); ! if (!x->loading) canvas_resortoutlets(x); gobj_changed(x,0); return op; *************** *** 2796,2805 ****
static void graph_xticks(t_glist *x, t_floatarg point, t_floatarg inc, t_floatarg f) { ! t_tick *t = &x->gl_xtick; t->point = point; t->inc = inc; t->lperb = f; glist_redraw(x); } static void graph_yticks(t_glist *x, t_floatarg point, t_floatarg inc, t_floatarg f) { ! t_tick *t = &x->gl_ytick; t->point = point; t->inc = inc; t->lperb = f; glist_redraw(x); --- 2796,2805 ----
static void graph_xticks(t_glist *x, t_floatarg point, t_floatarg inc, t_floatarg f) { ! t_tick *t = &x->xtick; t->point = point; t->inc = inc; t->lperb = f; glist_redraw(x); } static void graph_yticks(t_glist *x, t_floatarg point, t_floatarg inc, t_floatarg f) { ! t_tick *t = &x->ytick; t->point = point; t->inc = inc; t->lperb = f; glist_redraw(x); *************** *** 2809,2818 **** int i; if (argc < 1) {pd_error(x,"graph_xlabel: no y value given"); return;} ! x->gl_xlabely = atom_getfloat(argv); argv++; argc--; ! x->gl_xlabel = (t_symbol **)t_resizebytes(x->gl_xlabel, ! x->gl_nxlabels*sizeof(t_symbol *), argc*sizeof(t_symbol *)); ! x->gl_nxlabels = argc; ! for (i = 0; i < argc; i++) x->gl_xlabel[i] = atom_gensym(&argv[i]); glist_redraw(x); } --- 2809,2818 ---- int i; if (argc < 1) {pd_error(x,"graph_xlabel: no y value given"); return;} ! x->xlabely = atom_getfloat(argv); argv++; argc--; ! x->xlabel = (t_symbol **)t_resizebytes(x->xlabel, ! x->nxlabels*sizeof(t_symbol *), argc*sizeof(t_symbol *)); ! x->nxlabels = argc; ! for (i = 0; i < argc; i++) x->xlabel[i] = atom_gensym(&argv[i]); glist_redraw(x); } *************** *** 2821,2830 **** int i; if (argc < 1) {pd_error(x,"graph_ylabel: no x value given"); return;} ! x->gl_ylabelx = atom_getfloat(argv); argv++; argc--; ! x->gl_ylabel = (t_symbol **)t_resizebytes(x->gl_ylabel, ! x->gl_nylabels*sizeof(t_symbol *), argc*sizeof(t_symbol *)); ! x->gl_nylabels = argc; ! for (i = 0; i < argc; i++) x->gl_ylabel[i] = atom_gensym(&argv[i]); glist_redraw(x); } --- 2821,2830 ---- int i; if (argc < 1) {pd_error(x,"graph_ylabel: no x value given"); return;} ! x->ylabelx = atom_getfloat(argv); argv++; argc--; ! x->ylabel = (t_symbol **)t_resizebytes(x->ylabel, ! x->nylabels*sizeof(t_symbol *), argc*sizeof(t_symbol *)); ! x->nylabels = argc; ! for (i = 0; i < argc; i++) x->ylabel[i] = atom_gensym(&argv[i]); glist_redraw(x); } *************** *** 2845,2850 **** int x1, y1, x2, y2; float width = x->gl_x2-x->gl_x1; ! if (!x->gl_isgraph) return x->gl_x1 + width * xpix; ! if (x->gl_havewindow) return x->gl_x1 + width * xpix / (x->gl_screenx2-x->gl_screenx1); if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); --- 2845,2850 ---- int x1, y1, x2, y2; float width = x->gl_x2-x->gl_x1; ! if (!x->isgraph) return x->gl_x1 + width * xpix; ! if (x->havewindow) return x->gl_x1 + width * xpix / (x->gl_screenx2-x->gl_screenx1); if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); *************** *** 2854,2859 **** int x1, y1, x2, y2; float height = x->gl_y2-x->gl_y1; ! if (!x->gl_isgraph) return x->gl_y1 + height * ypix; ! if (x->gl_havewindow) return x->gl_y1 + height * ypix / (x->gl_screeny2-x->gl_screeny1); if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); --- 2854,2859 ---- int x1, y1, x2, y2; float height = x->gl_y2-x->gl_y1; ! if (!x->isgraph) return x->gl_y1 + height * ypix; ! if (x->havewindow) return x->gl_y1 + height * ypix / (x->gl_screeny2-x->gl_screeny1); if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); *************** *** 2865,2870 **** int x1, y1, x2, y2; float width = x->gl_x2-x->gl_x1; ! if (!x->gl_isgraph) return (xval - x->gl_x1) / width; ! if (x->gl_havewindow) return (x->gl_screenx2-x->gl_screenx1) * (xval-x->gl_x1) / width; if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); --- 2865,2870 ---- int x1, y1, x2, y2; float width = x->gl_x2-x->gl_x1; ! if (!x->isgraph) return (xval - x->gl_x1) / width; ! if (x->havewindow) return (x->gl_screenx2-x->gl_screenx1) * (xval-x->gl_x1) / width; if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); *************** *** 2874,2879 **** int x1, y1, x2, y2; float height = x->gl_y2-x->gl_y1; ! if (!x->gl_isgraph) return (yval - x->gl_y1) / height; ! if (x->gl_havewindow) return (x->gl_screeny2-x->gl_screeny1) * (yval-x->gl_y1) / height; if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); --- 2874,2879 ---- int x1, y1, x2, y2; float height = x->gl_y2-x->gl_y1; ! if (!x->isgraph) return (yval - x->gl_y1) / height; ! if (x->havewindow) return (x->gl_screeny2-x->gl_screeny1) * (yval-x->gl_y1) / height; if (!x->gl_owner) bug("glist_pixelstox"); graph_graphrect((t_gobj *)x, x->gl_owner, &x1, &y1, &x2, &y2); *************** *** 2884,2898 **** object's x and y positions are in pixels when the glist they're in is toplevel. Otherwise, if it's a new-style graph-on-parent ! (so gl_goprect is set) we use the offset into the framing subrectangle as an offset into the parent rectangle. Finally, it might be an old, proportional-style GOP. In this case we do a coordinate transformation. */ static int text_xpix(t_text *x, t_glist *glist) { ! if (glist->gl_havewindow || !glist->gl_isgraph) return x->te_xpix; ! if (glist->gl_goprect) return glist->gl_obj.te_xpix + x->te_xpix - glist->gl_xmargin; return glist_xtopixels(glist, glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)); } static int text_ypix(t_text *x, t_glist *glist) { ! if (glist->gl_havewindow || !glist->gl_isgraph) return x->te_ypix; ! if (glist->gl_goprect) return glist->gl_obj.te_ypix + x->te_ypix - glist->gl_ymargin; return glist_ytopixels(glist, glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)); } --- 2884,2898 ---- object's x and y positions are in pixels when the glist they're in is toplevel. Otherwise, if it's a new-style graph-on-parent ! (so goprect is set) we use the offset into the framing subrectangle as an offset into the parent rectangle. Finally, it might be an old, proportional-style GOP. In this case we do a coordinate transformation. */ static int text_xpix(t_text *x, t_glist *glist) { ! if (glist->havewindow || !glist->isgraph) return x->te_xpix; ! if (glist->goprect) return glist->gl_obj.te_xpix + x->te_xpix - glist->gl_xmargin; return glist_xtopixels(glist, glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) * x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)); } static int text_ypix(t_text *x, t_glist *glist) { ! if (glist->havewindow || !glist->isgraph) return x->te_ypix; ! if (glist->goprect) return glist->gl_obj.te_ypix + x->te_ypix - glist->gl_ymargin; return glist_ytopixels(glist, glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) * x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)); } *************** *** 2907,2911 **** glist_each(g,x) gobj_changed(x,0); canvas_drawredrect(x, 0); ! if (x->gl_goprect) canvas_drawredrect(x, 1); } if (x->gl_owner && glist_isvisible(x->gl_owner)) { --- 2907,2911 ---- glist_each(g,x) gobj_changed(x,0); canvas_drawredrect(x, 0); ! if (x->goprect) canvas_drawredrect(x, 1); } if (x->gl_owner && glist_isvisible(x->gl_owner)) { *************** *** 2939,2943 **** /* if we look like a graph but have been moved to a toplevel, just show the bounding rectangle */ ! if (x->gl_havewindow) { if (vis) sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -tags %s -fill #c0c0c0\n", (long)c, x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag); --- 2939,2943 ---- /* if we look like a graph but have been moved to a toplevel, just show the bounding rectangle */ ! if (x->havewindow) { if (vis) sys_vgui(".x%lx.c create polygon %d %d %d %d %d %d %d %d %d %d -tags %s -fill #c0c0c0\n", (long)c, x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag); *************** *** 2964,2980 **** } /* draw ticks on horizontal borders. If lperb field is zero, this is disabled. */ ! if (x->gl_xtick.lperb) { float upix, lpix; if (y2 < y1) upix = y1, lpix = y2; else upix = y2, lpix = y1; ! for (i=0,f=x->gl_xtick.point; f<0.99*x->gl_x2+0.01*x->gl_x1; i++, f+=x->gl_xtick.inc) { ! int tickpix = i%x->gl_xtick.lperb ? 2 : 4; int x0 = glist_xtopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)upix, x0, (int)(upix-tickpix), tag); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)lpix, x0, (int)(lpix+tickpix), tag); } ! for (i=1,f=x->gl_xtick.point-x->gl_xtick.inc; f>0.99*x->gl_x1+0.01*x->gl_x2; i++,f-=x->gl_xtick.inc) { ! int tickpix = i%x->gl_xtick.lperb ? 2 : 4; int x0 = glist_xtopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)upix, x0, (int)(upix-tickpix), tag); --- 2964,2980 ---- } /* draw ticks on horizontal borders. If lperb field is zero, this is disabled. */ ! if (x->xtick.lperb) { float upix, lpix; if (y2 < y1) upix = y1, lpix = y2; else upix = y2, lpix = y1; ! for (i=0,f=x->xtick.point; f<0.99*x->gl_x2+0.01*x->gl_x1; i++, f+=x->xtick.inc) { ! int tickpix = i%x->xtick.lperb ? 2 : 4; int x0 = glist_xtopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)upix, x0, (int)(upix-tickpix), tag); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)lpix, x0, (int)(lpix+tickpix), tag); } ! for (i=1,f=x->xtick.point-x->xtick.inc; f>0.99*x->gl_x1+0.01*x->gl_x2; i++,f-=x->xtick.inc) { ! int tickpix = i%x->xtick.lperb ? 2 : 4; int x0 = glist_xtopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x0, (int)upix, x0, (int)(upix-tickpix), tag); *************** *** 2984,3000 ****
/* draw ticks in vertical borders*/ ! if (x->gl_ytick.lperb) { float ubound, lbound; if (x->gl_y2 < x->gl_y1) ubound = x->gl_y1, lbound = x->gl_y2; else ubound = x->gl_y2, lbound = x->gl_y1; ! for (i=0,f=x->gl_ytick.point; f<0.99*ubound+0.01*lbound; i++, f += x->gl_ytick.inc) { ! int tickpix = i%x->gl_ytick.lperb ? 2 : 4; int y0 = (int)glist_ytopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x1, y0, x1+tickpix, y0, tag); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x2, y0, x2-tickpix, y0, tag); } ! for (i=1,f=x->gl_ytick.point-x->gl_ytick.inc; f>0.99*lbound+0.01*ubound; i++,f-=x->gl_ytick.inc) { ! int tickpix = i%x->gl_ytick.lperb ? 2 : 4; int y0 = (int)glist_ytopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x1, y0, x1+tickpix, y0, tag); --- 2984,3000 ----
/* draw ticks in vertical borders*/ ! if (x->ytick.lperb) { float ubound, lbound; if (x->gl_y2 < x->gl_y1) ubound = x->gl_y1, lbound = x->gl_y2; else ubound = x->gl_y2, lbound = x->gl_y1; ! for (i=0,f=x->ytick.point; f<0.99*ubound+0.01*lbound; i++, f += x->ytick.inc) { ! int tickpix = i%x->ytick.lperb ? 2 : 4; int y0 = (int)glist_ytopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x1, y0, x1+tickpix, y0, tag); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x2, y0, x2-tickpix, y0, tag); } ! for (i=1,f=x->ytick.point-x->ytick.inc; f>0.99*lbound+0.01*ubound; i++,f-=x->ytick.inc) { ! int tickpix = i%x->ytick.lperb ? 2 : 4; int y0 = (int)glist_ytopixels(x, f); sys_vgui(".x%lx.c create line %d %d %d %d -tags %s\n", (long)c, x1, y0, x1+tickpix, y0, tag); *************** *** 3003,3019 **** } /* draw x labels */ ! for (i = 0; i < x->gl_nxlabels; i++) sys_vgui(".x%lx.c create text %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", (long)glist_getcanvas(x), ! (int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)), ! (int)glist_ytopixels(x, x->gl_xlabely), x->gl_xlabel[i]->s_name, glist_getfont(x), tag); /* draw y labels */ ! for (i = 0; i < x->gl_nylabels; i++) sys_vgui(".x%lx.c create text %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", (long)glist_getcanvas(x), ! (int)glist_xtopixels(x, x->gl_ylabelx), ! (int)glist_ytopixels(x, atof(x->gl_ylabel[i]->s_name)), ! x->gl_ylabel[i]->s_name, glist_getfont(x), tag); /* draw contents of graph as glist */ --- 3003,3019 ---- } /* draw x labels */ ! for (i = 0; i < x->nxlabels; i++) sys_vgui(".x%lx.c create text %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", (long)glist_getcanvas(x), ! (int)glist_xtopixels(x, atof(x->xlabel[i]->s_name)), ! (int)glist_ytopixels(x, x->xlabely), x->xlabel[i]->s_name, glist_getfont(x), tag); /* draw y labels */ ! for (i = 0; i < x->nylabels; i++) sys_vgui(".x%lx.c create text %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", (long)glist_getcanvas(x), ! (int)glist_xtopixels(x, x->ylabelx), ! (int)glist_ytopixels(x, atof(x->ylabel[i]->s_name)), ! x->ylabel[i]->s_name, glist_getfont(x), tag); /* draw contents of graph as glist */ *************** *** 3067,3071 **** t_gobj *y = 0, *z; for (z = x->gl_list; z; z = z->g_next) ! if (pd_class(&z->g_pd) == canvas_class && ((t_glist *)z)->gl_isgraph) y = z; return (t_glist *)y; --- 3067,3071 ---- t_gobj *y = 0, *z; for (z = x->gl_list; z; z = z->g_next) ! if (pd_class(&z->g_pd) == canvas_class && ((t_glist *)z)->isgraph) y = z; return (t_glist *)y; *************** *** 3243,3247 **** if (wasvis) { /* temporarily lie about vis flag while this is built */ ! glist_getcanvas(x)->gl_mapped = 0; } glist_add(x, &sc->sc_gobj); --- 3243,3247 ---- if (wasvis) { /* temporarily lie about vis flag while this is built */ ! glist_getcanvas(x)->mapped = 0; } glist_add(x, &sc->sc_gobj); *************** *** 3250,3254 **** if (wasvis) { /* reset vis flag as before */ ! glist_getcanvas(x)->gl_mapped = 1; gobj_changed(&sc->sc_gobj,0); } --- 3250,3254 ---- if (wasvis) { /* reset vis flag as before */ ! glist_getcanvas(x)->mapped = 1; gobj_changed(&sc->sc_gobj,0); } *************** *** 3557,3561 **** if (x->gl_owner && !x->gl_env) { binbuf_addv(b, "ssiiiisi;", gensym("#N"), gensym("canvas"), x1, y1, xs, ys, ! *x->gl_name->s_name?x->gl_name:gensym("(subpatch)"), x->gl_mapped); } else { /* root or abstraction */ --- 3557,3561 ---- if (x->gl_owner && !x->gl_env) { binbuf_addv(b, "ssiiiisi;", gensym("#N"), gensym("canvas"), x1, y1, xs, ys, ! *x->gl_name->s_name?x->gl_name:gensym("(subpatch)"), x->mapped); } else { /* root or abstraction */ *************** *** 3568,3572 **** /* unless everything is the default (as in ordinary subpatches) print out a "coords" message to set up the coordinate systems */ ! /*if (!x->gl_isgraph && x->gl_x1==0 && x->gl_y1==0 && x->gl_x2==1 && x->gl_y2==1 && x->gl_pixwidth==0 && x->gl_pixheight==0) return;*/
--- 3568,3572 ---- /* unless everything is the default (as in ordinary subpatches) print out a "coords" message to set up the coordinate systems */ ! /*if (!x->isgraph && x->gl_x1==0 && x->gl_y1==0 && x->gl_x2==1 && x->gl_y2==1 && x->gl_pixwidth==0 && x->gl_pixheight==0) return;*/
*************** *** 3576,3581 **** binbuf_addv(b, "ssfffffff", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, (float)x->gl_pixwidth, (float)x->gl_pixheight, ! x->gl_isgraph); ! if (x->gl_goprect) binbuf_addv(b, "ff", (float)x->gl_xmargin, (float)x->gl_ymargin); binbuf_addv(b,";"); } --- 3576,3581 ---- binbuf_addv(b, "ssfffffff", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, (float)x->gl_pixwidth, (float)x->gl_pixheight, ! x->isgraph); ! if (x->goprect) binbuf_addv(b, "ff", (float)x->gl_xmargin, (float)x->gl_ymargin); binbuf_addv(b,";"); }