summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/x_gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/x_gui.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/x_gui.c754
1 files changed, 754 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/x_gui.c b/apps/plugins/pdbox/PDa/src/x_gui.c
new file mode 100644
index 0000000000..edff70e8cd
--- /dev/null
+++ b/apps/plugins/pdbox/PDa/src/x_gui.c
@@ -0,0 +1,754 @@
1/* Copyright (c) 1997-2000 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/* dialogs. LATER, deal with the situation where the object goes
6away before the panel does... */
7
8#include "m_pd.h"
9#include <stdio.h>
10#include <string.h>
11#ifdef UNIX
12#include <unistd.h>
13#endif
14
15/* --------------------- graphics responder ---------------- */
16
17/* make one of these if you want to put up a dialog window but want to be
18protected from getting deleted and then having the dialog call you back. In
19this design the calling object doesn't have to keep the address of the dialog
20window around; instead we keep a list of all open dialogs. Any object that
21might have dialogs, when it is deleted, simply checks down the dialog window
22list and breaks off any dialogs that might later have sent messages to it.
23Only when the dialog window itself closes do we delete the gfxstub object. */
24
25static t_class *gfxstub_class;
26
27typedef struct _gfxstub
28{
29 t_pd x_pd;
30 t_pd *x_owner;
31 void *x_key;
32 t_symbol *x_sym;
33 struct _gfxstub *x_next;
34} t_gfxstub;
35
36static t_gfxstub *gfxstub_list;
37
38 /* create a new one. the "key" is an address by which the owner
39 will identify it later; if the owner only wants one dialog, this
40 could just be a pointer to the owner itself. The string "cmd"
41 is a TK command to create the dialog, with "%s" embedded in
42 it so we can provide a name by which the GUI can send us back
43 messages; e.g., "pdtk_canvas_dofont %s 10". */
44
45void gfxstub_new(t_pd *owner, void *key, const char *cmd)
46{
47 char buf[MAXPDSTRING];
48 char namebuf[80];
49 t_gfxstub *x;
50 t_symbol *s;
51 /* if any exists with matching key, no need to make a
52 new one; just tell tk to send it front. */
53 for (x = gfxstub_list; x; x = x->x_next)
54 {
55 if (x->x_key == key)
56 {
57 sys_vgui("raise .gfxstub%x\n", x);
58 sys_vgui("focus .gfxstub%x\n", x);
59 return;
60 }
61 }
62 if (strlen(cmd) + 84 > MAXPDSTRING)
63 return;
64 x = (t_gfxstub *)pd_new(gfxstub_class);
65 sprintf(namebuf, ".gfxstub%x", (t_int)x);
66
67 s = gensym(namebuf);
68 pd_bind(&x->x_pd, s);
69 x->x_owner = owner;
70 x->x_sym = s;
71 x->x_key = key;
72 x->x_next = gfxstub_list;
73 gfxstub_list = x;
74 sprintf(buf, cmd, s->s_name);
75 sys_gui(buf);
76}
77
78static void gfxstub_offlist(t_gfxstub *x)
79{
80 t_gfxstub *y1, *y2;
81 if (gfxstub_list == x)
82 gfxstub_list = x->x_next;
83 else for (y1 = gfxstub_list; y2 = y1->x_next; y1 = y2)
84 if (y2 == x)
85 {
86 y1->x_next = y2->x_next;
87 break;
88 }
89}
90
91 /* if the owner disappears, we still may have to stay around until our
92 dialog window signs off. Anyway we can now tell the GUI to destroy the
93 window. */
94void gfxstub_deleteforkey(void *key)
95{
96 t_gfxstub *y;
97 int didit = 1;
98 while (didit)
99 {
100 didit = 0;
101 for (y = gfxstub_list; y; y = y->x_next)
102 {
103 if (y->x_key == key)
104 {
105 sys_vgui("destroy .gfxstub%x\n", y);
106 y->x_owner = 0;
107 gfxstub_offlist(y);
108 didit = 1;
109 break;
110 }
111 }
112 }
113}
114
115/* --------- pd messages for gfxstub (these come from the GUI) ---------- */
116
117 /* "cancel" to request that we close the dialog window. */
118static void gfxstub_cancel(t_gfxstub *x)
119{
120 gfxstub_deleteforkey(x->x_key);
121}
122
123 /* "signoff" comes from the GUI to say the dialog window closed. */
124static void gfxstub_signoff(t_gfxstub *x)
125{
126 gfxstub_offlist(x);
127 pd_free(&x->x_pd);
128}
129
130static t_binbuf *gfxstub_binbuf;
131
132 /* a series of "data" messages rebuilds a scalar */
133static void gfxstub_data(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv)
134{
135 if (!gfxstub_binbuf)
136 gfxstub_binbuf = binbuf_new();
137 binbuf_add(gfxstub_binbuf, argc, argv);
138 binbuf_addsemi(gfxstub_binbuf);
139}
140 /* the "end" message terminates rebuilding the scalar */
141static void gfxstub_end(t_gfxstub *x)
142{
143 canvas_dataproperties((t_canvas *)x->x_owner,
144 (t_scalar *)x->x_key, gfxstub_binbuf);
145 binbuf_free(gfxstub_binbuf);
146 gfxstub_binbuf = 0;
147}
148
149 /* anything else is a message from the dialog window to the owner;
150 just forward it. */
151static void gfxstub_anything(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv)
152{
153 if (x->x_owner)
154 pd_typedmess(x->x_owner, s, argc, argv);
155}
156
157static void gfxstub_free(t_gfxstub *x)
158{
159 pd_unbind(&x->x_pd, x->x_sym);
160}
161
162static void gfxstub_setup(void)
163{
164 gfxstub_class = class_new(gensym("gfxstub"), (t_newmethod)gfxstub_new,
165 (t_method)gfxstub_free,
166 sizeof(t_gfxstub), CLASS_PD, 0);
167 class_addanything(gfxstub_class, gfxstub_anything);
168 class_addmethod(gfxstub_class, (t_method)gfxstub_signoff,
169 gensym("signoff"), 0);
170 class_addmethod(gfxstub_class, (t_method)gfxstub_data,
171 gensym("data"), A_GIMME, 0);
172 class_addmethod(gfxstub_class, (t_method)gfxstub_end,
173 gensym("end"), 0);
174 class_addmethod(gfxstub_class, (t_method)gfxstub_cancel,
175 gensym("cancel"), 0);
176}
177
178/* -------------------------- openpanel ------------------------------ */
179
180static t_class *openpanel_class;
181
182typedef struct _openpanel
183{
184 t_object x_obj;
185 t_symbol *x_s;
186} t_openpanel;
187
188static void *openpanel_new(void)
189{
190 char buf[50];
191 t_openpanel *x = (t_openpanel *)pd_new(openpanel_class);
192 sprintf(buf, "d%x", (t_int)x);
193 x->x_s = gensym(buf);
194 pd_bind(&x->x_obj.ob_pd, x->x_s);
195 outlet_new(&x->x_obj, &s_symbol);
196 return (x);
197}
198
199static void openpanel_bang(t_openpanel *x)
200{
201 sys_vgui("pdtk_openpanel %s\n", x->x_s->s_name);
202}
203
204static void openpanel_symbol(t_openpanel *x, t_symbol *s)
205{
206 outlet_symbol(x->x_obj.ob_outlet, s);
207}
208
209static void openpanel_free(t_openpanel *x)
210{
211 pd_unbind(&x->x_obj.ob_pd, x->x_s);
212}
213
214static void openpanel_setup(void)
215{
216 openpanel_class = class_new(gensym("openpanel"),
217 (t_newmethod)openpanel_new, (t_method)openpanel_free,
218 sizeof(t_openpanel), 0, A_DEFFLOAT, 0);
219 class_addbang(openpanel_class, openpanel_bang);
220 class_addsymbol(openpanel_class, openpanel_symbol);
221}
222
223/* -------------------------- savepanel ------------------------------ */
224
225static t_class *savepanel_class;
226
227typedef struct _savepanel
228{
229 t_object x_obj;
230 t_symbol *x_s;
231} t_savepanel;
232
233static void *savepanel_new(void)
234{
235 char buf[50];
236 t_savepanel *x = (t_savepanel *)pd_new(savepanel_class);
237 sprintf(buf, "d%x", (t_int)x);
238 x->x_s = gensym(buf);
239 pd_bind(&x->x_obj.ob_pd, x->x_s);
240 outlet_new(&x->x_obj, &s_symbol);
241 return (x);
242}
243
244static void savepanel_bang(t_savepanel *x)
245{
246 sys_vgui("pdtk_savepanel %s\n", x->x_s->s_name);
247}
248
249static void savepanel_symbol(t_savepanel *x, t_symbol *s)
250{
251 outlet_symbol(x->x_obj.ob_outlet, s);
252}
253
254static void savepanel_free(t_savepanel *x)
255{
256 pd_unbind(&x->x_obj.ob_pd, x->x_s);
257}
258
259static void savepanel_setup(void)
260{
261 savepanel_class = class_new(gensym("savepanel"),
262 (t_newmethod)savepanel_new, (t_method)savepanel_free,
263 sizeof(t_savepanel), 0, A_DEFFLOAT, 0);
264 class_addbang(savepanel_class, savepanel_bang);
265 class_addsymbol(savepanel_class, savepanel_symbol);
266}
267
268/* ---------------------- key and its relatives ------------------ */
269
270static t_symbol *key_sym, *keyup_sym, *keyname_sym;
271static t_class *key_class, *keyup_class, *keyname_class;
272
273typedef struct _key
274{
275 t_object x_obj;
276} t_key;
277
278static void *key_new( void)
279{
280 t_key *x = (t_key *)pd_new(key_class);
281 outlet_new(&x->x_obj, &s_float);
282 pd_bind(&x->x_obj.ob_pd, key_sym);
283 return (x);
284}
285
286static void key_float(t_key *x, t_floatarg f)
287{
288 outlet_float(x->x_obj.ob_outlet, f);
289}
290
291static void key_free(t_key *x)
292{
293 pd_unbind(&x->x_obj.ob_pd, key_sym);
294}
295
296typedef struct _keyup
297{
298 t_object x_obj;
299} t_keyup;
300
301static void *keyup_new( void)
302{
303 t_keyup *x = (t_keyup *)pd_new(keyup_class);
304 outlet_new(&x->x_obj, &s_float);
305 pd_bind(&x->x_obj.ob_pd, keyup_sym);
306 return (x);
307}
308
309static void keyup_float(t_keyup *x, t_floatarg f)
310{
311 outlet_float(x->x_obj.ob_outlet, f);
312}
313
314static void keyup_free(t_keyup *x)
315{
316 pd_unbind(&x->x_obj.ob_pd, keyup_sym);
317}
318
319typedef struct _keyname
320{
321 t_object x_obj;
322 t_outlet *x_outlet1;
323 t_outlet *x_outlet2;
324} t_keyname;
325
326static void *keyname_new( void)
327{
328 t_keyname *x = (t_keyname *)pd_new(keyname_class);
329 x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
330 x->x_outlet2 = outlet_new(&x->x_obj, &s_symbol);
331 pd_bind(&x->x_obj.ob_pd, keyname_sym);
332 return (x);
333}
334
335static void keyname_list(t_keyname *x, t_symbol *s, int ac, t_atom *av)
336{
337 outlet_symbol(x->x_outlet2, atom_getsymbolarg(1, ac, av));
338 outlet_float(x->x_outlet1, atom_getfloatarg(0, ac, av));
339}
340
341static void keyname_free(t_keyname *x)
342{
343 pd_unbind(&x->x_obj.ob_pd, keyname_sym);
344}
345
346static void key_setup(void)
347{
348 key_class = class_new(gensym("key"),
349 (t_newmethod)key_new, (t_method)key_free,
350 sizeof(t_key), CLASS_NOINLET, 0);
351 class_addfloat(key_class, key_float);
352 key_sym = gensym("#key");
353
354 keyup_class = class_new(gensym("keyup"),
355 (t_newmethod)keyup_new, (t_method)keyup_free,
356 sizeof(t_keyup), CLASS_NOINLET, 0);
357 class_addfloat(keyup_class, keyup_float);
358 keyup_sym = gensym("#keyup");
359 class_sethelpsymbol(keyup_class, gensym("key"));
360
361 keyname_class = class_new(gensym("keyname"),
362 (t_newmethod)keyname_new, (t_method)keyname_free,
363 sizeof(t_keyname), CLASS_NOINLET, 0);
364 class_addlist(keyname_class, keyname_list);
365 keyname_sym = gensym("#keyname");
366 class_sethelpsymbol(keyname_class, gensym("key"));
367}
368
369/* -------------------------- setup routine ------------------------------ */
370
371void x_gui_setup(void)
372{
373 gfxstub_setup();
374 openpanel_setup();
375 savepanel_setup();
376 key_setup();
377}
378/* Copyright (c) 1997-2000 Miller Puckette.
379* For information on usage and redistribution, and for a DISCLAIMER OF ALL
380* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
381
382/* dialogs. LATER, deal with the situation where the object goes
383away before the panel does... */
384
385#include "m_pd.h"
386#include <stdio.h>
387#include <string.h>
388#ifdef UNIX
389#include <unistd.h>
390#endif
391
392/* --------------------- graphics responder ---------------- */
393
394/* make one of these if you want to put up a dialog window but want to be
395protected from getting deleted and then having the dialog call you back. In
396this design the calling object doesn't have to keep the address of the dialog
397window around; instead we keep a list of all open dialogs. Any object that
398might have dialogs, when it is deleted, simply checks down the dialog window
399list and breaks off any dialogs that might later have sent messages to it.
400Only when the dialog window itself closes do we delete the gfxstub object. */
401
402static t_class *gfxstub_class;
403
404typedef struct _gfxstub
405{
406 t_pd x_pd;
407 t_pd *x_owner;
408 void *x_key;
409 t_symbol *x_sym;
410 struct _gfxstub *x_next;
411} t_gfxstub;
412
413static t_gfxstub *gfxstub_list;
414
415 /* create a new one. the "key" is an address by which the owner
416 will identify it later; if the owner only wants one dialog, this
417 could just be a pointer to the owner itself. The string "cmd"
418 is a TK command to create the dialog, with "%s" embedded in
419 it so we can provide a name by which the GUI can send us back
420 messages; e.g., "pdtk_canvas_dofont %s 10". */
421
422void gfxstub_new(t_pd *owner, void *key, const char *cmd)
423{
424 char buf[MAXPDSTRING];
425 char namebuf[80];
426 t_gfxstub *x;
427 t_symbol *s;
428 /* if any exists with matching key, no need to make a
429 new one; just tell tk to send it front. */
430 for (x = gfxstub_list; x; x = x->x_next)
431 {
432 if (x->x_key == key)
433 {
434 sys_vgui("raise .gfxstub%x\n", x);
435 sys_vgui("focus .gfxstub%x\n", x);
436 return;
437 }
438 }
439 if (strlen(cmd) + 84 > MAXPDSTRING)
440 return;
441 x = (t_gfxstub *)pd_new(gfxstub_class);
442 sprintf(namebuf, ".gfxstub%x", (t_int)x);
443
444 s = gensym(namebuf);
445 pd_bind(&x->x_pd, s);
446 x->x_owner = owner;
447 x->x_sym = s;
448 x->x_key = key;
449 x->x_next = gfxstub_list;
450 gfxstub_list = x;
451 sprintf(buf, cmd, s->s_name);
452 sys_gui(buf);
453}
454
455static void gfxstub_offlist(t_gfxstub *x)
456{
457 t_gfxstub *y1, *y2;
458 if (gfxstub_list == x)
459 gfxstub_list = x->x_next;
460 else for (y1 = gfxstub_list; y2 = y1->x_next; y1 = y2)
461 if (y2 == x)
462 {
463 y1->x_next = y2->x_next;
464 break;
465 }
466}
467
468 /* if the owner disappears, we still may have to stay around until our
469 dialog window signs off. Anyway we can now tell the GUI to destroy the
470 window. */
471void gfxstub_deleteforkey(void *key)
472{
473 t_gfxstub *y;
474 int didit = 1;
475 while (didit)
476 {
477 didit = 0;
478 for (y = gfxstub_list; y; y = y->x_next)
479 {
480 if (y->x_key == key)
481 {
482 sys_vgui("destroy .gfxstub%x\n", y);
483 y->x_owner = 0;
484 gfxstub_offlist(y);
485 didit = 1;
486 break;
487 }
488 }
489 }
490}
491
492/* --------- pd messages for gfxstub (these come from the GUI) ---------- */
493
494 /* "cancel" to request that we close the dialog window. */
495static void gfxstub_cancel(t_gfxstub *x)
496{
497 gfxstub_deleteforkey(x->x_key);
498}
499
500 /* "signoff" comes from the GUI to say the dialog window closed. */
501static void gfxstub_signoff(t_gfxstub *x)
502{
503 gfxstub_offlist(x);
504 pd_free(&x->x_pd);
505}
506
507static t_binbuf *gfxstub_binbuf;
508
509 /* a series of "data" messages rebuilds a scalar */
510static void gfxstub_data(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv)
511{
512 if (!gfxstub_binbuf)
513 gfxstub_binbuf = binbuf_new();
514 binbuf_add(gfxstub_binbuf, argc, argv);
515 binbuf_addsemi(gfxstub_binbuf);
516}
517 /* the "end" message terminates rebuilding the scalar */
518static void gfxstub_end(t_gfxstub *x)
519{
520 canvas_dataproperties((t_canvas *)x->x_owner,
521 (t_scalar *)x->x_key, gfxstub_binbuf);
522 binbuf_free(gfxstub_binbuf);
523 gfxstub_binbuf = 0;
524}
525
526 /* anything else is a message from the dialog window to the owner;
527 just forward it. */
528static void gfxstub_anything(t_gfxstub *x, t_symbol *s, int argc, t_atom *argv)
529{
530 if (x->x_owner)
531 pd_typedmess(x->x_owner, s, argc, argv);
532}
533
534static void gfxstub_free(t_gfxstub *x)
535{
536 pd_unbind(&x->x_pd, x->x_sym);
537}
538
539static void gfxstub_setup(void)
540{
541 gfxstub_class = class_new(gensym("gfxstub"), (t_newmethod)gfxstub_new,
542 (t_method)gfxstub_free,
543 sizeof(t_gfxstub), CLASS_PD, 0);
544 class_addanything(gfxstub_class, gfxstub_anything);
545 class_addmethod(gfxstub_class, (t_method)gfxstub_signoff,
546 gensym("signoff"), 0);
547 class_addmethod(gfxstub_class, (t_method)gfxstub_data,
548 gensym("data"), A_GIMME, 0);
549 class_addmethod(gfxstub_class, (t_method)gfxstub_end,
550 gensym("end"), 0);
551 class_addmethod(gfxstub_class, (t_method)gfxstub_cancel,
552 gensym("cancel"), 0);
553}
554
555/* -------------------------- openpanel ------------------------------ */
556
557static t_class *openpanel_class;
558
559typedef struct _openpanel
560{
561 t_object x_obj;
562 t_symbol *x_s;
563} t_openpanel;
564
565static void *openpanel_new(void)
566{
567 char buf[50];
568 t_openpanel *x = (t_openpanel *)pd_new(openpanel_class);
569 sprintf(buf, "d%x", (t_int)x);
570 x->x_s = gensym(buf);
571 pd_bind(&x->x_obj.ob_pd, x->x_s);
572 outlet_new(&x->x_obj, &s_symbol);
573 return (x);
574}
575
576static void openpanel_bang(t_openpanel *x)
577{
578 sys_vgui("pdtk_openpanel %s\n", x->x_s->s_name);
579}
580
581static void openpanel_symbol(t_openpanel *x, t_symbol *s)
582{
583 outlet_symbol(x->x_obj.ob_outlet, s);
584}
585
586static void openpanel_free(t_openpanel *x)
587{
588 pd_unbind(&x->x_obj.ob_pd, x->x_s);
589}
590
591static void openpanel_setup(void)
592{
593 openpanel_class = class_new(gensym("openpanel"),
594 (t_newmethod)openpanel_new, (t_method)openpanel_free,
595 sizeof(t_openpanel), 0, A_DEFFLOAT, 0);
596 class_addbang(openpanel_class, openpanel_bang);
597 class_addsymbol(openpanel_class, openpanel_symbol);
598}
599
600/* -------------------------- savepanel ------------------------------ */
601
602static t_class *savepanel_class;
603
604typedef struct _savepanel
605{
606 t_object x_obj;
607 t_symbol *x_s;
608} t_savepanel;
609
610static void *savepanel_new(void)
611{
612 char buf[50];
613 t_savepanel *x = (t_savepanel *)pd_new(savepanel_class);
614 sprintf(buf, "d%x", (t_int)x);
615 x->x_s = gensym(buf);
616 pd_bind(&x->x_obj.ob_pd, x->x_s);
617 outlet_new(&x->x_obj, &s_symbol);
618 return (x);
619}
620
621static void savepanel_bang(t_savepanel *x)
622{
623 sys_vgui("pdtk_savepanel %s\n", x->x_s->s_name);
624}
625
626static void savepanel_symbol(t_savepanel *x, t_symbol *s)
627{
628 outlet_symbol(x->x_obj.ob_outlet, s);
629}
630
631static void savepanel_free(t_savepanel *x)
632{
633 pd_unbind(&x->x_obj.ob_pd, x->x_s);
634}
635
636static void savepanel_setup(void)
637{
638 savepanel_class = class_new(gensym("savepanel"),
639 (t_newmethod)savepanel_new, (t_method)savepanel_free,
640 sizeof(t_savepanel), 0, A_DEFFLOAT, 0);
641 class_addbang(savepanel_class, savepanel_bang);
642 class_addsymbol(savepanel_class, savepanel_symbol);
643}
644
645/* ---------------------- key and its relatives ------------------ */
646
647static t_symbol *key_sym, *keyup_sym, *keyname_sym;
648static t_class *key_class, *keyup_class, *keyname_class;
649
650typedef struct _key
651{
652 t_object x_obj;
653} t_key;
654
655static void *key_new( void)
656{
657 t_key *x = (t_key *)pd_new(key_class);
658 outlet_new(&x->x_obj, &s_float);
659 pd_bind(&x->x_obj.ob_pd, key_sym);
660 return (x);
661}
662
663static void key_float(t_key *x, t_floatarg f)
664{
665 outlet_float(x->x_obj.ob_outlet, f);
666}
667
668static void key_free(t_key *x)
669{
670 pd_unbind(&x->x_obj.ob_pd, key_sym);
671}
672
673typedef struct _keyup
674{
675 t_object x_obj;
676} t_keyup;
677
678static void *keyup_new( void)
679{
680 t_keyup *x = (t_keyup *)pd_new(keyup_class);
681 outlet_new(&x->x_obj, &s_float);
682 pd_bind(&x->x_obj.ob_pd, keyup_sym);
683 return (x);
684}
685
686static void keyup_float(t_keyup *x, t_floatarg f)
687{
688 outlet_float(x->x_obj.ob_outlet, f);
689}
690
691static void keyup_free(t_keyup *x)
692{
693 pd_unbind(&x->x_obj.ob_pd, keyup_sym);
694}
695
696typedef struct _keyname
697{
698 t_object x_obj;
699 t_outlet *x_outlet1;
700 t_outlet *x_outlet2;
701} t_keyname;
702
703static void *keyname_new( void)
704{
705 t_keyname *x = (t_keyname *)pd_new(keyname_class);
706 x->x_outlet1 = outlet_new(&x->x_obj, &s_float);
707 x->x_outlet2 = outlet_new(&x->x_obj, &s_symbol);
708 pd_bind(&x->x_obj.ob_pd, keyname_sym);
709 return (x);
710}
711
712static void keyname_list(t_keyname *x, t_symbol *s, int ac, t_atom *av)
713{
714 outlet_symbol(x->x_outlet2, atom_getsymbolarg(1, ac, av));
715 outlet_float(x->x_outlet1, atom_getfloatarg(0, ac, av));
716}
717
718static void keyname_free(t_keyname *x)
719{
720 pd_unbind(&x->x_obj.ob_pd, keyname_sym);
721}
722
723static void key_setup(void)
724{
725 key_class = class_new(gensym("key"),
726 (t_newmethod)key_new, (t_method)key_free,
727 sizeof(t_key), CLASS_NOINLET, 0);
728 class_addfloat(key_class, key_float);
729 key_sym = gensym("#key");
730
731 keyup_class = class_new(gensym("keyup"),
732 (t_newmethod)keyup_new, (t_method)keyup_free,
733 sizeof(t_keyup), CLASS_NOINLET, 0);
734 class_addfloat(keyup_class, keyup_float);
735 keyup_sym = gensym("#keyup");
736 class_sethelpsymbol(keyup_class, gensym("key"));
737
738 keyname_class = class_new(gensym("keyname"),
739 (t_newmethod)keyname_new, (t_method)keyname_free,
740 sizeof(t_keyname), CLASS_NOINLET, 0);
741 class_addlist(keyname_class, keyname_list);
742 keyname_sym = gensym("#keyname");
743 class_sethelpsymbol(keyname_class, gensym("key"));
744}
745
746/* -------------------------- setup routine ------------------------------ */
747
748void x_gui_setup(void)
749{
750 gfxstub_setup();
751 openpanel_setup();
752 savepanel_setup();
753 key_setup();
754}