diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-05-22 21:58:48 +0000 |
commit | 513389b4c1bc8afe4b2dc9947c534bfeb105e3da (patch) | |
tree | 10e673b35651ac567fed2eda0c679c7ade64cbc6 /apps/plugins/pdbox/PDa/src/g_canvas.h | |
parent | 95fa7f6a2ef466444fbe3fe87efc6d5db6b77b36 (diff) | |
download | rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.tar.gz rockbox-513389b4c1bc8afe4b2dc9947c534bfeb105e3da.zip |
Add FS #10214. Initial commit of the original PDa code for the GSoC Pure Data plugin project of Wincent Balin. Stripped some non-sourcefiles and added a rockbox readme that needs a bit more info from Wincent. Is added to CATEGORIES and viewers, but not yet to SUBDIRS (ie doesn't build yet)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21044 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/g_canvas.h')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/g_canvas.h | 1204 |
1 files changed, 1204 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/g_canvas.h b/apps/plugins/pdbox/PDa/src/g_canvas.h new file mode 100644 index 0000000000..54ab985feb --- /dev/null +++ b/apps/plugins/pdbox/PDa/src/g_canvas.h | |||
@@ -0,0 +1,1204 @@ | |||
1 | /* Copyright (c) 1997-1999 Miller Puckette. | ||
2 | * For information on usage and redistribution, and for a DISCLAIMER OF ALL | ||
3 | * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ | ||
4 | |||
5 | /* this file defines the structure for "glists" and related structures and | ||
6 | functions. "Glists" and "canvases" and "graphs" used to be different | ||
7 | structures until being unified in version 0.35. | ||
8 | |||
9 | A glist occupies its own window if the "gl_havewindow" flag is set. Its | ||
10 | appearance on its "parent" or "owner" (if it has one) is as a graph if | ||
11 | "gl_isgraph" is set, and otherwise as a text box. | ||
12 | |||
13 | A glist is "root" if it has no owner, i.e., a document window. In this | ||
14 | case "gl_havewindow" is always set. | ||
15 | |||
16 | We maintain a list of root windows, so that we can traverse the whole | ||
17 | collection of everything in a Pd process. | ||
18 | |||
19 | If a glist has a window it may still not be "mapped." Miniaturized | ||
20 | windows aren't mapped, for example, but a window is also not mapped | ||
21 | immediately upon creation. In either case gl_havewindow is true but | ||
22 | gl_mapped is false. | ||
23 | |||
24 | Closing a non-root window makes it invisible; closing a root destroys it. | ||
25 | |||
26 | A glist that's just a text object on its parent is always "toplevel." An | ||
27 | embedded glist can switch back and forth to appear as a toplevel by double- | ||
28 | clicking on it. Single-clicking a text box makes the toplevel become visible | ||
29 | and raises the window it's in. | ||
30 | |||
31 | If a glist shows up as a graph on its parent, the graph is blanked while the | ||
32 | glist has its own window, even if miniaturized. | ||
33 | |||
34 | */ | ||
35 | |||
36 | /* NOTE: this file describes Pd implementation details which may change | ||
37 | in future releases. The public (stable) API is in m_pd.h. */ | ||
38 | |||
39 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
40 | extern "C" { | ||
41 | #endif | ||
42 | |||
43 | /* --------------------- geometry ---------------------------- */ | ||
44 | #define IOWIDTH 7 /* width of an inlet/outlet in pixels */ | ||
45 | #define IOMIDDLE ((IOWIDTH-1)/2) | ||
46 | #define GLIST_DEFGRAPHWIDTH 200 | ||
47 | #define GLIST_DEFGRAPHHEIGHT 140 | ||
48 | /* ----------------------- data ------------------------------- */ | ||
49 | |||
50 | typedef struct _updateheader | ||
51 | { | ||
52 | struct _updateheader *upd_next; | ||
53 | unsigned int upd_array:1; /* true if array, false if glist */ | ||
54 | unsigned int upd_queued:1; /* true if we're queued */ | ||
55 | } t_updateheader; | ||
56 | |||
57 | /* types to support glists grabbing mouse motion or keys from parent */ | ||
58 | typedef void (*t_glistmotionfn)(void *z, t_floatarg dx, t_floatarg dy); | ||
59 | typedef void (*t_glistkeyfn)(void *z, t_floatarg key); | ||
60 | |||
61 | EXTERN_STRUCT _rtext; | ||
62 | #define t_rtext struct _rtext | ||
63 | |||
64 | EXTERN_STRUCT _gtemplate; | ||
65 | #define t_gtemplate struct _gtemplate | ||
66 | |||
67 | EXTERN_STRUCT _guiconnect; | ||
68 | #define t_guiconnect struct _guiconnect | ||
69 | |||
70 | EXTERN_STRUCT _tscalar; | ||
71 | #define t_tscalar struct _tscalar | ||
72 | |||
73 | EXTERN_STRUCT _canvasenvironment; | ||
74 | #define t_canvasenvironment struct _canvasenvironment | ||
75 | |||
76 | typedef struct _selection | ||
77 | { | ||
78 | t_gobj *sel_what; | ||
79 | struct _selection *sel_next; | ||
80 | } t_selection; | ||
81 | |||
82 | /* this structure is instantiated whenever a glist becomes visible. */ | ||
83 | typedef struct _editor | ||
84 | { | ||
85 | t_updateheader e_upd; /* update header structure */ | ||
86 | t_selection *e_updlist; /* list of objects to update */ | ||
87 | t_rtext *e_rtext; /* text responder linked list */ | ||
88 | t_selection *e_selection; /* head of the selection list */ | ||
89 | t_rtext *e_textedfor; /* the rtext if any that we are editing */ | ||
90 | t_gobj *e_grab; /* object being "dragged" */ | ||
91 | t_glistmotionfn e_motionfn; /* ... motion callback */ | ||
92 | t_glistkeyfn e_keyfn; /* ... keypress callback */ | ||
93 | t_binbuf *e_connectbuf; /* connections to deleted objects */ | ||
94 | t_binbuf *e_deleted; /* last stuff we deleted */ | ||
95 | t_guiconnect *e_guiconnect; /* GUI connection for filtering messages */ | ||
96 | struct _glist *e_glist; /* glist which owns this */ | ||
97 | int e_xwas; /* xpos on last mousedown or motion event */ | ||
98 | int e_ywas; /* ypos, similarly */ | ||
99 | int e_selectline_index1; /* indices for the selected line if any */ | ||
100 | int e_selectline_outno; /* (only valid if e_selectedline is set) */ | ||
101 | int e_selectline_index2; | ||
102 | int e_selectline_inno; | ||
103 | t_outconnect *e_selectline_tag; | ||
104 | unsigned int e_onmotion: 3; /* action to take on motion */ | ||
105 | unsigned int e_lastmoved: 1; /* one if mouse has moved since click */ | ||
106 | unsigned int e_textdirty: 1; /* one if e_textedfor has changed */ | ||
107 | unsigned int e_selectedline: 1; /* one if a line is selected */ | ||
108 | } t_editor; | ||
109 | |||
110 | #define MA_NONE 0 /* e_onmotion: do nothing on mouse motion */ | ||
111 | #define MA_MOVE 1 /* drag the selection around */ | ||
112 | #define MA_CONNECT 2 /* make a connection */ | ||
113 | #define MA_REGION 3 /* selection region */ | ||
114 | #define MA_PASSOUT 4 /* send on to e_grab */ | ||
115 | #define MA_DRAGTEXT 5 /* drag in text editor to alter selection */ | ||
116 | |||
117 | /* editor structure for "garrays". We don't bother to delete and regenerate | ||
118 | this structure when the "garray" becomes invisible or visible, although we | ||
119 | could do so if the structure gets big (like the "editor" above.) */ | ||
120 | |||
121 | typedef struct _arrayvis | ||
122 | { | ||
123 | t_updateheader av_upd; /* update header structure */ | ||
124 | t_garray *av_garray; /* owning structure */ | ||
125 | } t_arrayvis; | ||
126 | |||
127 | /* the t_tick structure describes where to draw x and y "ticks" for a glist */ | ||
128 | |||
129 | typedef struct _tick /* where to put ticks on x or y axes */ | ||
130 | { | ||
131 | float k_point; /* one point to draw a big tick at */ | ||
132 | float k_inc; /* x or y increment per little tick */ | ||
133 | int k_lperb; /* little ticks per big; 0 if no ticks to draw */ | ||
134 | } t_tick; | ||
135 | |||
136 | /* the t_glist structure, which describes a list of elements that live on an | ||
137 | area of a window. | ||
138 | |||
139 | */ | ||
140 | |||
141 | struct _glist | ||
142 | { | ||
143 | t_object gl_obj; /* header in case we're a glist */ | ||
144 | t_gobj *gl_list; /* the actual data */ | ||
145 | struct _gstub *gl_stub; /* safe pointer handler */ | ||
146 | int gl_valid; /* incremented when pointers might be stale */ | ||
147 | struct _glist *gl_owner; /* parent glist, supercanvas, or 0 if none */ | ||
148 | int gl_pixwidth; /* width in pixels (on parent, if a graph) */ | ||
149 | int gl_pixheight; | ||
150 | float gl_x1; /* bounding rectangle in our own coordinates */ | ||
151 | float gl_y1; | ||
152 | float gl_x2; | ||
153 | float gl_y2; | ||
154 | int gl_screenx1; /* screen coordinates when toplevel */ | ||
155 | int gl_screeny1; | ||
156 | int gl_screenx2; | ||
157 | int gl_screeny2; | ||
158 | t_tick gl_xtick; /* ticks marking X values */ | ||
159 | int gl_nxlabels; /* number of X coordinate labels */ | ||
160 | t_symbol **gl_xlabel; /* ... an array to hold them */ | ||
161 | float gl_xlabely; /* ... and their Y coordinates */ | ||
162 | t_tick gl_ytick; /* same as above for Y ticks and labels */ | ||
163 | int gl_nylabels; | ||
164 | t_symbol **gl_ylabel; | ||
165 | float gl_ylabelx; | ||
166 | t_editor *gl_editor; /* editor structure when visible */ | ||
167 | t_symbol *gl_name; /* symbol bound here */ | ||
168 | int gl_font; /* nominal font size in points, e.g., 10 */ | ||
169 | struct _glist *gl_next; /* link in list of toplevels */ | ||
170 | t_canvasenvironment *gl_env; /* root canvases and abstractions only */ | ||
171 | unsigned int gl_havewindow:1; /* true if we own a window */ | ||
172 | unsigned int gl_mapped:1; /* true if, moreover, it's "mapped" */ | ||
173 | unsigned int gl_dirty:1; /* (root canvas only:) patch has changed */ | ||
174 | unsigned int gl_loading:1; /* am now loading from file */ | ||
175 | unsigned int gl_willvis:1; /* make me visible after loading */ | ||
176 | unsigned int gl_edit:1; /* edit mode */ | ||
177 | unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */ | ||
178 | unsigned int gl_stretch:1; /* stretch contents on resize */ | ||
179 | unsigned int gl_isgraph:1; /* show as graph on parent */ | ||
180 | }; | ||
181 | |||
182 | #define gl_gobj gl_obj.te_g | ||
183 | #define gl_pd gl_gobj.g_pd | ||
184 | |||
185 | /* a data structure to describe a field in a pure datum */ | ||
186 | |||
187 | #define DT_FLOAT 0 | ||
188 | #define DT_SYMBOL 1 | ||
189 | #define DT_LIST 2 | ||
190 | #define DT_ARRAY 3 | ||
191 | |||
192 | typedef struct _dataslot | ||
193 | { | ||
194 | int ds_type; | ||
195 | t_symbol *ds_name; | ||
196 | t_symbol *ds_arraytemplate; /* filled in for arrays only */ | ||
197 | } t_dataslot; | ||
198 | |||
199 | |||
200 | /* T.Grill - changed t_pd member to t_pdobj to avoid name clashed */ | ||
201 | typedef struct _template | ||
202 | { | ||
203 | t_pd t_pdobj; /* header */ | ||
204 | struct _gtemplate *t_list; /* list of "struct"/gtemplate objects */ | ||
205 | t_symbol *t_sym; /* name */ | ||
206 | int t_n; /* number of dataslots (fields) */ | ||
207 | t_dataslot *t_vec; /* array of dataslots */ | ||
208 | } t_template; | ||
209 | |||
210 | struct _array | ||
211 | { | ||
212 | int a_n; /* number of elements */ | ||
213 | int a_elemsize; /* size in bytes; LATER get this from template */ | ||
214 | char *a_vec; /* array of elements */ | ||
215 | t_symbol *a_templatesym; /* template for elements */ | ||
216 | int a_valid; /* protection against stale pointers into array */ | ||
217 | t_gpointer a_gp; /* pointer to scalar or array element we're in */ | ||
218 | t_gstub *a_stub; | ||
219 | }; | ||
220 | |||
221 | /* structure for traversing all the connections in a glist */ | ||
222 | typedef struct _linetraverser | ||
223 | { | ||
224 | t_canvas *tr_x; | ||
225 | t_object *tr_ob; | ||
226 | int tr_nout; | ||
227 | int tr_outno; | ||
228 | t_object *tr_ob2; | ||
229 | t_outlet *tr_outlet; | ||
230 | t_inlet *tr_inlet; | ||
231 | int tr_nin; | ||
232 | int tr_inno; | ||
233 | int tr_x11, tr_y11, tr_x12, tr_y12; | ||
234 | int tr_x21, tr_y21, tr_x22, tr_y22; | ||
235 | int tr_lx1, tr_ly1, tr_lx2, tr_ly2; | ||
236 | t_outconnect *tr_nextoc; | ||
237 | int tr_nextoutno; | ||
238 | } t_linetraverser; | ||
239 | |||
240 | /* function types used to define graphical behavior for gobjs, a bit like X | ||
241 | widgets. We don't use Pd methods because Pd's typechecking can't specify the | ||
242 | types of pointer arguments. Also it's more convenient this way, since | ||
243 | every "patchable" object can just get the "text" behaviors. */ | ||
244 | |||
245 | /* Call this to get a gobj's bounding rectangle in pixels */ | ||
246 | typedef void (*t_getrectfn)(t_gobj *x, struct _glist *glist, | ||
247 | int *x1, int *y1, int *x2, int *y2); | ||
248 | /* and this to displace a gobj: */ | ||
249 | typedef void (*t_displacefn)(t_gobj *x, struct _glist *glist, int dx, int dy); | ||
250 | /* change color to show selection: */ | ||
251 | typedef void (*t_selectfn)(t_gobj *x, struct _glist *glist, int state); | ||
252 | /* change appearance to show activation/deactivation: */ | ||
253 | typedef void (*t_activatefn)(t_gobj *x, struct _glist *glist, int state); | ||
254 | /* warn a gobj it's about to be deleted */ | ||
255 | typedef void (*t_deletefn)(t_gobj *x, struct _glist *glist); | ||
256 | /* making visible or invisible */ | ||
257 | typedef void (*t_visfn)(t_gobj *x, struct _glist *glist, int flag); | ||
258 | /* field a mouse click (when not in "edit" mode) */ | ||
259 | typedef int (*t_clickfn)(t_gobj *x, struct _glist *glist, | ||
260 | int xpix, int ypix, int shift, int alt, int dbl, int doit); | ||
261 | /* ... and later, resizing; getting/setting font or color... */ | ||
262 | |||
263 | struct _widgetbehavior | ||
264 | { | ||
265 | t_getrectfn w_getrectfn; | ||
266 | t_displacefn w_displacefn; | ||
267 | t_selectfn w_selectfn; | ||
268 | t_activatefn w_activatefn; | ||
269 | t_deletefn w_deletefn; | ||
270 | t_visfn w_visfn; | ||
271 | t_clickfn w_clickfn; | ||
272 | }; | ||
273 | |||
274 | /* -------- behaviors for scalars defined by objects in template --------- */ | ||
275 | /* these are set by "drawing commands" in g_template.c which add appearance to | ||
276 | scalars, which live in some other window. If the scalar is just included | ||
277 | in a canvas the "parent" is a misnomer. There is also a text scalar object | ||
278 | which really does draw the scalar on the parent window; see g_scalar.c. */ | ||
279 | |||
280 | /* note how the click function wants the whole scalar, not the "data", so | ||
281 | doesn't work on array elements... LATER reconsider this */ | ||
282 | |||
283 | /* bounding rectangle: */ | ||
284 | typedef void (*t_parentgetrectfn)(t_gobj *x, struct _glist *glist, | ||
285 | t_word *data, t_template *tmpl, float basex, float basey, | ||
286 | int *x1, int *y1, int *x2, int *y2); | ||
287 | /* displace it */ | ||
288 | typedef void (*t_parentdisplacefn)(t_gobj *x, struct _glist *glist, | ||
289 | t_word *data, t_template *tmpl, float basex, float basey, | ||
290 | int dx, int dy); | ||
291 | /* change color to show selection */ | ||
292 | typedef void (*t_parentselectfn)(t_gobj *x, struct _glist *glist, | ||
293 | t_word *data, t_template *tmpl, float basex, float basey, | ||
294 | int state); | ||
295 | /* change appearance to show activation/deactivation: */ | ||
296 | typedef void (*t_parentactivatefn)(t_gobj *x, struct _glist *glist, | ||
297 | t_word *data, t_template *tmpl, float basex, float basey, | ||
298 | int state); | ||
299 | /* making visible or invisible */ | ||
300 | typedef void (*t_parentvisfn)(t_gobj *x, struct _glist *glist, | ||
301 | t_word *data, t_template *tmpl, float basex, float basey, | ||
302 | int flag); | ||
303 | /* field a mouse click */ | ||
304 | typedef int (*t_parentclickfn)(t_gobj *x, struct _glist *glist, | ||
305 | t_scalar *sc, t_template *tmpl, float basex, float basey, | ||
306 | int xpix, int ypix, int shift, int alt, int dbl, int doit); | ||
307 | |||
308 | struct _parentwidgetbehavior | ||
309 | { | ||
310 | t_parentgetrectfn w_parentgetrectfn; | ||
311 | t_parentdisplacefn w_parentdisplacefn; | ||
312 | t_parentselectfn w_parentselectfn; | ||
313 | t_parentactivatefn w_parentactivatefn; | ||
314 | t_parentvisfn w_parentvisfn; | ||
315 | t_parentclickfn w_parentclickfn; | ||
316 | }; | ||
317 | |||
318 | /* cursor definitions; used as return value for t_parentclickfn */ | ||
319 | #define CURSOR_RUNMODE_NOTHING 0 | ||
320 | #define CURSOR_RUNMODE_CLICKME 1 | ||
321 | #define CURSOR_RUNMODE_THICKEN 2 | ||
322 | #define CURSOR_RUNMODE_ADDPOINT 3 | ||
323 | #define CURSOR_EDITMODE_NOTHING 4 | ||
324 | #define CURSOR_EDITMODE_CONNECT 5 | ||
325 | #define CURSOR_EDITMODE_DISCONNECT 6 | ||
326 | EXTERN void canvas_setcursor(t_glist *x, unsigned int cursornum); | ||
327 | |||
328 | extern t_canvas *canvas_editing; /* last canvas to start text edting */ | ||
329 | extern t_canvas *canvas_whichfind; /* last canvas we did a find in */ | ||
330 | extern t_canvas *canvas_list; /* list of all root canvases */ | ||
331 | extern t_class *vinlet_class, *voutlet_class; | ||
332 | extern int glist_valid; /* incremented when pointers might be stale */ | ||
333 | |||
334 | /* ------------------- functions on any gobj ----------------------------- */ | ||
335 | EXTERN void gobj_getrect(t_gobj *x, t_glist *owner, int *x1, int *y1, | ||
336 | int *x2, int *y2); | ||
337 | EXTERN void gobj_displace(t_gobj *x, t_glist *owner, int dx, int dy); | ||
338 | EXTERN void gobj_select(t_gobj *x, t_glist *owner, int state); | ||
339 | EXTERN void gobj_activate(t_gobj *x, t_glist *owner, int state); | ||
340 | EXTERN void gobj_delete(t_gobj *x, t_glist *owner); | ||
341 | EXTERN void gobj_vis(t_gobj *x, t_glist *glist, int flag); | ||
342 | EXTERN int gobj_click(t_gobj *x, struct _glist *glist, | ||
343 | int xpix, int ypix, int shift, int alt, int dbl, int doit); | ||
344 | EXTERN void gobj_save(t_gobj *x, t_binbuf *b); | ||
345 | EXTERN void gobj_properties(t_gobj *x, struct _glist *glist); | ||
346 | EXTERN void gobj_save(t_gobj *x, t_binbuf *b); | ||
347 | |||
348 | /* -------------------- functions on glists --------------------- */ | ||
349 | EXTERN t_glist *glist_new( void); | ||
350 | EXTERN void glist_init(t_glist *x); | ||
351 | EXTERN void glist_add(t_glist *x, t_gobj *g); | ||
352 | EXTERN void glist_cleanup(t_glist *x); | ||
353 | EXTERN void glist_free(t_glist *x); | ||
354 | |||
355 | EXTERN void glist_clear(t_glist *x); | ||
356 | EXTERN t_canvas *glist_getcanvas(t_glist *x); | ||
357 | EXTERN int glist_isselected(t_glist *x, t_gobj *y); | ||
358 | EXTERN void glist_select(t_glist *x, t_gobj *y); | ||
359 | EXTERN void glist_deselect(t_glist *x, t_gobj *y); | ||
360 | EXTERN void glist_noselect(t_glist *x); | ||
361 | EXTERN void glist_selectall(t_glist *x); | ||
362 | EXTERN void glist_delete(t_glist *x, t_gobj *y); | ||
363 | EXTERN void glist_retext(t_glist *x, t_text *y); | ||
364 | EXTERN void glist_grab(t_glist *x, t_gobj *y, t_glistmotionfn motionfn, | ||
365 | t_glistkeyfn keyfn, int xpos, int ypos); | ||
366 | EXTERN int glist_isvisible(t_glist *x); | ||
367 | EXTERN int glist_istoplevel(t_glist *x); | ||
368 | EXTERN t_glist *glist_findgraph(t_glist *x); | ||
369 | EXTERN int glist_getfont(t_glist *x); | ||
370 | EXTERN void glist_sort(t_glist *canvas); | ||
371 | EXTERN void glist_read(t_glist *x, t_symbol *filename, t_symbol *format); | ||
372 | EXTERN void glist_mergefile(t_glist *x, t_symbol *filename, t_symbol *format); | ||
373 | |||
374 | EXTERN float glist_pixelstox(t_glist *x, float xpix); | ||
375 | EXTERN float glist_pixelstoy(t_glist *x, float ypix); | ||
376 | EXTERN float glist_xtopixels(t_glist *x, float xval); | ||
377 | EXTERN float glist_ytopixels(t_glist *x, float yval); | ||
378 | EXTERN float glist_dpixtodx(t_glist *x, float dxpix); | ||
379 | EXTERN float glist_dpixtody(t_glist *x, float dypix); | ||
380 | |||
381 | EXTERN void glist_redrawitem(t_glist *owner, t_gobj *gobj); | ||
382 | EXTERN void glist_getnextxy(t_glist *gl, int *xval, int *yval); | ||
383 | EXTERN void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv); | ||
384 | EXTERN t_glist *glist_addglist(t_glist *g, t_symbol *sym, | ||
385 | float x1, float y1, float x2, float y2, | ||
386 | float px1, float py1, float px2, float py2); | ||
387 | EXTERN void glist_arraydialog(t_glist *parent, t_symbol *name, | ||
388 | t_floatarg size, t_floatarg saveit, t_floatarg newgraph); | ||
389 | EXTERN t_binbuf *glist_writetobinbuf(t_glist *x, int wholething); | ||
390 | EXTERN int glist_isgraph(t_glist *x); | ||
391 | EXTERN void glist_redraw(t_glist *x); | ||
392 | EXTERN void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, | ||
393 | char *tag, int x1, int y1, int x2, int y2); | ||
394 | EXTERN void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag); | ||
395 | EXTERN void canvas_create_editor(t_glist *x, int createit); | ||
396 | void canvas_deletelinesforio(t_canvas *x, t_text *text, | ||
397 | t_inlet *inp, t_outlet *outp); | ||
398 | |||
399 | |||
400 | /* -------------------- functions on texts ------------------------- */ | ||
401 | EXTERN void text_setto(t_text *x, t_glist *glist, char *buf, int bufsize); | ||
402 | EXTERN void text_drawborder(t_text *x, t_glist *glist, char *tag, | ||
403 | int width, int height, int firsttime); | ||
404 | EXTERN void text_eraseborder(t_text *x, t_glist *glist, char *tag); | ||
405 | EXTERN int text_xcoord(t_text *x, t_glist *glist); | ||
406 | EXTERN int text_ycoord(t_text *x, t_glist *glist); | ||
407 | EXTERN int text_xpix(t_text *x, t_glist *glist); | ||
408 | EXTERN int text_ypix(t_text *x, t_glist *glist); | ||
409 | EXTERN int text_shouldvis(t_text *x, t_glist *glist); | ||
410 | |||
411 | /* -------------------- functions on rtexts ------------------------- */ | ||
412 | #define RTEXT_DOWN 1 | ||
413 | #define RTEXT_DRAG 2 | ||
414 | #define RTEXT_DBL 3 | ||
415 | #define RTEXT_SHIFT 4 | ||
416 | |||
417 | EXTERN t_rtext *rtext_new(t_glist *glist, t_text *who); | ||
418 | EXTERN t_rtext *glist_findrtext(t_glist *gl, t_text *who); | ||
419 | EXTERN void rtext_draw(t_rtext *x); | ||
420 | EXTERN void rtext_erase(t_rtext *x); | ||
421 | EXTERN t_rtext *rtext_remove(t_rtext *first, t_rtext *x); | ||
422 | EXTERN int rtext_height(t_rtext *x); | ||
423 | EXTERN void rtext_displace(t_rtext *x, int dx, int dy); | ||
424 | EXTERN void rtext_select(t_rtext *x, int state); | ||
425 | EXTERN void rtext_activate(t_rtext *x, int state); | ||
426 | EXTERN void rtext_free(t_rtext *x); | ||
427 | EXTERN void rtext_key(t_rtext *x, int n, t_symbol *s); | ||
428 | EXTERN void rtext_mouse(t_rtext *x, int xval, int yval, int flag); | ||
429 | EXTERN void rtext_retext(t_rtext *x); | ||
430 | EXTERN int rtext_width(t_rtext *x); | ||
431 | EXTERN int rtext_height(t_rtext *x); | ||
432 | EXTERN char *rtext_gettag(t_rtext *x); | ||
433 | EXTERN void rtext_gettext(t_rtext *x, char **buf, int *bufsize); | ||
434 | |||
435 | /* -------------------- functions on canvases ------------------------ */ | ||
436 | EXTERN t_class *canvas_class; | ||
437 | |||
438 | EXTERN t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv); | ||
439 | EXTERN t_symbol *canvas_makebindsym(t_symbol *s); | ||
440 | EXTERN void canvas_vistext(t_canvas *x, t_text *y); | ||
441 | EXTERN void canvas_fixlinesfor(t_canvas *x, t_text *text); | ||
442 | EXTERN void canvas_deletelinesfor(t_canvas *x, t_text *text); | ||
443 | EXTERN void canvas_stowconnections(t_canvas *x); | ||
444 | EXTERN void canvas_restoreconnections(t_canvas *x); | ||
445 | EXTERN void canvas_redraw(t_canvas *x); | ||
446 | |||
447 | EXTERN t_inlet *canvas_addinlet(t_canvas *x, t_pd *who, t_symbol *sym); | ||
448 | EXTERN void canvas_rminlet(t_canvas *x, t_inlet *ip); | ||
449 | EXTERN t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *sym); | ||
450 | EXTERN void canvas_rmoutlet(t_canvas *x, t_outlet *op); | ||
451 | EXTERN void canvas_redrawallfortemplate(t_canvas *tmpl); | ||
452 | EXTERN void canvas_zapallfortemplate(t_canvas *tmpl); | ||
453 | EXTERN void canvas_setusedastemplate(t_canvas *x); | ||
454 | EXTERN t_canvas *canvas_getcurrent(void); | ||
455 | EXTERN void canvas_setcurrent(t_canvas *x); | ||
456 | EXTERN void canvas_unsetcurrent(t_canvas *x); | ||
457 | EXTERN t_symbol *canvas_realizedollar(t_canvas *x, t_symbol *s); | ||
458 | EXTERN t_canvas *canvas_getrootfor(t_canvas *x); | ||
459 | EXTERN void canvas_dirty(t_canvas *x, t_int n); | ||
460 | EXTERN int canvas_getfont(t_canvas *x); | ||
461 | typedef int (*t_canvasapply)(t_canvas *x, t_int x1, t_int x2, t_int x3); | ||
462 | |||
463 | EXTERN t_int *canvas_recurapply(t_canvas *x, t_canvasapply *fn, | ||
464 | t_int x1, t_int x2, t_int x3); | ||
465 | |||
466 | EXTERN void canvas_resortinlets(t_canvas *x); | ||
467 | EXTERN void canvas_resortoutlets(t_canvas *x); | ||
468 | EXTERN void canvas_free(t_canvas *x); | ||
469 | EXTERN void canvas_updatewindowlist( void); | ||
470 | EXTERN void canvas_editmode(t_canvas *x, t_floatarg yesplease); | ||
471 | EXTERN int canvas_isabstraction(t_canvas *x); | ||
472 | EXTERN int canvas_istable(t_canvas *x); | ||
473 | EXTERN int canvas_showtext(t_canvas *x); | ||
474 | EXTERN void canvas_vis(t_canvas *x, t_floatarg f); | ||
475 | EXTERN t_canvasenvironment *canvas_getenv(t_canvas *x); | ||
476 | EXTERN void canvas_rename(t_canvas *x, t_symbol *s, t_symbol *dir); | ||
477 | EXTERN void canvas_loadbang(t_canvas *x); | ||
478 | EXTERN int canvas_hitbox(t_canvas *x, t_gobj *y, int xpos, int ypos, | ||
479 | int *x1p, int *y1p, int *x2p, int *y2p); | ||
480 | EXTERN int canvas_setdeleting(t_canvas *x, int flag); | ||
481 | |||
482 | typedef void (*t_undofn)(t_canvas *canvas, void *buf, | ||
483 | int action); /* a function that does UNDO/REDO */ | ||
484 | #define UNDO_FREE 0 /* free current undo/redo buffer */ | ||
485 | #define UNDO_UNDO 1 /* undo */ | ||
486 | #define UNDO_REDO 2 /* redo */ | ||
487 | EXTERN void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, | ||
488 | const char *name); | ||
489 | EXTERN void canvas_noundo(t_canvas *x); | ||
490 | EXTERN int canvas_getindex(t_canvas *x, t_gobj *y); | ||
491 | |||
492 | /* T.Grill - made public for dynamic object creation */ | ||
493 | /* in g_editor.c */ | ||
494 | EXTERN void canvas_connect(t_canvas *x, | ||
495 | t_floatarg fwhoout, t_floatarg foutno,t_floatarg fwhoin, t_floatarg finno); | ||
496 | EXTERN void canvas_disconnect(t_canvas *x, | ||
497 | float index1, float outno, float index2, float inno); | ||
498 | EXTERN int canvas_isconnected (t_canvas *x, | ||
499 | t_text *ob1, int n1, t_text *ob2, int n2); | ||
500 | EXTERN void canvas_selectinrect(t_canvas *x, int lox, int loy, int hix, int hiy); | ||
501 | |||
502 | |||
503 | /* ---- functions on canvasses as objects --------------------- */ | ||
504 | |||
505 | EXTERN void canvas_fattenforscalars(t_canvas *x, | ||
506 | int *x1, int *y1, int *x2, int *y2); | ||
507 | EXTERN void canvas_visforscalars(t_canvas *x, t_glist *glist, int vis); | ||
508 | EXTERN int canvas_clicksub(t_canvas *x, int xpix, int ypix, int shift, | ||
509 | int alt, int dbl, int doit); | ||
510 | EXTERN t_glist *canvas_getglistonsuper(void); | ||
511 | |||
512 | EXTERN void linetraverser_start(t_linetraverser *t, t_canvas *x); | ||
513 | EXTERN t_outconnect *linetraverser_next(t_linetraverser *t); | ||
514 | EXTERN void linetraverser_skipobject(t_linetraverser *t); | ||
515 | |||
516 | /* --------------------- functions on tscalars --------------------- */ | ||
517 | |||
518 | EXTERN void tscalar_getrect(t_tscalar *x, t_glist *owner, | ||
519 | int *xp1, int *yp1, int *xp2, int *yp2); | ||
520 | EXTERN void tscalar_vis(t_tscalar *x, t_glist *owner, int flag); | ||
521 | EXTERN int tscalar_click(t_tscalar *x, int xpix, int ypix, int shift, | ||
522 | int alt, int dbl, int doit); | ||
523 | |||
524 | /* --------- functions on garrays (graphical arrays) -------------------- */ | ||
525 | |||
526 | EXTERN t_template *garray_template(t_garray *x); | ||
527 | |||
528 | /* -------------------- arrays --------------------- */ | ||
529 | EXTERN t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *tmpl, | ||
530 | t_floatarg f, t_floatarg saveit); | ||
531 | EXTERN t_array *array_new(t_symbol *templatesym, t_gpointer *parent); | ||
532 | EXTERN void array_resize(t_array *x, t_template *tmpl, int n); | ||
533 | EXTERN void array_free(t_array *x); | ||
534 | |||
535 | /* --------------------- gpointers and stubs ---------------- */ | ||
536 | EXTERN t_gstub *gstub_new(t_glist *gl, t_array *a); | ||
537 | EXTERN void gstub_cutoff(t_gstub *gs); | ||
538 | EXTERN void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x); | ||
539 | |||
540 | /* --------------------- scalars ------------------------- */ | ||
541 | EXTERN void word_init(t_word *wp, t_template *tmpl, t_gpointer *gp); | ||
542 | EXTERN void word_restore(t_word *wp, t_template *tmpl, | ||
543 | int argc, t_atom *argv); | ||
544 | EXTERN t_scalar *scalar_new(t_glist *owner, | ||
545 | t_symbol *templatesym); | ||
546 | EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey); | ||
547 | |||
548 | /* ------helper routines for "garrays" and "plots" -------------- */ | ||
549 | EXTERN int array_doclick(t_array *array, t_glist *glist, t_gobj *gobj, | ||
550 | t_symbol *elemtemplatesym, | ||
551 | float linewidth, float xloc, float xinc, float yloc, | ||
552 | int xpix, int ypix, int shift, int alt, int dbl, int doit); | ||
553 | |||
554 | EXTERN void array_getcoordinate(t_glist *glist, | ||
555 | char *elem, int xonset, int yonset, int wonset, int indx, | ||
556 | float basex, float basey, float xinc, | ||
557 | float *xp, float *yp, float *wp); | ||
558 | |||
559 | EXTERN int array_getfields(t_symbol *elemtemplatesym, | ||
560 | t_canvas **elemtemplatecanvasp, | ||
561 | t_template **elemtemplatep, int *elemsizep, | ||
562 | int *xonsetp, int *yonsetp, int *wonsetp); | ||
563 | |||
564 | /* --------------------- templates ------------------------- */ | ||
565 | EXTERN t_template *template_new(t_symbol *sym, int argc, t_atom *argv); | ||
566 | EXTERN void template_free(t_template *x); | ||
567 | EXTERN int template_match(t_template *x1, t_template *x2); | ||
568 | EXTERN int template_find_field(t_template *x, t_symbol *name, int *p_onset, | ||
569 | int *p_type, t_symbol **p_arraytype); | ||
570 | EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, t_word *wp, | ||
571 | int loud); | ||
572 | EXTERN void template_setfloat(t_template *x, t_symbol *fieldname, t_word *wp, | ||
573 | t_float f, int loud); | ||
574 | EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname, | ||
575 | t_word *wp, int loud); | ||
576 | EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, | ||
577 | t_word *wp, t_symbol *s, int loud); | ||
578 | |||
579 | EXTERN t_template *gtemplate_get(t_gtemplate *x); | ||
580 | EXTERN t_template *template_findbyname(t_symbol *s); | ||
581 | EXTERN t_canvas *template_findcanvas(t_template *tmpl); | ||
582 | |||
583 | EXTERN t_float template_getfloat(t_template *x, t_symbol *fieldname, | ||
584 | t_word *wp, int loud); | ||
585 | EXTERN void template_setfloat(t_template *x, t_symbol *fieldname, | ||
586 | t_word *wp, t_float f, int loud); | ||
587 | EXTERN t_symbol *template_getsymbol(t_template *x, t_symbol *fieldname, | ||
588 | t_word *wp, int loud); | ||
589 | EXTERN void template_setsymbol(t_template *x, t_symbol *fieldname, | ||
590 | t_word *wp, t_symbol *s, int loud); | ||
591 | |||
592 | /* ----------------------- guiconnects, g_guiconnect.c --------- */ | ||
593 | EXTERN t_guiconnect *guiconnect_new(t_pd *who, t_symbol *sym); | ||
594 | EXTERN void guiconnect_notarget(t_guiconnect *x, double timedelay); | ||
595 | |||
596 | /* ------------- IEMGUI routines used in other g_ files ---------------- */ | ||
597 | EXTERN t_symbol *iemgui_raute2dollar(t_symbol *s); | ||
598 | EXTERN t_symbol *iemgui_dollar2raute(t_symbol *s); | ||
599 | |||
600 | #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) | ||
601 | } | ||
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 | |||
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 | ||