aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/g_canvas.c42
-rw-r--r--pd/src/g_canvas.h4
-rw-r--r--pd/src/g_editor.c127
-rw-r--r--pd/src/g_graph.c122
-rw-r--r--pd/src/g_readwrite.c14
-rw-r--r--pd/src/g_rtext.c17
-rw-r--r--pd/src/g_template.c3
-rw-r--r--pd/src/g_text.c7
-rw-r--r--pd/src/makefile.nt8
-rw-r--r--pd/src/notes.txt19
-rw-r--r--pd/src/u_main.tk326
11 files changed, 405 insertions, 284 deletions
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 2607c1b2..ba72f8bc 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -14,6 +14,7 @@ to be different but are now unified except for some fossilized names.) */
#include <string.h>
#include "g_all_guis.h"
+ /* LATER consider adding font size to this struct (see glist_getfont()) */
struct _canvasenvironment
{
t_symbol *ce_dir; /* directory patch lives in */
@@ -401,6 +402,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
if (strcmp(x->gl_name->s_name, "Pd"))
pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
x->gl_loading = 1;
+ x->gl_goprect = 0; /* no GOP rectangle unless it's turned on later */
x->gl_willvis = vis;
x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8);
x->gl_font = sys_nearestfontsize(font);
@@ -408,7 +410,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
return(x);
}
-void canvas_setgraph(t_glist *x, int flag);
+void canvas_setgraph(t_glist *x, int flag, int nogoprect);
static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
{
@@ -418,7 +420,14 @@ static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv)
x->gl_y2 = atom_getfloatarg(3, argc, argv);
x->gl_pixwidth = atom_getintarg(4, argc, argv);
x->gl_pixheight = atom_getintarg(5, argc, argv);
- canvas_setgraph(x, atom_getintarg(6, argc, argv));
+ if (argc <= 7)
+ canvas_setgraph(x, atom_getintarg(6, argc, argv), 1);
+ else
+ {
+ x->gl_xmargin = atom_getintarg(7, argc, argv);
+ x->gl_ymargin = atom_getintarg(8, argc, argv);
+ canvas_setgraph(x, atom_getintarg(6, argc, argv), 0);
+ }
}
/* make a new glist and add it to this glist. It will appear as
@@ -480,8 +489,8 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym,
if (strcmp(x->gl_name->s_name, "Pd"))
pd_bind(&x->gl_pd, canvas_makebindsym(x->gl_name));
x->gl_owner = g;
- x->gl_stretch = 1;
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"));
if (!menu)
@@ -589,6 +598,20 @@ void canvas_dirty(t_canvas *x, t_int n)
}
}
+void canvas_drawredrect(t_canvas *x, int doit)
+{
+ if (doit)
+ sys_vgui(".x%lx.c create line\
+ %d %d %d %d %d %d %d %d %d %d -fill #ff8080 -tags GOP\n",
+ glist_getcanvas(x),
+ x->gl_xmargin, x->gl_ymargin,
+ x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin,
+ x->gl_xmargin + x->gl_pixwidth, x->gl_ymargin + x->gl_pixheight,
+ x->gl_xmargin, x->gl_ymargin + x->gl_pixheight,
+ x->gl_xmargin, x->gl_ymargin);
+ else sys_vgui(".x%lx.c delete GOP\n", glist_getcanvas(x));
+}
+
/* the window becomes "mapped" (visible and not miniaturized) or
"unmapped" (either miniaturized or just plain gone.) This should be
called from the GUI after the fact to "notify" us that we're mapped. */
@@ -612,6 +635,8 @@ void canvas_map(t_canvas *x, t_floatarg f)
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);
}
}
@@ -621,11 +646,13 @@ void canvas_map(t_canvas *x, t_floatarg f)
{
/* just clear out the whole canvas... */
sys_vgui(".x%lx.c delete all\n", x);
+#if 0
/* alternatively, we could have erased them one by one...
for (y = x->gl_list; y; y = y->g_next)
gobj_vis(y, x, 0);
... but we should go through and erase the lines as well
if we do it that way. */
+#endif
x->gl_mapped = 0;
}
}
@@ -816,7 +843,10 @@ int glist_istoplevel(t_glist *x)
int glist_getfont(t_glist *x)
{
- return (glist_getcanvas(x)->gl_font);
+ while (!x->gl_env)
+ if (!(x = x->gl_owner))
+ bug("t_canvasenvironment");
+ return (x->gl_font);
}
void canvas_free(t_canvas *x)
@@ -1413,7 +1443,7 @@ extern void glist_scalar(t_glist *canvas, t_symbol *s, int argc, t_atom *argv);
void g_graph_setup(void);
void g_editor_setup(void);
void g_readwrite_setup(void);
-extern void graph_properties(t_gobj *z, t_glist *owner);
+extern void canvas_properties(t_gobj *z);
void g_canvas_setup(void)
{
@@ -1484,7 +1514,7 @@ void g_canvas_setup(void)
gensym("menu-open"), A_NULL);
class_addmethod(canvas_class, (t_method)canvas_map,
gensym("map"), A_FLOAT, A_NULL);
- class_setpropertiesfn(canvas_class, graph_properties);
+ class_setpropertiesfn(canvas_class, (t_propertiesfn)canvas_properties);
/* ---------------------- list handling ------------------------ */
class_addmethod(canvas_class, (t_method)glist_clear, gensym("clear"),
diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h
index 188117bc..a2322822 100644
--- a/pd/src/g_canvas.h
+++ b/pd/src/g_canvas.h
@@ -158,6 +158,8 @@ struct _glist
int gl_screeny1;
int gl_screenx2;
int gl_screeny2;
+ int gl_xmargin; /* origin for GOP rectangle */
+ int gl_ymargin;
t_tick gl_xtick; /* ticks marking X values */
int gl_nxlabels; /* number of X coordinate labels */
t_symbol **gl_xlabel; /* ... an array to hold them */
@@ -178,7 +180,7 @@ struct _glist
unsigned int gl_willvis:1; /* make me visible after loading */
unsigned int gl_edit:1; /* edit mode */
unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
- unsigned int gl_stretch:1; /* stretch contents on resize */
+ unsigned int gl_goprect:1; /* draw rectangle for graph-on-parent */
unsigned int gl_isgraph:1; /* show as graph on parent */
};
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 82e43acc..fbf0097a 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -64,7 +64,25 @@ void gobj_delete(t_gobj *x, t_glist *glist)
void gobj_vis(t_gobj *x, struct _glist *glist, int flag)
{
if (x->g_pd->c_wb && x->g_pd->c_wb->w_visfn)
+ {
+ if (!glist->gl_havewindow && glist->gl_isgraph && glist->gl_goprect &&
+ glist->gl_owner && (pd_class(&glist->gl_pd) != garray_class))
+ {
+ /* if we're graphing-on-parent and the object falls outside the
+ graph rectangle, don't draw it. */
+ int x1, y1, x2, y2, gx1, gy1, gx2, gy2, m;
+ gobj_getrect(&glist->gl_gobj, glist->gl_owner, &x1, &y1, &x2, &y2);
+ if (x1 > x2)
+ m = x1, x1 = x2, x2 = m;
+ if (y1 > y2)
+ m = y1, y1 = y2, x2 = m;
+ gobj_getrect(x, glist, &gx1, &gy1, &gx2, &gy2);
+ if (gx1 < x1 || gx1 > x2 || gx2 < x1 || gx2 > x2 ||
+ gy1 < y1 || gy1 > y2 || gy2 < y1 || gy2 > y2)
+ return;
+ }
(*x->g_pd->c_wb->w_visfn)(x, glist, flag);
+ }
}
int gobj_click(t_gobj *x, struct _glist *glist,
@@ -787,20 +805,9 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y)
x, xpos, ypos, canprop, canopen);
}
- /* tell GUI to create a properties dialog on the canvas. We tell
- the user the negative of the "pixel" y scale to make it appear to grow
- naturally upward, whereas pixels grow downward. */
-static void canvas_properties(t_glist *x)
-{
- char graphbuf[200];
- sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n",
- glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
- (float)glist_isgraph(x), (float)x->gl_stretch);
- gfxstub_new(&x->gl_pd, x, graphbuf);
-}
-
-
-void canvas_setgraph(t_glist *x, int flag)
+ /* set a canvas up as a graph-on-parent. Set reasonable defaults for
+ any missing paramters and redraw things if necessary. */
+void canvas_setgraph(t_glist *x, int flag, int nogoprect)
{
if (!flag && glist_isgraph(x))
{
@@ -824,8 +831,18 @@ void canvas_setgraph(t_glist *x, int flag)
if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
gobj_vis(&x->gl_gobj, x->gl_owner, 0);
x->gl_isgraph = 1;
- /* if (x->gl_owner && glist_isvisible(x->gl_owner))
- canvas_vis(x, 1); */
+ if (!nogoprect && !x->gl_goprect)
+ {
+ t_gobj *g;
+ for (g = x->gl_list; g; g = g->g_next)
+ 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);
if (x->gl_owner && !x->gl_loading && glist_isvisible(x->gl_owner))
@@ -836,20 +853,76 @@ void canvas_setgraph(t_glist *x, int flag)
}
}
+ /* tell GUI to create a properties dialog on the canvas. We tell
+ the user the negative of the "pixel" y scale to make it appear to grow
+ naturally upward, whereas pixels grow downward. */
+void canvas_properties(t_glist *x)
+{
+ char graphbuf[200];
+ if (glist_isgraph(x) != 0)
+ sprintf(graphbuf,
+ "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+ 0., 0.,
+ 1,
+ x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
+ (int)x->gl_pixwidth, (int)x->gl_pixheight,
+ (int)x->gl_xmargin, (int)x->gl_ymargin);
+ else sprintf(graphbuf,
+ "pdtk_canvas_dialog %%s %g %g %d %g %g %g %g %d %d %d %d\n",
+ glist_dpixtodx(x, 1), -glist_dpixtody(x, 1),
+ 0,
+ 0., -1., 1., 1.,
+ (int)x->gl_pixwidth, (int)x->gl_pixheight,
+ (int)x->gl_xmargin, (int)x->gl_ymargin);
+ gfxstub_new(&x->gl_pd, x, graphbuf);
+}
+
/* called from the gui when "OK" is selected on the canvas properties
dialog. Again we negate "y" scale. */
-static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
- t_floatarg yperpix, t_floatarg fgraphme)
+static void canvas_donecanvasdialog(t_glist *x,
+ t_symbol *s, int argc, t_atom *argv)
{
- int graphme = (fgraphme != 0), redraw = 0;
+
+
+ float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin;
+ int graphme, redraw = 0;
+
+ xperpix = atom_getfloatarg(0, argc, argv);
+ yperpix = atom_getfloatarg(1, argc, argv);
+ graphme = (atom_getfloatarg(2, argc, argv) != 0);
+ x1 = atom_getfloatarg(3, argc, argv);
+ y1 = atom_getfloatarg(4, argc, argv);
+ x2 = atom_getfloatarg(5, argc, argv);
+ y2 = atom_getfloatarg(6, argc, argv);
+ xpix = atom_getfloatarg(7, argc, argv);
+ ypix = atom_getfloatarg(8, argc, argv);
+ xmargin = atom_getfloatarg(9, argc, argv);
+ ymargin = atom_getfloatarg(10, argc, argv);
+
+ x->gl_pixwidth = xpix;
+ x->gl_pixheight = ypix;
+ x->gl_xmargin = xmargin;
+ x->gl_ymargin = ymargin;
+
yperpix = -yperpix;
if (xperpix == 0)
xperpix = 1;
if (yperpix == 0)
yperpix = 1;
- canvas_setgraph(x, graphme);
- if (!x->gl_isgraph && (xperpix != glist_dpixtodx(x, 1)))
+
+ if (graphme)
{
+ if (x1 != x2)
+ x->gl_x1 = x1, x->gl_x2 = x2;
+ else x->gl_x1 = 0, x->gl_x2 = 1;
+ if (y1 != y2)
+ x->gl_y1 = y1, x->gl_y2 = y2;
+ else x->gl_y1 = 0, x->gl_y2 = 1;
+ }
+ else
+ {
+ if (xperpix != glist_dpixtodx(x, 1) || yperpix != glist_dpixtody(x, 1))
+ redraw = 1;
if (xperpix > 0)
{
x->gl_x1 = 0;
@@ -860,10 +933,6 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
x->gl_x1 = -xperpix * (x->gl_screenx2 - x->gl_screenx1);
x->gl_x2 = x->gl_x1 + xperpix;
}
- redraw = 1;
- }
- if (!x->gl_isgraph && (yperpix != glist_dpixtody(x, 1)))
- {
if (yperpix > 0)
{
x->gl_y1 = 0;
@@ -874,10 +943,10 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix,
x->gl_y1 = -yperpix * (x->gl_screeny2 - x->gl_screeny1);
x->gl_y2 = x->gl_y1 + yperpix;
}
- redraw = 1;
}
- if (redraw)
- canvas_redraw(x);
+ /* LATER avoid doing 2 redraws here (possibly one inside setgraph) */
+ canvas_setgraph(x, graphme, 0);
+ canvas_redraw(x);
}
/* called from the gui when a popup menu comes back with "properties,"
@@ -2316,7 +2385,7 @@ void g_editor_setup(void)
class_addmethod(canvas_class, (t_method)canvas_done_popup,
gensym("done-popup"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_donecanvasdialog,
- gensym("donecanvasdialog"), A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
+ gensym("donecanvasdialog"), A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 3b26d477..9dae5221 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -24,6 +24,8 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
/* -------------------- maintaining the list -------------------- */
+void canvas_drawredrect(t_canvas *x, int doit);
+
void glist_add(t_glist *x, t_gobj *y)
{
t_object *ob;
@@ -37,6 +39,11 @@ void glist_add(t_glist *x, t_gobj *y)
}
if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
rtext_new(x, ob);
+ if (x->gl_editor && x->gl_isgraph && !x->gl_goprect)
+ {
+ x->gl_goprect = 1;
+ canvas_drawredrect(x, 1);
+ }
if (glist_isvisible(x))
gobj_vis(y, x, 1);
if (class_isdrawcommand(y->g_pd))
@@ -593,12 +600,16 @@ float glist_dpixtody(t_glist *x, float dypix)
/* get the window location in pixels of a "text" object. The
object's x and y positions are in pixels when the glist they're
- in is toplevel. If it's not, we convert to pixels on the parent
- window. */
+ 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. */
int text_xpix(t_text *x, t_glist *glist)
{
if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_xpix);
+ else if (glist->gl_goprect)
+ return (glist->gl_obj.te_xpix + x->te_xpix - glist->gl_xmargin);
else return (glist_xtopixels(glist,
glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) *
x->te_xpix / (glist->gl_screenx2 - glist->gl_screenx1)));
@@ -608,6 +619,8 @@ int text_ypix(t_text *x, t_glist *glist)
{
if (glist->gl_havewindow || !glist->gl_isgraph)
return (x->te_ypix);
+ else if (glist->gl_goprect)
+ return (glist->gl_obj.te_ypix + x->te_ypix - glist->gl_ymargin);
else return (glist_ytopixels(glist,
glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) *
x->te_ypix / (glist->gl_screeny2 - glist->gl_screeny1)));
@@ -638,6 +651,12 @@ void glist_redraw(t_glist *x)
sys_vgui(".x%lx.c coords l%lx %d %d %d %d\n",
glist_getcanvas(x), oc,
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
+ canvas_drawredrect(x, 0);
+ if (x->gl_goprect)
+ {
+ post("draw it");
+ canvas_drawredrect(x, 1);
+ }
}
if (x->gl_owner && glist_isvisible(x->gl_owner))
{
@@ -838,26 +857,6 @@ static void graph_graphrect(t_gobj *z, t_glist *glist,
int x1 = text_xpix(&x->gl_obj, glist);
int y1 = text_ypix(&x->gl_obj, glist);
int x2, y2;
-#if 0 /* this used to adjust graph size when it was in another graph;
- now we just preserve the size. */
- /* same logic here as in text_xpix(): */
- if (glist->gl_havewindow)
- {
- x2 = x1 + x->gl_pixwidth;
- y2 = y1 + x->gl_pixheight;
- }
- else
- {
- x2 = glist_xtopixels(glist,
- glist->gl_x1 + (glist->gl_x2 - glist->gl_x1) *
- (x->gl_obj.te_xpix + x->gl_pixwidth) /
- (glist->gl_screenx2 - glist->gl_screenx1));
- y2 = glist_ytopixels(glist,
- glist->gl_y1 + (glist->gl_y2 - glist->gl_y1) *
- (x->gl_obj.te_ypix + x->gl_pixheight) /
- (glist->gl_screeny2 - glist->gl_screeny1));
- }
-#endif
x2 = x1 + x->gl_pixwidth;
y2 = y1 + x->gl_pixheight;
@@ -890,24 +889,29 @@ static void graph_getrect(t_gobj *z, t_glist *glist,
if (y22 > y2)
y2 = y22;
}
- /* lie about whether we have our own window to affect gobj_getrect
- calls below. (LATER add argument to gobj_getrect()?) */
- hadwindow = x->gl_havewindow;
- x->gl_havewindow = 0;
- for (g = x->gl_list; g; g = g->g_next)
- if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
+ if (!x->gl_goprect)
{
- /* don't do this for arrays, just let them hang outsize the
- box. */
- if (pd_class(&g->g_pd) == garray_class)
- continue;
- gobj_getrect(g, x, &x21, &y21, &x22, &y22);
- if (x22 > x2)
- x2 = x22;
- if (y22 > y2)
- y2 = y22;
+ /* expand the rectangle to fit in text objects; this applies only
+ to the old (0.37) graph-on-parent behavior. */
+ /* lie about whether we have our own window to affect gobj_getrect
+ calls below. */
+ hadwindow = x->gl_havewindow;
+ x->gl_havewindow = 0;
+ for (g = x->gl_list; g; g = g->g_next)
+ if ((!(ob = pd_checkobject(&g->g_pd))) || text_shouldvis(ob, x))
+ {
+ /* don't do this for arrays, just let them hang outside the
+ box. */
+ if (pd_class(&g->g_pd) == garray_class)
+ continue;
+ gobj_getrect(g, x, &x21, &y21, &x22, &y22);
+ if (x22 > x2)
+ x2 = x22;
+ if (y22 > y2)
+ y2 = y22;
+ }
+ x->gl_havewindow = hadwindow;
}
- x->gl_havewindow = hadwindow;
}
else text_widgetbehavior.w_getrectfn(z, glist, &x1, &y1, &x2, &y2);
*xp1 = x1;
@@ -1068,23 +1072,6 @@ t_widgetbehavior graph_widgetbehavior =
graph_click,
};
-void graph_properties(t_gobj *z, t_glist *owner)
-{
- t_glist *x = (t_glist *)z;
- {
- t_gobj *y;
- char graphbuf[200];
- sprintf(graphbuf, "pdtk_graph_dialog %%s %g %g %g %g %d %d\n",
- x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2,
- x->gl_pixwidth, x->gl_pixheight);
- gfxstub_new(&x->gl_pd, x, graphbuf);
-
- for (y = x->gl_list; y; y = y->g_next)
- if (pd_class(&y->g_pd) == garray_class)
- garray_properties((t_garray *)y);
- }
-}
-
/* find the graph most recently added to this glist;
if none exists, return 0. */
@@ -1097,29 +1084,6 @@ t_glist *glist_findgraph(t_glist *x)
return ((t_glist *)y);
}
- /* message back from dialog GUI to set parameters. Args are:
- 1-4: bounds in our coordinates; 5-6: size in parent */
-static void graph_dialog(t_glist *x, t_symbol *s, int argc, t_atom *argv)
-{
- t_float x1 = atom_getfloatarg(0, argc, argv);
- t_float y1 = atom_getfloatarg(1, argc, argv);
- t_float x2 = atom_getfloatarg(2, argc, argv);
- t_float y2 = atom_getfloatarg(3, argc, argv);
- t_float xpix = atom_getfloatarg(4, argc, argv);
- t_float ypix = atom_getfloatarg(5, argc, argv);
- if (x1 != x->gl_x1 || x2 != x->gl_x2 ||
- y1 != x->gl_y1 || y2 != x->gl_y2)
- graph_bounds(x, x1, y1, x2, y2);
- if (xpix != x->gl_pixwidth || ypix != x->gl_pixheight)
- {
- x->gl_pixwidth = xpix;
- x->gl_pixheight = ypix;
- glist_redraw(x);
- if (x->gl_owner)
- canvas_fixlinesfor(x->gl_owner, &x->gl_obj);
- }
-}
-
extern void canvas_menuarray(t_glist *canvas);
void g_graph_setup(void)
@@ -1139,8 +1103,6 @@ void g_graph_setup(void)
A_SYMBOL, A_FLOAT, A_SYMBOL, A_DEFFLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_menuarray,
gensym("menuarray"), A_NULL);
- class_addmethod(canvas_class, (t_method)graph_dialog, gensym("dialog"),
- A_GIMME, 0);
class_addmethod(canvas_class, (t_method)glist_arraydialog,
gensym("arraydialog"), A_SYMBOL, A_FLOAT, A_FLOAT, A_FLOAT, A_NULL);
class_addmethod(canvas_class, (t_method)glist_sort,
diff --git a/pd/src/g_readwrite.c b/pd/src/g_readwrite.c
index 7a3a161c..d8090b48 100644
--- a/pd/src/g_readwrite.c
+++ b/pd/src/g_readwrite.c
@@ -597,11 +597,23 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b)
print out a "coords" message to set up the coordinate systems */
if (x->gl_isgraph || x->gl_x1 || x->gl_y1 ||
x->gl_x2 != 1 || x->gl_y2 != 1 || x->gl_pixwidth || x->gl_pixheight)
- binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"),
+ {
+ if (x->gl_isgraph && x->gl_goprect)
+ /* if we have a graph-on-parent rectangle, we're new style.
+ The format is arranged so
+ that old versions of Pd can at least do something with it. */
+ binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"),
+ x->gl_x1, x->gl_y1,
+ x->gl_x2, x->gl_y2,
+ (float)x->gl_pixwidth, (float)x->gl_pixheight,
+ 1., (float)x->gl_xmargin, (float)x->gl_ymargin);
+ /* otherwise write in 0.38-compatible form */
+ else 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,
(float)x->gl_isgraph);
+ }
}
/* call this recursively to collect all the template names for
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index 0de6903e..a07e20a9 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -153,17 +153,24 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
float dispx, dispy;
char smallbuf[200], *tempbuf;
int outchars = 0, nlines = 0, ncolumns = 0,
- pixwide, pixhigh;
- int font = glist_getfont(x->x_glist);
- int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font);
- int findx = (*widthp + (fontwidth/2)) / fontwidth,
- findy = *heightp / fontheight;
+ pixwide, pixhigh, font, fontwidth, fontheight, findx, findy;
int reportedindex = 0;
t_canvas *canvas = glist_getcanvas(x->x_glist);
int widthspec = x->x_text->te_width;
int widthlimit = (widthspec ? widthspec : BOXWIDTH);
int inindex = 0;
int selstart = 0, selend = 0;
+ /* if we're a GOP (the new, "goprect" style) borrow the font size
+ from the inside to preserve the spacing */
+ if (pd_class(&x->x_text->te_pd) == canvas_class &&
+ ((t_glist *)(x->x_text))->gl_isgraph &&
+ ((t_glist *)(x->x_text))->gl_goprect)
+ font = glist_getfont((t_glist *)(x->x_text));
+ else font = glist_getfont(x->x_glist);
+ fontwidth = sys_fontwidth(font);
+ fontheight = sys_fontheight(font);
+ findx = (*widthp + (fontwidth/2)) / fontwidth;
+ findy = *heightp / fontheight;
if (x->x_bufsize >= 100)
tempbuf = (char *)t_getbytes(2 * x->x_bufsize + 1);
else tempbuf = smallbuf;
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 28b54395..ede0c11c 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1323,12 +1323,13 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
void plot_float(t_plot *x, t_floatarg f)
{
+ int viswas;
if (x->x_vis.fd_type != A_FLOAT || x->x_vis.fd_var)
{
pd_error(x, "global vis/invis for a template with variable visibility");
return;
}
- int viswas = (x->x_vis.fd_un.fd_float != 0);
+ viswas = (x->x_vis.fd_un.fd_float != 0);
if ((f != 0 && viswas) || (f == 0 && !viswas))
return;
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 30735918..535d993b 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -950,13 +950,14 @@ static void text_delete(t_gobj *z, t_glist *glist)
canvas_deletelinesfor(glist, x);
}
- /* return true if the text box should be drawn.
- We don't show object boxes inside graphs. */
+ /* return true if the text box should be drawn. We don't show text boxes
+ inside graphs---except comments, if we're doing the new (goprect) style. */
int text_shouldvis(t_text *x, t_glist *glist)
{
return (glist->gl_havewindow ||
(x->te_pd != canvas_class && x->te_pd->c_wb != &text_widgetbehavior) ||
- (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)));
+ (x->te_pd == canvas_class && (((t_glist *)x)->gl_isgraph)) ||
+ (glist->gl_goprect && (x->te_type == T_TEXT)));
}
static void text_vis(t_gobj *z, t_glist *glist, int vis)
diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt
index 9fcdceed..b014931e 100644
--- a/pd/src/makefile.nt
+++ b/pd/src/makefile.nt
@@ -47,9 +47,10 @@ SRCPA = $(PADIR)/pa_common/pa_stream.c \
$(PADIR)/pa_common/pa_dither.c \
$(PADIR)/pa_common/pa_cpuload.c \
$(PADIR)/pa_common/pa_converters.c \
+ $(PADIR)/pa_common/pa_allocation.c \
$(PADIR)/pa_win/pa_win_util.c \
$(PADIR)/pa_win/pa_win_hostapis.c \
- $(PADIR)/pa_common/pa_allocation.c
+ $(PADIR)/pa_win_wmme/pa_win_wmme.c
SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp
@@ -60,7 +61,8 @@ $(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib
PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \
pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \
- pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj
+ pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \
+ pa_win_wmme.obj
OBJC = $(SRC:.c=.obj) $(PAOBJ)
@@ -125,6 +127,8 @@ pa_win_util.obj: $(PADIR)\pa_win\pa_win_util.c
cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_util.c
pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c
cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c
+pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c
+ cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c
pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp
cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index e3848d17..5aca35dc 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -1,23 +1,25 @@
---------------- dolist --------------------
done for 0.39:
-arrays are now first-class data
+At the source level, "regular" arrays and arrays withing data structures
+are now the same thing. The main user-visible effect of this is that now
+"arrays" may be graphed as "bezier curves".
array elements can be clicked on, etc
fixed array onset bug
rfft bug fix
bug fix in d_soundfile.c
bugfix in number2
plot drawing instructions turn on and off
+ranges in drawing instructions
+unify graph properties dialogs
+GOP font depends on abstraction, not parent
+
+
+------------ 0.39 ---------
check:
MIDI I/O for windows
blechman patch for s_inter.c
-At the source level, "regular" arrays and arrays withing data structures
-are now the same thing. The main user-visible effect of this is that now
-"arrays" may be graphed as "bezier curves".
-
------------- 0.39 ---------
-
garray change:
make a gobj_redraw that schedules the redraw
put two radio button banks side by side
@@ -31,6 +33,7 @@ block resampling arguments
document tabwrite~_start
problems:
+modal dialogs confuse watchdog
patcher inlets don't deal with scalars (zbug.pd)
Macintosh .pd extension not added to filenames
need to optimize canvas_motion (get rid of box hit test??)
@@ -52,7 +55,6 @@ check what happens when going back and forth between graph-on-parent
get rid of messages causing renaming; try to prevent patches closing themselves.
dac~/ adc~/ block~ incompatibility
scofo reports error on reading score1.txt
-rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c
loading e-mailed patches without removing headers crashes pd
pd $1 bug ($1 is saved as it was evaluated, not as '$1')
check if _vsnprintf with zero argument in windows works any better...
@@ -93,7 +95,6 @@ data:
data copy/paste doesn't check templates aren't changed
figure out why Pd sometimes crashes when you close example after adding fields
arrays of non-existent templates crash
-allow field(1,5,0,100) etc. in drawing commands
vget, vset traversal objects
cursor to show (x, y) location
better hit detection (getrect is too greedy; try tk's "current" tag for canvas)
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 0a45dfd6..f6534dde 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -1746,7 +1746,14 @@ proc pdtk_canvas_dofont {name initsize} {
############ pdtk_gatom_dialog -- run a gatom dialog #########
-# see graph_apply, etc., for comments about handling variable names here...
+# dialogs like this one can come up in many copies; but in TK the easiest
+# way to get data from an "entry", etc., is to set an associated variable
+# name. This is especially true for grouped "radio buttons". So we have
+# to synthesize variable names for each instance of the dialog. The dialog
+# gets a TK pathname $id, from which it strips the leading "." to make a
+# variable suffix $vid. Then you can get the actual value out by asking for
+# [eval concat $$variablename]. There should be an easier way but I don't see
+# it yet.
proc gatom_escape {sym} {
if {[string length $sym] == 0} {
@@ -1970,141 +1977,6 @@ proc pdtk_canvas_popup {name xpix ypix canprop canopen} {
[expr $ypix + [winfo rooty $name.c]] 0
}
-############ pdtk_graph_dialog -- dialog window for graphs #########
-
-# the graph and array dialogs can come up in many copies; but in TK the easiest
-# way to get data from an "entry", etc., is to set an associated variable
-# name. This is especially true for grouped "radio buttons". So we have
-# to synthesize variable names for each instance of the dialog. The dialog
-# gets a TK pathname $id, from which it strips the leading "." to make a
-# variable suffix $vid. Then you can get the actual value out by asking for
-# [eval concat $$variablename]. There should be an easier way but I don't see
-# it yet.
-
-proc graph_apply {id} {
-# strip "." from the TK id to make a variable name suffix
- set vid [string trimleft $id .]
-# for each variable, make a local variable to hold its name...
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- pd [concat $id dialog \
- [eval concat $$var_graph_x1] \
- [eval concat $$var_graph_y1] \
- [eval concat $$var_graph_x2] \
- [eval concat $$var_graph_y2] \
- [eval concat $$var_graph_xpix] \
- [eval concat $$var_graph_ypix] \
- \;]
-}
-
-proc graph_cancel {id} {
- set cmd [concat $id cancel \;]
-# puts stderr $cmd
- pd $cmd
-}
-
-proc graph_ok {id} {
- graph_apply $id
- graph_cancel $id
-}
-
-proc pdtk_graph_dialog {id x1 y1 x2 y2 xpix ypix} {
- set vid [string trimleft $id .]
- set var_graph_x1 [concat graph_x1_$vid]
- global $var_graph_x1
- set var_graph_x2 [concat graph_x2_$vid]
- global $var_graph_x2
- set var_graph_xpix [concat graph_xpix_$vid]
- global $var_graph_xpix
- set var_graph_y1 [concat graph_y1_$vid]
- global $var_graph_y1
- set var_graph_y2 [concat graph_y2_$vid]
- global $var_graph_y2
- set var_graph_ypix [concat graph_ypix_$vid]
- global $var_graph_ypix
-
- set $var_graph_x1 $x1
- set $var_graph_x2 $x2
- set $var_graph_xpix $xpix
- set $var_graph_y1 $y1
- set $var_graph_y2 $y2
- set $var_graph_ypix $ypix
-
- toplevel $id
- wm title $id {graph}
- wm protocol $id WM_DELETE_WINDOW [concat graph_cancel $id]
-
- label $id.label -text {GRAPH BOUNDS}
- pack $id.label -side top
-
- frame $id.buttonframe
- pack $id.buttonframe -side bottom -fill x -pady 2m
- button $id.buttonframe.cancel -text {Cancel}\
- -command "graph_cancel $id"
- button $id.buttonframe.apply -text {Apply}\
- -command "graph_apply $id"
- button $id.buttonframe.ok -text {OK}\
- -command "graph_ok $id"
- pack $id.buttonframe.cancel -side left -expand 1
- pack $id.buttonframe.apply -side left -expand 1
- pack $id.buttonframe.ok -side left -expand 1
-
- frame $id.xrangef
- pack $id.xrangef -side top
-
- label $id.xrangef.l1 -text "X from:"
- entry $id.xrangef.x1 -textvariable $var_graph_x1 -width 7
- label $id.xrangef.l2 -text "to:"
- entry $id.xrangef.x2 -textvariable $var_graph_x2 -width 7
- label $id.xrangef.l3 -text "screen width:"
- entry $id.xrangef.xpix -textvariable $var_graph_xpix -width 7
- pack $id.xrangef.l1 $id.xrangef.x1 \
- $id.xrangef.l2 $id.xrangef.x2 \
- $id.xrangef.l3 $id.xrangef.xpix -side left
-
- frame $id.yrangef
- pack $id.yrangef -side top
-
-# dig in the following that the upper bound is labeled y1 but the variable is
-# y2, etc. This is to deal with the inconsistent use of "upper and lower"
-# graph bounds... in the dialog the upper Y bound is the lower valued Y pixel.
- label $id.yrangef.l1 -text "Y from:"
- entry $id.yrangef.y1 -textvariable $var_graph_y2 -width 7
- label $id.yrangef.l2 -text "to:"
- entry $id.yrangef.y2 -textvariable $var_graph_y1 -width 7
- label $id.yrangef.l3 -text "screen height:"
- entry $id.yrangef.ypix -textvariable $var_graph_ypix -width 7
- pack $id.yrangef.l1 $id.yrangef.y1 \
- $id.yrangef.l2 $id.yrangef.y2 \
- $id.yrangef.l3 $id.yrangef.ypix -side left
-
- bind $id.xrangef.x1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.x2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.xrangef.xpix <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y1 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.y2 <KeyPress-Return> [concat graph_ok $id]
- bind $id.yrangef.ypix <KeyPress-Return> [concat graph_ok $id]
- pdtk_standardkeybindings $id.xrangef.x1
- pdtk_standardkeybindings $id.xrangef.x2
- pdtk_standardkeybindings $id.xrangef.xpix
- pdtk_standardkeybindings $id.yrangef.y1
- pdtk_standardkeybindings $id.yrangef.y2
- pdtk_standardkeybindings $id.yrangef.ypix
- $id.xrangef.x2 select from 0
- $id.xrangef.x2 select adjust end
- focus $id.xrangef.x2
-}
# begin of change "iemlib"
############ pdtk_iemgui_dialog -- dialog window for iem guis #########
@@ -2835,6 +2707,8 @@ proc pdtk_iemgui_dialog {id mainheader \
# end of change "iemlib"
############ pdtk_array_dialog -- dialog window for arrays #########
+# see comments above (pdtk_gatom_dialog) about variable name handling
+
proc array_apply {id} {
# strip "." from the TK id to make a variable name suffix
set vid [string trimleft $id .]
@@ -2979,22 +2853,48 @@ proc pdtk_array_dialog {id name n flags newone} {
}
############ pdtk_canvas_dialog -- dialog window for canvass #########
+# see comments above (pdtk_gatom_dialog) about variable name handling
+
proc canvas_apply {id} {
# strip "." from the TK id to make a variable name suffix
set vid [string trimleft $id .]
# for each variable, make a local variable to hold its name...
+
set var_canvas_xscale [concat canvas_xscale_$vid]
global $var_canvas_xscale
set var_canvas_yscale [concat canvas_yscale_$vid]
global $var_canvas_yscale
set var_canvas_graphme [concat canvas_graphme_$vid]
global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
pd [concat $id donecanvasdialog \
[eval concat $$var_canvas_xscale] \
[eval concat $$var_canvas_yscale] \
[eval concat $$var_canvas_graphme] \
+ [eval concat $$var_canvas_x1] \
+ [eval concat $$var_canvas_y1] \
+ [eval concat $$var_canvas_x2] \
+ [eval concat $$var_canvas_y2] \
+ [eval concat $$var_canvas_xpix] \
+ [eval concat $$var_canvas_ypix] \
+ [eval concat $$var_canvas_xmargin] \
+ [eval concat $$var_canvas_ymargin] \
\;]
}
@@ -3008,8 +2908,9 @@ proc canvas_ok {id} {
canvas_cancel $id
}
-proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
+proc canvas_checkcommand {id} {
set vid [string trimleft $id .]
+# puts stderr [concat canvas_checkcommand $id $vid]
set var_canvas_xscale [concat canvas_xscale_$vid]
global $var_canvas_xscale
@@ -3017,18 +2918,120 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
global $var_canvas_yscale
set var_canvas_graphme [concat canvas_graphme_$vid]
global $var_canvas_graphme
-# set var_canvas_stretch [concat canvas_stretch_$vid]
-# global $var_canvas_stretch
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
+ if { [eval concat $$var_canvas_graphme] != 0 } {
+ $id.xrange.entry1 configure -state normal
+ $id.xrange.entry2 configure -state normal
+ $id.xrange.entry3 configure -state normal
+ $id.xrange.entry4 configure -state normal
+ $id.yrange.entry1 configure -state normal
+ $id.yrange.entry2 configure -state normal
+ $id.yrange.entry3 configure -state normal
+ $id.yrange.entry4 configure -state normal
+ $id.xscale.entry configure -state disabled
+ $id.yscale.entry configure -state disabled
+ set x1 [eval concat $$var_canvas_x1]
+ set y1 [eval concat $$var_canvas_y1]
+ set x2 [eval concat $$var_canvas_x2]
+ set y2 [eval concat $$var_canvas_y2]
+ if { [eval concat $$var_canvas_x1] == 0 && \
+ [eval concat $$var_canvas_y1] == 0 && \
+ [eval concat $$var_canvas_x2] == 0 && \
+ [eval concat $$var_canvas_y2] == 0 } {
+ set $var_canvas_x2 1
+ set $var_canvas_y2 1
+ }
+ if { [eval concat $$var_canvas_xpix] == 0 } {
+ set $var_canvas_xpix 85
+ set $var_canvas_xmargin 100
+ }
+ if { [eval concat $$var_canvas_ypix] == 0 } {
+ set $var_canvas_ypix 60
+ set $var_canvas_ymargin 100
+ }
+ } else {
+ $id.xrange.entry1 configure -state disabled
+ $id.xrange.entry2 configure -state disabled
+ $id.xrange.entry3 configure -state disabled
+ $id.xrange.entry4 configure -state disabled
+ $id.yrange.entry1 configure -state disabled
+ $id.yrange.entry2 configure -state disabled
+ $id.yrange.entry3 configure -state disabled
+ $id.yrange.entry4 configure -state disabled
+ $id.xscale.entry configure -state normal
+ $id.yscale.entry configure -state normal
+ if { [eval concat $$var_canvas_xscale] == 0 } {
+ set $var_canvas_xscale 1
+ }
+ if { [eval concat $$var_canvas_yscale] == 0 } {
+ set $var_canvas_yscale -1
+ }
+ }
+}
+
+proc pdtk_canvas_dialog {id xscale yscale graphme x1 y1 x2 y2 \
+ xpix ypix xmargin ymargin} {
+ set vid [string trimleft $id .]
+
+ set var_canvas_xscale [concat canvas_xscale_$vid]
+ global $var_canvas_xscale
+ set var_canvas_yscale [concat canvas_yscale_$vid]
+ global $var_canvas_yscale
+ set var_canvas_graphme [concat canvas_graphme_$vid]
+ global $var_canvas_graphme
+ set var_canvas_x1 [concat canvas_x1_$vid]
+ global $var_canvas_x1
+ set var_canvas_x2 [concat canvas_x2_$vid]
+ global $var_canvas_x2
+ set var_canvas_xpix [concat canvas_xpix_$vid]
+ global $var_canvas_xpix
+ set var_canvas_xmargin [concat canvas_xmargin_$vid]
+ global $var_canvas_xmargin
+ set var_canvas_y1 [concat canvas_y1_$vid]
+ global $var_canvas_y1
+ set var_canvas_y2 [concat canvas_y2_$vid]
+ global $var_canvas_y2
+ set var_canvas_ypix [concat canvas_ypix_$vid]
+ global $var_canvas_ypix
+ set var_canvas_ymargin [concat canvas_ymargin_$vid]
+ global $var_canvas_ymargin
+
set $var_canvas_xscale $xscale
set $var_canvas_yscale $yscale
set $var_canvas_graphme $graphme
-# set $var_canvas_stretch $stretch
+ set $var_canvas_x1 $x1
+ set $var_canvas_y1 $y1
+ set $var_canvas_x2 $x2
+ set $var_canvas_y2 $y2
+ set $var_canvas_xpix $xpix
+ set $var_canvas_ypix $ypix
+ set $var_canvas_xmargin $xmargin
+ set $var_canvas_ymargin $ymargin
toplevel $id
wm title $id {canvas}
wm protocol $id WM_DELETE_WINDOW [concat canvas_cancel $id]
+ label $id.toplabel -text "Canvas Properties"
+ pack $id.toplabel -side top
+
frame $id.xscale
pack $id.xscale -side top
label $id.xscale.label -text "X units per pixel"
@@ -3042,13 +3045,41 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
pack $id.yscale.label $id.yscale.entry -side left
checkbutton $id.graphme -text {graph on parent} \
- -variable $var_canvas_graphme -anchor w
+ -variable $var_canvas_graphme -anchor w \
+ -command [concat canvas_checkcommand $id]
pack $id.graphme -side top
-# checkbutton $id.stretch -text {stretch on resize} \
-# -variable $var_canvas_stretch -anchor w
-# pack $id.stretch -side top
-
+ frame $id.xrange
+ pack $id.xrange -side top
+ label $id.xrange.label1 -text "X range: from"
+ entry $id.xrange.entry1 -textvariable $var_canvas_x1 -width 6
+ label $id.xrange.label2 -text "to"
+ entry $id.xrange.entry2 -textvariable $var_canvas_x2 -width 6
+ label $id.xrange.label3 -text "size"
+ entry $id.xrange.entry3 -textvariable $var_canvas_xpix -width 4
+ label $id.xrange.label4 -text "margin"
+ entry $id.xrange.entry4 -textvariable $var_canvas_xmargin -width 4
+ pack $id.xrange.label1 $id.xrange.entry1 \
+ $id.xrange.label2 $id.xrange.entry2 \
+ $id.xrange.label3 $id.xrange.entry3 \
+ $id.xrange.label4 $id.xrange.entry4 \
+ -side left
+
+ frame $id.yrange
+ pack $id.yrange -side top
+ label $id.yrange.label1 -text "Y range: from"
+ entry $id.yrange.entry1 -textvariable $var_canvas_y1 -width 6
+ label $id.yrange.label2 -text "to"
+ entry $id.yrange.entry2 -textvariable $var_canvas_y2 -width 6
+ label $id.yrange.label3 -text "size"
+ entry $id.yrange.entry3 -textvariable $var_canvas_ypix -width 4
+ label $id.yrange.label4 -text "margin"
+ entry $id.yrange.entry4 -textvariable $var_canvas_ymargin -width 4
+ pack $id.yrange.label1 $id.yrange.entry1 \
+ $id.yrange.label2 $id.yrange.entry2 \
+ $id.yrange.label3 $id.yrange.entry3 \
+ $id.yrange.label4 $id.yrange.entry4 \
+ -side left
frame $id.buttonframe
pack $id.buttonframe -side bottom -fill x -pady 2m
@@ -3069,6 +3100,7 @@ proc pdtk_canvas_dialog {id xscale yscale graphme stretch} {
$id.xscale.entry select from 0
$id.xscale.entry select adjust end
focus $id.xscale.entry
+ canvas_checkcommand $id
}
############ pdtk_data_dialog -- run a data dialog #########