diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/g_canvas.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/extra/g_canvas.h | 601 |
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 | ||
608 | functions. "Glists" and "canvases" and "graphs" used to be different | ||
609 | structures until being unified in version 0.35. | ||
610 | |||
611 | A glist occupies its own window if the "gl_havewindow" flag is set. Its | ||
612 | appearance 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 | |||
615 | A glist is "root" if it has no owner, i.e., a document window. In this | ||
616 | case "gl_havewindow" is always set. | ||
617 | |||
618 | We maintain a list of root windows, so that we can traverse the whole | ||
619 | collection of everything in a Pd process. | ||
620 | |||
621 | If a glist has a window it may still not be "mapped." Miniaturized | ||
622 | windows aren't mapped, for example, but a window is also not mapped | ||
623 | immediately upon creation. In either case gl_havewindow is true but | ||
624 | gl_mapped is false. | ||
625 | |||
626 | Closing a non-root window makes it invisible; closing a root destroys it. | ||
627 | |||
628 | A glist that's just a text object on its parent is always "toplevel." An | ||
629 | embedded glist can switch back and forth to appear as a toplevel by double- | ||
630 | clicking on it. Single-clicking a text box makes the toplevel become visible | ||
631 | and raises the window it's in. | ||
632 | |||
633 | If a glist shows up as a graph on its parent, the graph is blanked while the | ||
634 | glist has its own window, even if miniaturized. | ||
635 | |||
636 | */ | ||
637 | |||
638 | /* NOTE: this file describes Pd implementation details which may change | ||
639 | in future releases. The public (stable) API is in m_pd.h. */ | ||
640 | |||
641 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
642 | extern "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 | |||
652 | typedef 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 */ | ||
660 | typedef void (*t_glistmotionfn)(void *z, t_floatarg dx, t_floatarg dy); | ||
661 | typedef void (*t_glistkeyfn)(void *z, t_floatarg key); | ||
662 | |||
663 | EXTERN_STRUCT _rtext; | ||
664 | #define t_rtext struct _rtext | ||
665 | 603 | ||
666 | EXTERN_STRUCT _gtemplate; | ||
667 | #define t_gtemplate struct _gtemplate | ||
668 | |||
669 | EXTERN_STRUCT _guiconnect; | ||
670 | #define t_guiconnect struct _guiconnect | ||
671 | |||
672 | EXTERN_STRUCT _tscalar; | ||
673 | #define t_tscalar struct _tscalar | ||
674 | |||
675 | EXTERN_STRUCT _canvasenvironment; | ||
676 | #define t_canvasenvironment struct _canvasenvironment | ||
677 | |||
678 | typedef 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. */ | ||
685 | typedef 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 | ||
720 | this structure when the "garray" becomes invisible or visible, although we | ||
721 | could do so if the structure gets big (like the "editor" above.) */ | ||
722 | |||
723 | typedef 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 | |||
731 | typedef 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 | ||
739 | area of a window. | ||
740 | |||
741 | */ | ||
742 | |||
743 | struct _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 | |||
794 | typedef 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 */ | ||
803 | typedef 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 | |||
812 | struct _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 */ | ||
824 | typedef 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 | ||
843 | widgets. We don't use Pd methods because Pd's typechecking can't specify the | ||
844 | types of pointer arguments. Also it's more convenient this way, since | ||
845 | every "patchable" object can just get the "text" behaviors. */ | ||
846 | |||
847 | /* Call this to get a gobj's bounding rectangle in pixels */ | ||
848 | typedef 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: */ | ||
851 | typedef void (*t_displacefn)(t_gobj *x, struct _glist *glist, int dx, int dy); | ||
852 | /* change color to show selection: */ | ||
853 | typedef void (*t_selectfn)(t_gobj *x, struct _glist *glist, int state); | ||
854 | /* change appearance to show activation/deactivation: */ | ||
855 | typedef void (*t_activatefn)(t_gobj *x, struct _glist *glist, int state); | ||
856 | /* warn a gobj it's about to be deleted */ | ||
857 | typedef void (*t_deletefn)(t_gobj *x, struct _glist *glist); | ||
858 | /* making visible or invisible */ | ||
859 | typedef void (*t_visfn)(t_gobj *x, struct _glist *glist, int flag); | ||
860 | /* field a mouse click (when not in "edit" mode) */ | ||
861 | typedef 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 | |||
865 | struct _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 | ||
878 | scalars, which live in some other window. If the scalar is just included | ||
879 | in a canvas the "parent" is a misnomer. There is also a text scalar object | ||
880 | which 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 | ||
883 | doesn't work on array elements... LATER reconsider this */ | ||
884 | |||
885 | /* bounding rectangle: */ | ||
886 | typedef 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 */ | ||
890 | typedef 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 */ | ||
894 | typedef 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: */ | ||
898 | typedef 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 */ | ||
902 | typedef 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 */ | ||
906 | typedef 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 | |||
910 | struct _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 | ||
928 | EXTERN void canvas_setcursor(t_glist *x, unsigned int cursornum); | ||
929 | |||
930 | extern t_canvas *canvas_editing; /* last canvas to start text edting */ | ||
931 | extern t_canvas *canvas_whichfind; /* last canvas we did a find in */ | ||
932 | extern t_canvas *canvas_list; /* list of all root canvases */ | ||
933 | extern t_class *vinlet_class, *voutlet_class; | ||
934 | extern int glist_valid; /* incremented when pointers might be stale */ | ||
935 | |||
936 | /* ------------------- functions on any gobj ----------------------------- */ | ||
937 | EXTERN void gobj_getrect(t_gobj *x, t_glist *owner, int *x1, int *y1, | ||
938 | int *x2, int *y2); | ||
939 | EXTERN void gobj_displace(t_gobj *x, t_glist *owner, int dx, int dy); | ||
940 | EXTERN void gobj_select(t_gobj *x, t_glist *owner, int state); | ||
941 | EXTERN void gobj_activate(t_gobj *x, t_glist *owner, int state); | ||
942 | EXTERN void gobj_delete(t_gobj *x, t_glist *owner); | ||
943 | EXTERN void gobj_vis(t_gobj *x, t_glist *glist, int flag); | ||
944 | EXTERN int gobj_click(t_gobj *x, struct _glist *glist, | ||
945 | int xpix, int ypix, int shift, int alt, int dbl, int doit); | ||
946 | EXTERN void gobj_save(t_gobj *x, t_binbuf *b); | ||
947 | EXTERN void gobj_properties(t_gobj *x, struct _glist *glist); | ||
948 | EXTERN void gobj_save(t_gobj *x, t_binbuf *b); | ||
949 | |||
950 | /* -------------------- functions on glists --------------------- */ | ||
951 | EXTERN t_glist *glist_new( void); | ||
952 | EXTERN void glist_init(t_glist *x); | ||
953 | EXTERN void glist_add(t_glist *x, t_gobj *g); | ||
954 | EXTERN void glist_cleanup(t_glist *x); | ||
955 | EXTERN void glist_free(t_glist *x); | ||
956 | |||
957 | EXTERN void glist_clear(t_glist *x); | ||
958 | EXTERN t_canvas *glist_getcanvas(t_glist *x); | ||
959 | EXTERN int glist_isselected(t_glist *x, t_gobj *y); | ||
960 | EXTERN void glist_select(t_glist *x, t_gobj *y); | ||
961 | EXTERN void glist_deselect(t_glist *x, t_gobj *y); | ||
962 | EXTERN void glist_noselect(t_glist *x); | ||
963 | EXTERN void glist_selectall(t_glist *x); | ||
964 | EXTERN void glist_delete(t_glist *x, t_gobj *y); | ||
965 | EXTERN void glist_retext(t_glist *x, t_text *y); | ||
966 | EXTERN void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, | ||
967 | t_glistkeyfn keyfn, int xpos, int ypos); | ||
968 | EXTERN int glist_isvisible(t_glist *x); | ||
969 | EXTERN int glist_istoplevel(t_glist *x); | ||
970 | EXTERN t_glist *glist_findgraph(t_glist *x); | ||
971 | EXTERN int glist_getfont(t_glist *x); | ||
972 | EXTERN void glist_sort(t_glist *canvas); | ||
973 | EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format); | ||
974 | EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format); | ||
975 | |||
976 | EXTERN float glist_pixelstox(t_glist *x, float xpix); | ||
977 | EXTERN float glist_pixelstoy(t_glist *x, float ypix); | ||
978 | EXTERN float glist_xtopixels(t_glist *x, float xval); | ||
979 | EXTERN float glist_ytopixels(t_glist *x, float yval); | ||
980 | EXTERN float glist_dpixtodx(t_glist *x, float dxpix); | ||
981 | EXTERN float glist_dpixtody(t_glist *x, float dypix); | ||
982 | |||
983 | EXTERN void glist_redrawitem(t_glist *owner, t_gobj *gobj); | ||
984 | EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval); | ||
985 | EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv); | ||
986 | EXTERN 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); | ||
989 | EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name, | ||
990 | t_floatarg size, t_floatarg saveit, t_floatarg newgraph); | ||
991 | EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething); | ||
992 | EXTERN int glist_isgraph(t_glist *x); | ||
993 | EXTERN void glist_redraw(t_glist *x); | ||
994 | EXTERN void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, | ||
995 | char *tag, int x1, int y1, int x2, int y2); | ||
996 | EXTERN void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag); | ||
997 | EXTERN void canvas_create_editor(t_glist *x, int createit); | ||
998 | void canvas_deletelinesforio(t_canvas *x, t_text *text, | ||
999 | t_inlet *inp, t_outlet *outp); | ||
1000 | |||
1001 | |||
1002 | /* -------------------- functions on texts ------------------------- */ | ||
1003 | EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize); | ||
1004 | EXTERN void text_drawborder(t_text *x, t_glist *glist, char *tag, | ||
1005 | int width, int height, int firsttime); | ||
1006 | EXTERN void text_eraseborder(t_text *x, t_glist *glist, char *tag); | ||
1007 | EXTERN int text_xcoord(t_text *x, t_glist *glist); | ||
1008 | EXTERN int text_ycoord(t_text *x, t_glist *glist); | ||
1009 | EXTERN int text_xpix(t_text *x, t_glist *glist); | ||
1010 | EXTERN int text_ypix(t_text *x, t_glist *glist); | ||
1011 | EXTERN 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 | |||
1019 | EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who); | ||
1020 | EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who); | ||
1021 | EXTERN void rtext_draw(t_rtext *x); | ||
1022 | EXTERN void rtext_erase(t_rtext *x); | ||
1023 | EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x); | ||
1024 | EXTERN int rtext_height(t_rtext *x); | ||
1025 | EXTERN void rtext_displace(t_rtext *x, int dx, int dy); | ||
1026 | EXTERN void rtext_select(t_rtext *x, int state); | ||
1027 | EXTERN void rtext_activate(t_rtext *x, int state); | ||
1028 | EXTERN void rtext_free(t_rtext *x); | ||
1029 | EXTERN void rtext_key(t_rtext *x, int n, t_symbol *s); | ||
1030 | EXTERN void rtext_mouse(t_rtext *x, int xval, int yval, int flag); | ||
1031 | EXTERN void rtext_retext(t_rtext *x); | ||
1032 | EXTERN int rtext_width(t_rtext *x); | ||
1033 | EXTERN int rtext_height(t_rtext *x); | ||
1034 | EXTERN char *rtext_gettag(t_rtext *x); | ||
1035 | EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize); | ||
1036 | |||
1037 | /* -------------------- functions on canvases ------------------------ */ | ||
1038 | EXTERN t_class *canvas_class; | ||
1039 | |||
1040 | EXTERN t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv); | ||
1041 | EXTERN t_symbol *canvas_makebindsym(t_symbol *s); | ||
1042 | EXTERN void canvas_vistext(t_canvas *x, t_text *y); | ||
1043 | EXTERN void canvas_fixlinesfor(t_canvas *x, t_text *text); | ||
1044 | EXTERN void canvas_deletelinesfor(t_canvas *x, t_text *text); | ||
1045 | EXTERN void canvas_stowconnections(t_canvas *x); | ||
1046 | EXTERN void canvas_restoreconnections(t_canvas *x); | ||
1047 | EXTERN void canvas_redraw(t_canvas *x); | ||
1048 | |||
1049 | EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym); | ||
1050 | EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip); | ||
1051 | EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym); | ||
1052 | EXTERN void canvas_rmoutlet(t_canvas *x, t_outlet *op); | ||
1053 | EXTERN void canvas_redrawallfortemplate(t_canvas *tmpl); | ||
1054 | EXTERN void canvas_zapallfortemplate(t_canvas *tmpl); | ||
1055 | EXTERN void canvas_setusedastemplate(t_canvas *x); | ||
1056 | EXTERN t_canvas *canvas_getcurrent(void); | ||
1057 | EXTERN void canvas_setcurrent(t_canvas *x); | ||
1058 | EXTERN void canvas_unsetcurrent(t_canvas *x); | ||
1059 | EXTERN t_symbol *canvas_realizedollar(t_canvas *x, t_symbol *s); | ||
1060 | EXTERN t_canvas *canvas_getrootfor(t_canvas *x); | ||
1061 | EXTERN void canvas_dirty(t_canvas *x, t_int n); | ||
1062 | EXTERN int canvas_getfont(t_canvas *x); | ||
1063 | typedef int (*t_canvasapply)(t_canvas *x, t_int x1, t_int x2, t_int x3); | ||
1064 | |||
1065 | EXTERN t_int *canvas_recurapply(t_canvas *x, t_canvasapply *fn, | ||
1066 | t_int x1, t_int x2, t_int x3); | ||
1067 | |||
1068 | EXTERN void canvas_resortinlets(t_canvas *x); | ||
1069 | EXTERN void canvas_resortoutlets(t_canvas *x); | ||
1070 | EXTERN void canvas_free(t_canvas *x); | ||
1071 | EXTERN void canvas_updatewindowlist( void); | ||
1072 | EXTERN void canvas_editmode(t_canvas *x, t_floatarg yesplease); | ||
1073 | EXTERN int canvas_isabstraction(t_canvas *x); | ||
1074 | EXTERN int canvas_istable(t_canvas *x); | ||
1075 | EXTERN int canvas_showtext(t_canvas *x); | ||
1076 | EXTERN void canvas_vis(t_canvas *x, t_floatarg f); | ||
1077 | EXTERN t_canvasenvironment *canvas_getenv(t_canvas *x); | ||
1078 | EXTERN void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir); | ||
1079 | EXTERN void canvas_loadbang(t_canvas *x); | ||
1080 | EXTERN int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos, | ||
1081 | int *x1p, int *y1p, int *x2p, int *y2p); | ||
1082 | EXTERN int canvas_setdeleting(t_canvas *x, int flag); | ||
1083 | |||
1084 | typedef 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 */ | ||
1089 | EXTERN void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, | ||
1090 | const char *name); | ||
1091 | EXTERN void canvas_noundo(t_canvas *x); | ||
1092 | EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); | ||
1093 | |||
1094 | /* T.Grill - made public for dynamic object creation */ | ||
1095 | /* in g_editor.c */ | ||
1096 | EXTERN void canvas_connect(t_canvas *x, | ||
1097 | t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno); | ||
1098 | EXTERN void canvas_disconnect(t_canvas *x, | ||
1099 | float index1, float outno, float index2, float inno); | ||
1100 | EXTERN int canvas_isconnected (t_canvas *x, | ||
1101 | t_text *ob1, int n1, t_text *ob2, int n2); | ||
1102 | EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy); | ||
1103 | |||
1104 | |||
1105 | /* ---- functions on canvasses as objects --------------------- */ | ||
1106 | |||
1107 | EXTERN void canvas_fattenforscalars(t_canvas *x, | ||
1108 | int *x1, int *y1, int *x2, int *y2); | ||
1109 | EXTERN void canvas_visforscalars(t_canvas *x, t_glist *glist, int vis); | ||
1110 | EXTERN int canvas_clicksub(t_canvas *x, int xpix, int ypix, int shift, | ||
1111 | int alt, int dbl, int doit); | ||
1112 | EXTERN t_glist *canvas_getglistonsuper(void); | ||
1113 | |||
1114 | EXTERN void linetraverser_start(t_linetraverser *t, t_canvas *x); | ||
1115 | EXTERN t_outconnect *linetraverser_next(t_linetraverser *t); | ||
1116 | EXTERN void linetraverser_skipobject(t_linetraverser *t); | ||
1117 | |||
1118 | /* --------------------- functions on tscalars --------------------- */ | ||
1119 | |||
1120 | EXTERN void tscalar_getrect(t_tscalar *x, t_glist *owner, | ||
1121 | int *xp1, int *yp1, int *xp2, int *yp2); | ||
1122 | EXTERN void tscalar_vis(t_tscalar *x, t_glist *owner, int flag); | ||
1123 | EXTERN 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 | |||
1128 | EXTERN t_template *garray_template(t_garray *x); | ||
1129 | |||
1130 | /* -------------------- arrays --------------------- */ | ||
1131 | EXTERN t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *tmpl, | ||
1132 | t_floatarg f, t_floatarg saveit); | ||
1133 | EXTERN t_array *array_new(t_symbol *templatesym, t_gpointer *parent); | ||
1134 | EXTERN void array_resize(t_array *x, t_template *tmpl, int n); | ||
1135 | EXTERN void array_free(t_array *x); | ||
1136 | |||
1137 | /* --------------------- gpointers and stubs ---------------- */ | ||
1138 | EXTERN t_gstub *gstub_new(t_glist *gl, t_array *a); | ||
1139 | EXTERN void gstub_cutoff(t_gstub *gs); | ||
1140 | EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x); | ||
1141 | |||
1142 | /* --------------------- scalars ------------------------- */ | ||
1143 | EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp); | ||
1144 | EXTERN void word_restore(t_word *wp, t_template *tmpl, | ||
1145 | int argc, t_atom *argv); | ||
1146 | EXTERN t_scalar *scalar_new(t_glist *owner, | ||
1147 | t_symbol *templatesym); | ||
1148 | EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey); | ||
1149 | |||
1150 | /* ------helper routines for "garrays" and "plots" -------------- */ | ||
1151 | EXTERN 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 | |||
1156 | EXTERN 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 | |||
1161 | EXTERN 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 ------------------------- */ | ||
1167 | EXTERN t_template *template_new(t_symbol *sym, int argc, t_atom *argv); | ||
1168 | EXTERN void template_free(t_template *x); | ||
1169 | EXTERN int template_match(t_template *x1, t_template *x2); | ||
1170 | EXTERN int template_find_field(t_template *x, t_symbol *name, int *p_onset, | ||
1171 | int *p_type, t_symbol **p_arraytype); | ||
1172 | EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp, | ||
1173 | int loud); | ||
1174 | EXTERN void template_setfloat(t_template *x, t_symbol *fieldname, t_word *wp, | ||
1175 | t_float f, int loud); | ||
1176 | EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname, | ||
1177 | t_word *wp, int loud); | ||
1178 | EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, | ||
1179 | t_word *wp, t_symbol *s, int loud); | ||
1180 | |||
1181 | EXTERN t_template *gtemplate_get(t_gtemplate *x); | ||
1182 | EXTERN t_template *template_findbyname(t_symbol *s); | ||
1183 | EXTERN t_canvas *template_findcanvas(t_template *tmpl); | ||
1184 | |||
1185 | EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, | ||
1186 | t_word *wp, int loud); | ||
1187 | EXTERN void template_setfloat(t_template *x, t_symbol *fieldname, | ||
1188 | t_word *wp, t_float f, int loud); | ||
1189 | EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname, | ||
1190 | t_word *wp, int loud); | ||
1191 | EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, | ||
1192 | t_word *wp, t_symbol *s, int loud); | ||
1193 | |||
1194 | /* ----------------------- guiconnects, g_guiconnect.c --------- */ | ||
1195 | EXTERN t_guiconnect *guiconnect_new(t_pd *who, t_symbol *sym); | ||
1196 | EXTERN void guiconnect_notarget(t_guiconnect *x, double timedelay); | ||
1197 | |||
1198 | /* ------------- IEMGUI routines used in other g_ files ---------------- */ | ||
1199 | EXTERN t_symbol *iemgui_raute2dollar(t_symbol *s); | ||
1200 | EXTERN t_symbol *iemgui_dollar2raute(t_symbol *s); | ||
1201 | |||
1202 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
1203 | } | ||
1204 | #endif | ||