summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/extra/g_canvas.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/g_canvas.h')
-rw-r--r--apps/plugins/pdbox/PDa/extra/g_canvas.h601
1 files changed, 0 insertions, 601 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/g_canvas.h b/apps/plugins/pdbox/PDa/extra/g_canvas.h
index 54ab985feb..9fc580da08 100644
--- a/apps/plugins/pdbox/PDa/extra/g_canvas.h
+++ b/apps/plugins/pdbox/PDa/extra/g_canvas.h
@@ -600,605 +600,4 @@ EXTERN t_symbol *iemgui_dollar2raute(t_symbol *s);
600#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) 600#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
601} 601}
602#endif 602#endif
603/* Copyright (c) 1997-1999 Miller Puckette.
604* For information on usage and redistribution, and for a DISCLAIMER OF ALL
605* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
606
607/* this file defines the structure for "glists" and related structures and
608functions. "Glists" and "canvases" and "graphs" used to be different
609structures until being unified in version 0.35.
610
611A glist occupies its own window if the "gl_havewindow" flag is set. Its
612appearance on its "parent" or "owner" (if it has one) is as a graph if
613"gl_isgraph" is set, and otherwise as a text box.
614
615A glist is "root" if it has no owner, i.e., a document window. In this
616case "gl_havewindow" is always set.
617
618We maintain a list of root windows, so that we can traverse the whole
619collection of everything in a Pd process.
620
621If a glist has a window it may still not be "mapped." Miniaturized
622windows aren't mapped, for example, but a window is also not mapped
623immediately upon creation. In either case gl_havewindow is true but
624gl_mapped is false.
625
626Closing a non-root window makes it invisible; closing a root destroys it.
627
628A glist that's just a text object on its parent is always "toplevel." An
629embedded glist can switch back and forth to appear as a toplevel by double-
630clicking on it. Single-clicking a text box makes the toplevel become visible
631and raises the window it's in.
632
633If a glist shows up as a graph on its parent, the graph is blanked while the
634glist has its own window, even if miniaturized.
635
636*/
637
638/* NOTE: this file describes Pd implementation details which may change
639in future releases. The public (stable) API is in m_pd.h. */
640
641#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
642extern "C" {
643#endif
644
645/* --------------------- geometry ---------------------------- */
646#define IOWIDTH 7 /* width of an inlet/outlet in pixels */
647#define IOMIDDLE ((IOWIDTH-1)/2)
648#define GLIST_DEFGRAPHWIDTH 200
649#define GLIST_DEFGRAPHHEIGHT 140
650/* ----------------------- data ------------------------------- */
651
652typedef struct _updateheader
653{
654 struct _updateheader *upd_next;
655 unsigned int upd_array:1; /* true if array, false if glist */
656 unsigned int upd_queued:1; /* true if we're queued */
657} t_updateheader;
658
659 /* types to support glists grabbing mouse motion or keys from parent */
660typedef void (*t_glistmotionfn)(void *z, t_floatarg dx, t_floatarg dy);
661typedef void (*t_glistkeyfn)(void *z, t_floatarg key);
662
663EXTERN_STRUCT _rtext;
664#define t_rtext struct _rtext
665 603
666EXTERN_STRUCT _gtemplate;
667#define t_gtemplate struct _gtemplate
668
669EXTERN_STRUCT _guiconnect;
670#define t_guiconnect struct _guiconnect
671
672EXTERN_STRUCT _tscalar;
673#define t_tscalar struct _tscalar
674
675EXTERN_STRUCT _canvasenvironment;
676#define t_canvasenvironment struct _canvasenvironment
677
678typedef struct _selection
679{
680 t_gobj *sel_what;
681 struct _selection *sel_next;
682} t_selection;
683
684 /* this structure is instantiated whenever a glist becomes visible. */
685typedef struct _editor
686{
687 t_updateheader e_upd; /* update header structure */
688 t_selection *e_updlist; /* list of objects to update */
689 t_rtext *e_rtext; /* text responder linked list */
690 t_selection *e_selection; /* head of the selection list */
691 t_rtext *e_textedfor; /* the rtext if any that we are editing */
692 t_gobj *e_grab; /* object being "dragged" */
693 t_glistmotionfn e_motionfn; /* ... motion callback */
694 t_glistkeyfn e_keyfn; /* ... keypress callback */
695 t_binbuf *e_connectbuf; /* connections to deleted objects */
696 t_binbuf *e_deleted; /* last stuff we deleted */
697 t_guiconnect *e_guiconnect; /* GUI connection for filtering messages */
698 struct _glist *e_glist; /* glist which owns this */
699 int e_xwas; /* xpos on last mousedown or motion event */
700 int e_ywas; /* ypos, similarly */
701 int e_selectline_index1; /* indices for the selected line if any */
702 int e_selectline_outno; /* (only valid if e_selectedline is set) */
703 int e_selectline_index2;
704 int e_selectline_inno;
705 t_outconnect *e_selectline_tag;
706 unsigned int e_onmotion: 3; /* action to take on motion */
707 unsigned int e_lastmoved: 1; /* one if mouse has moved since click */
708 unsigned int e_textdirty: 1; /* one if e_textedfor has changed */
709 unsigned int e_selectedline: 1; /* one if a line is selected */
710} t_editor;
711
712#define MA_NONE 0 /* e_onmotion: do nothing on mouse motion */
713#define MA_MOVE 1 /* drag the selection around */
714#define MA_CONNECT 2 /* make a connection */
715#define MA_REGION 3 /* selection region */
716#define MA_PASSOUT 4 /* send on to e_grab */
717#define MA_DRAGTEXT 5 /* drag in text editor to alter selection */
718
719/* editor structure for "garrays". We don't bother to delete and regenerate
720this structure when the "garray" becomes invisible or visible, although we
721could do so if the structure gets big (like the "editor" above.) */
722
723typedef struct _arrayvis
724{
725 t_updateheader av_upd; /* update header structure */
726 t_garray *av_garray; /* owning structure */
727} t_arrayvis;
728
729/* the t_tick structure describes where to draw x and y "ticks" for a glist */
730
731typedef struct _tick /* where to put ticks on x or y axes */
732{
733 float k_point; /* one point to draw a big tick at */
734 float k_inc; /* x or y increment per little tick */
735 int k_lperb; /* little ticks per big; 0 if no ticks to draw */
736} t_tick;
737
738/* the t_glist structure, which describes a list of elements that live on an
739area of a window.
740
741*/
742
743struct _glist
744{
745 t_object gl_obj; /* header in case we're a glist */
746 t_gobj *gl_list; /* the actual data */
747 struct _gstub *gl_stub; /* safe pointer handler */
748 int gl_valid; /* incremented when pointers might be stale */
749 struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */
750 int gl_pixwidth; /* width in pixels (on parent, if a graph) */
751 int gl_pixheight;
752 float gl_x1; /* bounding rectangle in our own coordinates */
753 float gl_y1;
754 float gl_x2;
755 float gl_y2;
756 int gl_screenx1; /* screen coordinates when toplevel */
757 int gl_screeny1;
758 int gl_screenx2;
759 int gl_screeny2;
760 t_tick gl_xtick; /* ticks marking X values */
761 int gl_nxlabels; /* number of X coordinate labels */
762 t_symbol **gl_xlabel; /* ... an array to hold them */
763 float gl_xlabely; /* ... and their Y coordinates */
764 t_tick gl_ytick; /* same as above for Y ticks and labels */
765 int gl_nylabels;
766 t_symbol **gl_ylabel;
767 float gl_ylabelx;
768 t_editor *gl_editor; /* editor structure when visible */
769 t_symbol *gl_name; /* symbol bound here */
770 int gl_font; /* nominal font size in points, e.g., 10 */
771 struct _glist *gl_next; /* link in list of toplevels */
772 t_canvasenvironment *gl_env; /* root canvases and abstractions only */
773 unsigned int gl_havewindow:1; /* true if we own a window */
774 unsigned int gl_mapped:1; /* true if, moreover, it's "mapped" */
775 unsigned int gl_dirty:1; /* (root canvas only:) patch has changed */
776 unsigned int gl_loading:1; /* am now loading from file */
777 unsigned int gl_willvis:1; /* make me visible after loading */
778 unsigned int gl_edit:1; /* edit mode */
779 unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
780 unsigned int gl_stretch:1; /* stretch contents on resize */
781 unsigned int gl_isgraph:1; /* show as graph on parent */
782};
783
784#define gl_gobj gl_obj.te_g
785#define gl_pd gl_gobj.g_pd
786
787/* a data structure to describe a field in a pure datum */
788
789#define DT_FLOAT 0
790#define DT_SYMBOL 1
791#define DT_LIST 2
792#define DT_ARRAY 3
793
794typedef struct _dataslot
795{
796 int ds_type;
797 t_symbol *ds_name;
798 t_symbol *ds_arraytemplate; /* filled in for arrays only */
799} t_dataslot;
800
801
802/* T.Grill - changed t_pd member to t_pdobj to avoid name clashed */
803typedef struct _template
804{
805 t_pd t_pdobj; /* header */
806 struct _gtemplate *t_list; /* list of "struct"/gtemplate objects */
807 t_symbol *t_sym; /* name */
808 int t_n; /* number of dataslots (fields) */
809 t_dataslot *t_vec; /* array of dataslots */
810} t_template;
811
812struct _array
813{
814 int a_n; /* number of elements */
815 int a_elemsize; /* size in bytes; LATER get this from template */
816 char *a_vec; /* array of elements */
817 t_symbol *a_templatesym; /* template for elements */
818 int a_valid; /* protection against stale pointers into array */
819 t_gpointer a_gp; /* pointer to scalar or array element we're in */
820 t_gstub *a_stub;
821};
822
823 /* structure for traversing all the connections in a glist */
824typedef struct _linetraverser
825{
826 t_canvas *tr_x;
827 t_object *tr_ob;
828 int tr_nout;
829 int tr_outno;
830 t_object *tr_ob2;
831 t_outlet *tr_outlet;
832 t_inlet *tr_inlet;
833 int tr_nin;
834 int tr_inno;
835 int tr_x11, tr_y11, tr_x12, tr_y12;
836 int tr_x21, tr_y21, tr_x22, tr_y22;
837 int tr_lx1, tr_ly1, tr_lx2, tr_ly2;
838 t_outconnect *tr_nextoc;
839 int tr_nextoutno;
840} t_linetraverser;
841
842/* function types used to define graphical behavior for gobjs, a bit like X
843widgets. We don't use Pd methods because Pd's typechecking can't specify the
844types of pointer arguments. Also it's more convenient this way, since
845every "patchable" object can just get the "text" behaviors. */
846
847 /* Call this to get a gobj's bounding rectangle in pixels */
848typedef void (*t_getrectfn)(t_gobj *x, struct _glist *glist,
849 int *x1, int *y1, int *x2, int *y2);
850 /* and this to displace a gobj: */
851typedef void (*t_displacefn)(t_gobj *x, struct _glist *glist, int dx, int dy);
852 /* change color to show selection: */
853typedef void (*t_selectfn)(t_gobj *x, struct _glist *glist, int state);
854 /* change appearance to show activation/deactivation: */
855typedef void (*t_activatefn)(t_gobj *x, struct _glist *glist, int state);
856 /* warn a gobj it's about to be deleted */
857typedef void (*t_deletefn)(t_gobj *x, struct _glist *glist);
858 /* making visible or invisible */
859typedef void (*t_visfn)(t_gobj *x, struct _glist *glist, int flag);
860 /* field a mouse click (when not in "edit" mode) */
861typedef int (*t_clickfn)(t_gobj *x, struct _glist *glist,
862 int xpix, int ypix, int shift, int alt, int dbl, int doit);
863 /* ... and later, resizing; getting/setting font or color... */
864
865struct _widgetbehavior
866{
867 t_getrectfn w_getrectfn;
868 t_displacefn w_displacefn;
869 t_selectfn w_selectfn;
870 t_activatefn w_activatefn;
871 t_deletefn w_deletefn;
872 t_visfn w_visfn;
873 t_clickfn w_clickfn;
874};
875
876/* -------- behaviors for scalars defined by objects in template --------- */
877/* these are set by "drawing commands" in g_template.c which add appearance to
878scalars, which live in some other window. If the scalar is just included
879in a canvas the "parent" is a misnomer. There is also a text scalar object
880which really does draw the scalar on the parent window; see g_scalar.c. */
881
882/* note how the click function wants the whole scalar, not the "data", so
883doesn't work on array elements... LATER reconsider this */
884
885 /* bounding rectangle: */
886typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist,
887 t_word *data, t_template *tmpl, float basex, float basey,
888 int *x1, int *y1, int *x2, int *y2);
889 /* displace it */
890typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist,
891 t_word *data, t_template *tmpl, float basex, float basey,
892 int dx, int dy);
893 /* change color to show selection */
894typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist,
895 t_word *data, t_template *tmpl, float basex, float basey,
896 int state);
897 /* change appearance to show activation/deactivation: */
898typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist,
899 t_word *data, t_template *tmpl, float basex, float basey,
900 int state);
901 /* making visible or invisible */
902typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist,
903 t_word *data, t_template *tmpl, float basex, float basey,
904 int flag);
905 /* field a mouse click */
906typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist,
907 t_scalar *sc, t_template *tmpl, float basex, float basey,
908 int xpix, int ypix, int shift, int alt, int dbl, int doit);
909
910struct _parentwidgetbehavior
911{
912 t_parentgetrectfn w_parentgetrectfn;
913 t_parentdisplacefn w_parentdisplacefn;
914 t_parentselectfn w_parentselectfn;
915 t_parentactivatefn w_parentactivatefn;
916 t_parentvisfn w_parentvisfn;
917 t_parentclickfn w_parentclickfn;
918};
919
920 /* cursor definitions; used as return value for t_parentclickfn */
921#define CURSOR_RUNMODE_NOTHING 0
922#define CURSOR_RUNMODE_CLICKME 1
923#define CURSOR_RUNMODE_THICKEN 2
924#define CURSOR_RUNMODE_ADDPOINT 3
925#define CURSOR_EDITMODE_NOTHING 4
926#define CURSOR_EDITMODE_CONNECT 5
927#define CURSOR_EDITMODE_DISCONNECT 6
928EXTERN void canvas_setcursor(t_glist *x, unsigned int cursornum);
929
930extern t_canvas *canvas_editing; /* last canvas to start text edting */
931extern t_canvas *canvas_whichfind; /* last canvas we did a find in */
932extern t_canvas *canvas_list; /* list of all root canvases */
933extern t_class *vinlet_class, *voutlet_class;
934extern int glist_valid; /* incremented when pointers might be stale */
935
936/* ------------------- functions on any gobj ----------------------------- */
937EXTERN void gobj_getrect(t_gobj *x, t_glist *owner, int *x1, int *y1,
938 int *x2, int *y2);
939EXTERN void gobj_displace(t_gobj *x, t_glist *owner, int dx, int dy);
940EXTERN void gobj_select(t_gobj *x, t_glist *owner, int state);
941EXTERN void gobj_activate(t_gobj *x, t_glist *owner, int state);
942EXTERN void gobj_delete(t_gobj *x, t_glist *owner);
943EXTERN void gobj_vis(t_gobj *x, t_glist *glist, int flag);
944EXTERN int gobj_click(t_gobj *x, struct _glist *glist,
945 int xpix, int ypix, int shift, int alt, int dbl, int doit);
946EXTERN void gobj_save(t_gobj *x, t_binbuf *b);
947EXTERN void gobj_properties(t_gobj *x, struct _glist *glist);
948EXTERN void gobj_save(t_gobj *x, t_binbuf *b);
949
950/* -------------------- functions on glists --------------------- */
951EXTERN t_glist *glist_new( void);
952EXTERN void glist_init(t_glist *x);
953EXTERN void glist_add(t_glist *x, t_gobj *g);
954EXTERN void glist_cleanup(t_glist *x);
955EXTERN void glist_free(t_glist *x);
956
957EXTERN void glist_clear(t_glist *x);
958EXTERN t_canvas *glist_getcanvas(t_glist *x);
959EXTERN int glist_isselected(t_glist *x, t_gobj *y);
960EXTERN void glist_select(t_glist *x, t_gobj *y);
961EXTERN void glist_deselect(t_glist *x, t_gobj *y);
962EXTERN void glist_noselect(t_glist *x);
963EXTERN void glist_selectall(t_glist *x);
964EXTERN void glist_delete(t_glist *x, t_gobj *y);
965EXTERN void glist_retext(t_glist *x, t_text *y);
966EXTERN void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn,
967 t_glistkeyfn keyfn, int xpos, int ypos);
968EXTERN int glist_isvisible(t_glist *x);
969EXTERN int glist_istoplevel(t_glist *x);
970EXTERN t_glist *glist_findgraph(t_glist *x);
971EXTERN int glist_getfont(t_glist *x);
972EXTERN void glist_sort(t_glist *canvas);
973EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format);
974EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format);
975
976EXTERN float glist_pixelstox(t_glist *x, float xpix);
977EXTERN float glist_pixelstoy(t_glist *x, float ypix);
978EXTERN float glist_xtopixels(t_glist *x, float xval);
979EXTERN float glist_ytopixels(t_glist *x, float yval);
980EXTERN float glist_dpixtodx(t_glist *x, float dxpix);
981EXTERN float glist_dpixtody(t_glist *x, float dypix);
982
983EXTERN void glist_redrawitem(t_glist *owner, t_gobj *gobj);
984EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval);
985EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv);
986EXTERN t_glist *glist_addglist(t_glist *g, t_symbol *sym,
987 float x1, float y1, float x2, float y2,
988 float px1, float py1, float px2, float py2);
989EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name,
990 t_floatarg size, t_floatarg saveit, t_floatarg newgraph);
991EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething);
992EXTERN int glist_isgraph(t_glist *x);
993EXTERN void glist_redraw(t_glist *x);
994EXTERN void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime,
995 char *tag, int x1, int y1, int x2, int y2);
996EXTERN void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag);
997EXTERN void canvas_create_editor(t_glist *x, int createit);
998void canvas_deletelinesforio(t_canvas *x, t_text *text,
999 t_inlet *inp, t_outlet *outp);
1000
1001
1002/* -------------------- functions on texts ------------------------- */
1003EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize);
1004EXTERN void text_drawborder(t_text *x, t_glist *glist, char *tag,
1005 int width, int height, int firsttime);
1006EXTERN void text_eraseborder(t_text *x, t_glist *glist, char *tag);
1007EXTERN int text_xcoord(t_text *x, t_glist *glist);
1008EXTERN int text_ycoord(t_text *x, t_glist *glist);
1009EXTERN int text_xpix(t_text *x, t_glist *glist);
1010EXTERN int text_ypix(t_text *x, t_glist *glist);
1011EXTERN int text_shouldvis(t_text *x, t_glist *glist);
1012
1013/* -------------------- functions on rtexts ------------------------- */
1014#define RTEXT_DOWN 1
1015#define RTEXT_DRAG 2
1016#define RTEXT_DBL 3
1017#define RTEXT_SHIFT 4
1018
1019EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who);
1020EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who);
1021EXTERN void rtext_draw(t_rtext *x);
1022EXTERN void rtext_erase(t_rtext *x);
1023EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x);
1024EXTERN int rtext_height(t_rtext *x);
1025EXTERN void rtext_displace(t_rtext *x, int dx, int dy);
1026EXTERN void rtext_select(t_rtext *x, int state);
1027EXTERN void rtext_activate(t_rtext *x, int state);
1028EXTERN void rtext_free(t_rtext *x);
1029EXTERN void rtext_key(t_rtext *x, int n, t_symbol *s);
1030EXTERN void rtext_mouse(t_rtext *x, int xval, int yval, int flag);
1031EXTERN void rtext_retext(t_rtext *x);
1032EXTERN int rtext_width(t_rtext *x);
1033EXTERN int rtext_height(t_rtext *x);
1034EXTERN char *rtext_gettag(t_rtext *x);
1035EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize);
1036
1037/* -------------------- functions on canvases ------------------------ */
1038EXTERN t_class *canvas_class;
1039
1040EXTERN t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv);
1041EXTERN t_symbol *canvas_makebindsym(t_symbol *s);
1042EXTERN void canvas_vistext(t_canvas *x, t_text *y);
1043EXTERN void canvas_fixlinesfor(t_canvas *x, t_text *text);
1044EXTERN void canvas_deletelinesfor(t_canvas *x, t_text *text);
1045EXTERN void canvas_stowconnections(t_canvas *x);
1046EXTERN void canvas_restoreconnections(t_canvas *x);
1047EXTERN void canvas_redraw(t_canvas *x);
1048
1049EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym);
1050EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip);
1051EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym);
1052EXTERN void canvas_rmoutlet(t_canvas *x, t_outlet *op);
1053EXTERN void canvas_redrawallfortemplate(t_canvas *tmpl);
1054EXTERN void canvas_zapallfortemplate(t_canvas *tmpl);
1055EXTERN void canvas_setusedastemplate(t_canvas *x);
1056EXTERN t_canvas *canvas_getcurrent(void);
1057EXTERN void canvas_setcurrent(t_canvas *x);
1058EXTERN void canvas_unsetcurrent(t_canvas *x);
1059EXTERN t_symbol *canvas_realizedollar(t_canvas *x, t_symbol *s);
1060EXTERN t_canvas *canvas_getrootfor(t_canvas *x);
1061EXTERN void canvas_dirty(t_canvas *x, t_int n);
1062EXTERN int canvas_getfont(t_canvas *x);
1063typedef int (*t_canvasapply)(t_canvas *x, t_int x1, t_int x2, t_int x3);
1064
1065EXTERN t_int *canvas_recurapply(t_canvas *x, t_canvasapply *fn,
1066 t_int x1, t_int x2, t_int x3);
1067
1068EXTERN void canvas_resortinlets(t_canvas *x);
1069EXTERN void canvas_resortoutlets(t_canvas *x);
1070EXTERN void canvas_free(t_canvas *x);
1071EXTERN void canvas_updatewindowlist( void);
1072EXTERN void canvas_editmode(t_canvas *x, t_floatarg yesplease);
1073EXTERN int canvas_isabstraction(t_canvas *x);
1074EXTERN int canvas_istable(t_canvas *x);
1075EXTERN int canvas_showtext(t_canvas *x);
1076EXTERN void canvas_vis(t_canvas *x, t_floatarg f);
1077EXTERN t_canvasenvironment *canvas_getenv(t_canvas *x);
1078EXTERN void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir);
1079EXTERN void canvas_loadbang(t_canvas *x);
1080EXTERN int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos,
1081 int *x1p, int *y1p, int *x2p, int *y2p);
1082EXTERN int canvas_setdeleting(t_canvas *x, int flag);
1083
1084typedef void (*t_undofn)(t_canvas *canvas, void *buf,
1085 int action); /* a function that does UNDO/REDO */
1086#define UNDO_FREE 0 /* free current undo/redo buffer */
1087#define UNDO_UNDO 1 /* undo */
1088#define UNDO_REDO 2 /* redo */
1089EXTERN void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf,
1090 const char *name);
1091EXTERN void canvas_noundo(t_canvas *x);
1092EXTERN int canvas_getindex(t_canvas *x, t_gobj *y);
1093
1094/* T.Grill - made public for dynamic object creation */
1095/* in g_editor.c */
1096EXTERN void canvas_connect(t_canvas *x,
1097 t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno);
1098EXTERN void canvas_disconnect(t_canvas *x,
1099 float index1, float outno, float index2, float inno);
1100EXTERN int canvas_isconnected (t_canvas *x,
1101 t_text *ob1, int n1, t_text *ob2, int n2);
1102EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy);
1103
1104
1105/* ---- functions on canvasses as objects --------------------- */
1106
1107EXTERN void canvas_fattenforscalars(t_canvas *x,
1108 int *x1, int *y1, int *x2, int *y2);
1109EXTERN void canvas_visforscalars(t_canvas *x, t_glist *glist, int vis);
1110EXTERN int canvas_clicksub(t_canvas *x, int xpix, int ypix, int shift,
1111 int alt, int dbl, int doit);
1112EXTERN t_glist *canvas_getglistonsuper(void);
1113
1114EXTERN void linetraverser_start(t_linetraverser *t, t_canvas *x);
1115EXTERN t_outconnect *linetraverser_next(t_linetraverser *t);
1116EXTERN void linetraverser_skipobject(t_linetraverser *t);
1117
1118/* --------------------- functions on tscalars --------------------- */
1119
1120EXTERN void tscalar_getrect(t_tscalar *x, t_glist *owner,
1121 int *xp1, int *yp1, int *xp2, int *yp2);
1122EXTERN void tscalar_vis(t_tscalar *x, t_glist *owner, int flag);
1123EXTERN int tscalar_click(t_tscalar *x, int xpix, int ypix, int shift,
1124 int alt, int dbl, int doit);
1125
1126/* --------- functions on garrays (graphical arrays) -------------------- */
1127
1128EXTERN t_template *garray_template(t_garray *x);
1129
1130/* -------------------- arrays --------------------- */
1131EXTERN t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *tmpl,
1132 t_floatarg f, t_floatarg saveit);
1133EXTERN t_array *array_new(t_symbol *templatesym, t_gpointer *parent);
1134EXTERN void array_resize(t_array *x, t_template *tmpl, int n);
1135EXTERN void array_free(t_array *x);
1136
1137/* --------------------- gpointers and stubs ---------------- */
1138EXTERN t_gstub *gstub_new(t_glist *gl, t_array *a);
1139EXTERN void gstub_cutoff(t_gstub *gs);
1140EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x);
1141
1142/* --------------------- scalars ------------------------- */
1143EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp);
1144EXTERN void word_restore(t_word *wp, t_template *tmpl,
1145 int argc, t_atom *argv);
1146EXTERN t_scalar *scalar_new(t_glist *owner,
1147 t_symbol *templatesym);
1148EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey);
1149
1150/* ------helper routines for "garrays" and "plots" -------------- */
1151EXTERN int array_doclick(t_array *array, t_glist *glist, t_gobj *gobj,
1152 t_symbol *elemtemplatesym,
1153 float linewidth, float xloc, float xinc, float yloc,
1154 int xpix, int ypix, int shift, int alt, int dbl, int doit);
1155
1156EXTERN void array_getcoordinate(t_glist *glist,
1157 char *elem, int xonset, int yonset, int wonset, int indx,
1158 float basex, float basey, float xinc,
1159 float *xp, float *yp, float *wp);
1160
1161EXTERN int array_getfields(t_symbol *elemtemplatesym,
1162 t_canvas **elemtemplatecanvasp,
1163 t_template **elemtemplatep, int *elemsizep,
1164 int *xonsetp, int *yonsetp, int *wonsetp);
1165
1166/* --------------------- templates ------------------------- */
1167EXTERN t_template *template_new(t_symbol *sym, int argc, t_atom *argv);
1168EXTERN void template_free(t_template *x);
1169EXTERN int template_match(t_template *x1, t_template *x2);
1170EXTERN int template_find_field(t_template *x, t_symbol *name, int *p_onset,
1171 int *p_type, t_symbol **p_arraytype);
1172EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp,
1173 int loud);
1174EXTERN void template_setfloat(t_template *x, t_symbol *fieldname, t_word *wp,
1175 t_float f, int loud);
1176EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname,
1177 t_word *wp, int loud);
1178EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname,
1179 t_word *wp, t_symbol *s, int loud);
1180
1181EXTERN t_template *gtemplate_get(t_gtemplate *x);
1182EXTERN t_template *template_findbyname(t_symbol *s);
1183EXTERN t_canvas *template_findcanvas(t_template *tmpl);
1184
1185EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname,
1186 t_word *wp, int loud);
1187EXTERN void template_setfloat(t_template *x, t_symbol *fieldname,
1188 t_word *wp, t_float f, int loud);
1189EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname,
1190 t_word *wp, int loud);
1191EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname,
1192 t_word *wp, t_symbol *s, int loud);
1193
1194/* ----------------------- guiconnects, g_guiconnect.c --------- */
1195EXTERN t_guiconnect *guiconnect_new(t_pd *who, t_symbol *sym);
1196EXTERN void guiconnect_notarget(t_guiconnect *x, double timedelay);
1197
1198/* ------------- IEMGUI routines used in other g_ files ---------------- */
1199EXTERN t_symbol *iemgui_raute2dollar(t_symbol *s);
1200EXTERN t_symbol *iemgui_dollar2raute(t_symbol *s);
1201
1202#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
1203}
1204#endif