From 010912260e43ca6cf728441a5196fa1886ea8016 Mon Sep 17 00:00:00 2001
From: Claude Heiland-Allen <claude@mathr.co.uk>
Date: Mon, 24 Sep 2018 22:28:46 +0100
Subject: [PATCH 28/39] bundled: pd 0.42-5

---
 bundled/g_canvas.h | 92 ++++++++++++++++++++--------------------------
 1 file changed, 39 insertions(+), 53 deletions(-)

diff --git a/bundled/g_canvas.h b/bundled/g_canvas.h
index 99658f2e..571ab94f 100644
--- a/bundled/g_canvas.h
+++ b/bundled/g_canvas.h
@@ -1,4 +1,3 @@
-
 /* Copyright (c) 1997-1999 Miller Puckette.
 * For information on usage and redistribution, and for a DISCLAIMER OF ALL
 * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
@@ -8,8 +7,8 @@ functions.  "Glists" and "canvases" and "graphs" used to be different
 structures until being unified in version 0.35.
 
 A glist occupies its own window if the "gl_havewindow" flag is set.  Its
-appearance on its "parent" or "owner" (if it has one) is as a graph if
-"gl_isgraph" is set, and otherwise as a text box.
+appearance on its "parent", also called "owner", (if it has one) is as a graph
+if "gl_isgraph" is set, and otherwise as a text box.
 
 A glist is "root" if it has no owner, i.e., a document window.  In this
 case "gl_havewindow" is always set.
@@ -141,8 +140,8 @@ typedef struct _arrayvis
 
 typedef struct _tick    /* where to put ticks on x or y axes */
 {
-    float k_point;      /* one point to draw a big tick at */
-    float k_inc;        /* x or y increment per little tick */
+    t_float k_point;      /* one point to draw a big tick at */
+    t_float k_inc;        /* x or y increment per little tick */
     int k_lperb;        /* little ticks per big; 0 if no ticks to draw */
 } t_tick;
 
@@ -160,10 +159,10 @@ struct _glist
     struct _glist *gl_owner;    /* parent glist, supercanvas, or 0 if none */
     int gl_pixwidth;            /* width in pixels (on parent, if a graph) */
     int gl_pixheight;
-    float gl_x1;                /* bounding rectangle in our own coordinates */
-    float gl_y1;
-    float gl_x2;
-    float gl_y2;
+    t_float gl_x1;                /* bounding rectangle in our own coordinates */
+    t_float gl_y1;
+    t_float gl_x2;
+    t_float gl_y2;
     int gl_screenx1;            /* screen coordinates when toplevel */
     int gl_screeny1;
     int gl_screenx2;
@@ -173,11 +172,11 @@ struct _glist
     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 */
-    float gl_xlabely;               /* ... and their Y coordinates */
+    t_float gl_xlabely;               /* ... and their Y coordinates */
     t_tick gl_ytick;            /* same as above for Y ticks and labels */
     int gl_nylabels;
     t_symbol **gl_ylabel;
-    float gl_ylabelx;
+    t_float gl_ylabelx;
     t_editor *gl_editor;        /* editor structure when visible */
     t_symbol *gl_name;          /* symbol bound here */
     int gl_font;                /* nominal font size in points, e.g., 10 */
@@ -192,6 +191,7 @@ struct _glist
     unsigned int gl_isdeleting:1;   /* we're inside glist_delete -- hack! */
     unsigned int gl_goprect:1;      /* draw rectangle for graph-on-parent */
     unsigned int gl_isgraph:1;      /* show as graph on parent */
+    unsigned int gl_hidetext:1;     /* hide object-name + args when doing graph on parent */
 };
 
 #define gl_gobj gl_obj.te_g
@@ -231,19 +231,6 @@ struct _array
     t_gstub *a_stub;    /* stub for pointing into this array */
 };
 
-struct _garray
-{
-    t_gobj x_gobj;
-    t_scalar *x_scalar;     /* scalar "containing" the array */
-    t_glist *x_glist;       /* containing glist */
-    t_symbol *x_name;       /* unexpanded name (possibly with leading '$') */
-    t_symbol *x_realname;   /* expanded name (symbol we're bound to) */
-    char x_usedindsp;       /* true if some DSP routine is using this */
-    char x_saveit;          /* true if we should save this with parent */
-    char x_listviewing;     /* true if list view window is open */
-    double x_lastupdate;    /* T.Grill - clock_getlogicaltime() of last array update */
-};
-
     /* structure for traversing all the connections in a glist */
 typedef struct _linetraverser
 {
@@ -308,28 +295,28 @@ doesn't work on array elements... LATER reconsider this */
 
         /* bounding rectangle: */
 typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist,
-    t_word *data, t_template *tmpl, float basex, float basey,
+    t_word *data, t_template *tmpl, t_float basex, t_float basey,
     int *x1, int *y1, int *x2, int *y2);
         /* displace it */
 typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist, 
-    t_word *data, t_template *tmpl, float basex, float basey,
+    t_word *data, t_template *tmpl, t_float basex, t_float basey,
     int dx, int dy);
         /* change color to show selection */
 typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist,
-    t_word *data, t_template *tmpl, float basex, float basey,
+    t_word *data, t_template *tmpl, t_float basex, t_float basey,
     int state);
         /* change appearance to show activation/deactivation: */
 typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist,
-    t_word *data, t_template *tmpl, float basex, float basey,
+    t_word *data, t_template *tmpl, t_float basex, t_float basey,
     int state);
         /*  making visible or invisible */
 typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist,
-    t_word *data, t_template *tmpl, float basex, float basey,
+    t_word *data, t_template *tmpl, t_float basex, t_float basey,
     int flag);
         /*  field a mouse click */
 typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist,
     t_word *data, t_template *tmpl, t_scalar *sc, t_array *ap,
-    float basex, float basey,
+    t_float basex, t_float basey,
     int xpix, int ypix, int shift, int alt, int dbl, int doit);
 
 struct _parentwidgetbehavior
@@ -403,18 +390,18 @@ EXTERN void glist_sort(t_glist *canvas);
 EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format);
 EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format);
 
-EXTERN float glist_pixelstox(t_glist *x, float xpix);
-EXTERN float glist_pixelstoy(t_glist *x, float ypix);
-EXTERN float glist_xtopixels(t_glist *x, float xval);
-EXTERN float glist_ytopixels(t_glist *x, float yval);
-EXTERN float glist_dpixtodx(t_glist *x, float dxpix);
-EXTERN float glist_dpixtody(t_glist *x, float dypix);
+EXTERN t_float glist_pixelstox(t_glist *x, t_float xpix);
+EXTERN t_float glist_pixelstoy(t_glist *x, t_float ypix);
+EXTERN t_float glist_xtopixels(t_glist *x, t_float xval);
+EXTERN t_float glist_ytopixels(t_glist *x, t_float yval);
+EXTERN t_float glist_dpixtodx(t_glist *x, t_float dxpix);
+EXTERN t_float glist_dpixtody(t_glist *x, t_float dypix);
 
 EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval);
 EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv);
 EXTERN t_glist *glist_addglist(t_glist *g, t_symbol *sym,
-    float x1, float y1, float x2, float y2,
-    float px1, float py1, float px2, float py2);
+    t_float x1, t_float y1, t_float x2, t_float y2,
+    t_float px1, t_float py1, t_float px2, t_float py2);
 EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name,
     t_floatarg size, t_floatarg saveit, t_floatarg newgraph);
 EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething);
@@ -423,10 +410,11 @@ EXTERN void glist_redraw(t_glist *x);
 EXTERN void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
     char *tag, int x1, int y1, int x2, int y2);
 EXTERN void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag);
-EXTERN void canvas_create_editor(t_glist *x, int createit);
+EXTERN void canvas_create_editor(t_glist *x);
+EXTERN void canvas_destroy_editor(t_glist *x);
 void canvas_deletelinesforio(t_canvas *x, t_text *text,
     t_inlet *inp, t_outlet *outp);
-
+extern int glist_amreloadingabstractions; /* stop GUI changes while reloading */
 
 /* -------------------- functions on texts ------------------------- */
 EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize);
@@ -437,11 +425,9 @@ EXTERN int text_xcoord(t_text *x, t_glist *glist);
 EXTERN int text_ycoord(t_text *x, t_glist *glist);
 EXTERN int text_xpix(t_text *x, t_glist *glist);
 EXTERN int text_ypix(t_text *x, t_glist *glist);
-EXTERN int text_shouldvis(t_text *x, t_glist *glist);
 #endif /*DESIRE */
 
 /* -------------------- functions on rtexts ------------------------- */
-
 #define RTEXT_DOWN 1
 #define RTEXT_DRAG 2
 #define RTEXT_DBL 3
@@ -467,7 +453,6 @@ EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize);
 EXTERN void rtext_getseltext(t_rtext *x, char **buf, int *bufsize);
 
 /* -------------------- functions on canvases ------------------------ */
-#ifndef DESIRE
 EXTERN t_class *canvas_class;
 
 EXTERN t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv);
@@ -479,7 +464,7 @@ EXTERN void canvas_stowconnections(t_canvas *x);
 EXTERN void canvas_restoreconnections(t_canvas *x);
 EXTERN void canvas_redraw(t_canvas *x);
 
-EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym, t_symbol* h);
+EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym);
 EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip);
 EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym);
 EXTERN void canvas_rmoutlet(t_canvas *x, t_outlet *op);
@@ -492,7 +477,7 @@ EXTERN void canvas_setcurrent(t_canvas *x);
 EXTERN void canvas_unsetcurrent(t_canvas *x);
 EXTERN t_symbol *canvas_realizedollar(t_canvas *x, t_symbol *s);
 EXTERN t_canvas *canvas_getrootfor(t_canvas *x);
-EXTERN void canvas_dirty(t_canvas *x, t_int n);
+EXTERN void canvas_dirty(t_canvas *x, t_floatarg n);
 EXTERN int canvas_getfont(t_canvas *x);
 typedef int (*t_canvasapply)(t_canvas *x, t_int x1, t_int x2, t_int x3);
 
@@ -528,7 +513,7 @@ EXTERN int canvas_getindex(t_canvas *x, t_gobj *y);
 EXTERN void canvas_connect(t_canvas *x,
     t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno);
 EXTERN void canvas_disconnect(t_canvas *x,
-    float index1, float outno, float index2, float inno);
+    t_float index1, t_float outno, t_float index2, t_float inno);
 EXTERN int canvas_isconnected (t_canvas *x,
     t_text *ob1, int n1, t_text *ob2, int n2);
 EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy);
@@ -562,6 +547,7 @@ EXTERN void array_free(t_array *x);
 EXTERN t_gstub *gstub_new(t_glist *gl, t_array *a);
 EXTERN void gstub_cutoff(t_gstub *gs);
 EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x);
+EXTERN void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w);
 
 /* --------------------- scalars ------------------------- */
 EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp);
@@ -570,21 +556,21 @@ EXTERN void word_restore(t_word *wp, t_template *tmpl,
 EXTERN t_scalar *scalar_new(t_glist *owner,
     t_symbol *templatesym);
 EXTERN void word_free(t_word *wp, t_template *tmpl);
-EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey);
+EXTERN void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey);
 EXTERN void scalar_redraw(t_scalar *x, t_glist *glist);
 
 /* ------helper routines for "garrays" and "plots" -------------- */
 EXTERN int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
     t_symbol *elemtemplatesym,
-    float linewidth, float xloc, float xinc, float yloc, float scalarvis,
+    t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis,
     t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield,
     int xpix, int ypix, int shift, int alt, int dbl, int doit);
 
 EXTERN void array_getcoordinate(t_glist *glist,
     char *elem, int xonset, int yonset, int wonset, int indx,
-    float basex, float basey, float xinc,
+    t_float basex, t_float basey, t_float xinc,
     t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc,
-    float *xp, float *yp, float *wp);
+    t_float *xp, t_float *yp, t_float *wp);
 
 EXTERN int array_getfields(t_symbol *elemtemplatesym,
     t_canvas **elemtemplatecanvasp,
@@ -624,9 +610,9 @@ EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname,
 EXTERN t_float fielddesc_getcoord(t_fielddesc *f, t_template *tmpl,
     t_word *wp, int loud);
 EXTERN void fielddesc_setcoord(t_fielddesc *f, t_template *tmpl,
-    t_word *wp, float pix, int loud);
-EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, float val);
-EXTERN float fielddesc_cvtfromcoord(t_fielddesc *f, float coord);
+    t_word *wp, t_float pix, int loud);
+EXTERN t_float fielddesc_cvttocoord(t_fielddesc *f, t_float val);
+EXTERN t_float fielddesc_cvtfromcoord(t_fielddesc *f, t_float coord);
 
 
 /* ----------------------- guiconnects, g_guiconnect.c --------- */
-- 
2.19.1

