File: widgets.h

package info (click to toggle)
csound-plugins 1.0.2~dfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,960 kB
  • sloc: cpp: 16,586; ansic: 7,522; python: 458; sh: 94; makefile: 25
file content (645 lines) | stat: -rw-r--r-- 15,515 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
/*
    widgets.h:

    Copyright (C) 2002 Gabriel Maldonado

    This file is part of Csound.

    The Csound Library is free software; you can redistribute it
    and/or modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    Csound is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with Csound; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
    02110-1301 USA
*/

#ifndef CSOUND_WIDGETS_H
#define CSOUND_WIDGETS_H

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *imin, *imax, *iexp;
    MYFLT   *itype, *idisp, *iwidth, *iheight, *ix, *iy;
    MYFLT   min, base, *table;
    long    tablen;
} FLSLIDER;

#define MAXSLIDERBANK 128

typedef struct {
        void *widget_addr; //gab
        MYFLT min, max, *out;
        MYFLT base, *table;
        long tablen;
        int exp;
} SLDBK_ELEMENT;

// ---------------------------------------------------------------------

typedef struct {
    OPDS    h;
    MYFLT   *names;
    MYFLT  *inumsliders, *ioutable, *iwidth, *iheight;
    MYFLT   *ix, *iy, *itypetable, *iexptable, *ioutablestart_ndx;
    MYFLT   *iminmaxtable;
    SLDBK_ELEMENT slider_data[MAXSLIDERBANK];
    long    elements;
} FLSLIDERBANK;

typedef struct {
    OPDS    h;
    MYFLT  *names;
    MYFLT *inumsliders, *ioutable, *iconfigtable, *iwidth,
           *iheight, *ix, *iy, *ioutablestart_ndx;
    SLDBK_ELEMENT slider_data[MAXSLIDERBANK];
    long   elements;
} FLSLIDERBANK2;   //gab

// typedef struct       {
//      OPDS    h;
//     MYFLT   *kout, *args[PMAX+1];
// } FLKEYB;

typedef struct {
    OPDS    h;
    MYFLT   *kvalue, *ihandle;
} FLBUTTONCALL;

typedef struct {
    OPDS    h;
    MYFLT   *koutx, *kouty, *ihandle1, *ihandle2;
    STRINGDAT   *name;
    MYFLT *iminx, *imaxx, *iminy, *imaxy;
    MYFLT   *iexpx, *iexpy, *idispx, *idispy, *iwidth, *iheight, *ix, *iy;
    MYFLT   basex, basey, *tablex, *tabley;
    long    tablenx, tableny;
} FLJOYSTICK;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *imin, *imax, *istep, *iexp;
    MYFLT   *itype, *idisp, *iwidth, *iheight, *ix, *iy;
    MYFLT   min, base, *table;
    long    tablen;
} FLROLLER;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *imin, *imax, *iexp, *itype;
    MYFLT   *idisp, *iwidth, *ix, *iy, *icursorsize;
    MYFLT   min, base, *table;
    long    tablen;
} FLKNOB;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *imin, *imax, *istep, *itype;
    MYFLT   *iwidth, *iheight, *ix, *iy;
} FLTEXT;

// ---------------------------------------------------------------------

typedef struct {
    OPDS    h;
    MYFLT   *red1, *green1, *blue1, *red2, *green2, *blue2;
} FLWIDGCOL;

typedef struct {
    OPDS    h;
    MYFLT   *red, *green, *blue;
} FLWIDGCOL2;

typedef struct {
    OPDS    h;
    MYFLT   *size, *font, *align, *red, *green, *blue;
} FLWIDGLABEL;

// ---------------------------------------------------------------------

typedef struct {
    OPDS    h;
    MYFLT   *ivalue, *ihandle;
} FL_SET_WIDGET_VALUE_I;

typedef struct {
    OPDS    h;
    MYFLT   *ktrig, *kvalue, *ihandle;
    int     handle;
    int     widgetType;
    MYFLT   log_base;
} FL_SET_WIDGET_VALUE;

typedef struct {
    OPDS    h;
    MYFLT   *red, *green, *blue, *ihandle;
} FL_SET_COLOR;

typedef struct {
    OPDS    h;
    MYFLT   *ivalue, *ihandle;
} FL_SET_TEXTSIZE;

typedef struct {
    OPDS    h;
    MYFLT   *itype, *ihandle;
} FL_SET_FONT;

typedef struct {
    OPDS    h;
    STRINGDAT  *itext;
    MYFLT   *ihandle;
} FL_SET_TEXT;

typedef struct {
    OPDS    h;
    MYFLT   *ndx;
    MYFLT   *ihandle;
} FL_SET_TEXTi;

typedef struct {
    OPDS    h;
    MYFLT   *itype, *ihandle;
} FL_TALIGN;

typedef struct {
    OPDS    h;
    MYFLT   *iwidth, *iheight, *ihandle;
} FL_SET_SIZE;

typedef struct {
    OPDS    h;
    MYFLT   *ix, *iy,  *ihandle;
} FL_SET_POSITION;

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
} FL_WIDHIDE;

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
} FL_WIDSHOW;

typedef struct {
    OPDS    h;
    MYFLT   *itype, *ihandle;
} FL_SETBOX;

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
    STRINGDAT *itext;
    MYFLT *itype, *ifont, *isize;
    MYFLT   *iwidth, *iheight, *ix, *iy;
} FL_BOX;

// ---------------------------------------------------------------------

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
    STRINGDAT *name;
    MYFLT *iwidth, *iheight, *ix, *iy;
} FLVALUE;

typedef struct {
    OPDS    h;
} FLRUN;

typedef struct {
    OPDS    h;
    STRINGDAT   *name;
    MYFLT *iwidth, *iheight, *ix, *iy, *border, *ikbdsense, *iclose;
} FLPANEL;

typedef struct {
    OPDS    h;
    MYFLT   *inum_snap, *inum_val, *index, *ifn, *group;
} FLSETSNAP;

typedef struct {
    OPDS    h;
    MYFLT   *inum_el, *index, *group;
} FLGETSNAP;

typedef struct {
    OPDS    h;
    STRINGDAT     *filename;
    MYFLT *group;
} FLSAVESNAPS;

typedef struct {
    OPDS    h;
    STRINGDAT   *filename;
    MYFLT *group;
} FLLOADSNAPS;

typedef struct {
    OPDS    h;
} FLPANELEND;

typedef struct {
    OPDS    h;
    MYFLT   *iwidth, *iheight, *ix, *iy;
} FLSCROLL;

typedef struct {
    OPDS    h;
} FLSCROLLEND;

typedef struct {
    OPDS    h;
    MYFLT   *iwidth, *iheight, *ix, *iy;
} FLTABS;

typedef struct {
    OPDS    h;
} FLTABSEND;

typedef struct {
    OPDS    h;
    STRINGDAT   *name;
    MYFLT  *iwidth, *iheight, *ix, *iy, *border;
} FLGROUP;

typedef struct {
    OPDS    h;
} FLGROUPEND;

typedef struct {
    OPDS    h;
    MYFLT   *iwidth, *iheight, *ix, *iy, *itype, *ispace, *iborder;
} FLPACK;

typedef struct {
    OPDS    h;
} FLPACKEND;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *ion, *ioff, *itype;
    MYFLT   *iwidth, *iheight, *ix, *iy, *args[PMAX];
} FLBUTTON;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;    /*  outs */
    MYFLT   *itype, *inumx, *inumy, *iwidth, *iheight, *ix, *iy, *args[PMAX];
} FLBUTTONBANK;

typedef struct {
    OPDS    h;
    MYFLT   *kout, *ihandle;
    STRINGDAT *name;
    MYFLT *imin, *imax, *istep1, *istep2, *itype;
    MYFLT   *iwidth, *iheight, *ix, *iy, *args[PMAX];
} FLCOUNTER;

typedef struct {
    OPDS    h;
    MYFLT   *ptime, *val, *idisp;
    MYFLT   initime, ctime;
    long    cysofar;
} FLPRINTK;

typedef struct {
    OPDS    h;
    MYFLT   *val, *idisp;
    MYFLT   oldvalue;
 /* int     pspace; */
} FLPRINTK2;

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
    STRINGDAT *name;
    MYFLT   *iwidth, *iheight, *ix, *iy;
} FLCLOSEBUTTON;

typedef struct {
    OPDS    h;
    MYFLT   *ihandle;
    STRINGDAT *command;
    MYFLT   *iwidth, *iheight, *ix, *iy;
    char    *commandString;
    CSOUND  *csound;
} FLEXECBUTTON;

#ifdef __cplusplus
}
#endif

#if defined(CSOUND_WIDGETS_CPP)

/* ---- IV - Aug 23 2002 ---- included file: Fl_Ball.H */

class Fl_Ball : public Fl_Valuator {
private:
  CSOUND *csound;
  int ix, iy, drag;
  int spinning;

  int ballstacks, ballslices;
  float ballsize;

  float curquat[4];
  float lastquat[4];
  float mat[4][4];

  char soft_;
  uchar mouseobj;

  static PUBLIC void repeat_callback(void *);
  PUBLIC void increment_cb();
  PUBLIC void vertex_by_matrix(float &x, float &y, float &z);

  PUBLIC void transform_ball_vertex(float &x, float &y, float &z);
  PUBLIC void rotate(float &x, float &y, float &z,
                        float rotx=0.0f, float roty=0.0f, float rotz=0.0f);
  PUBLIC void draw_solid_ball(float radius, int slices, int stacks);
  PUBLIC void draw_wire_ball(float radius, int slices, int stacks);
public:
    PUBLIC void draw();
    PUBLIC void handle_drag(double v=0.0);
    PUBLIC void handle_release();
    PUBLIC int handle(int);
    PUBLIC Fl_Ball(CSOUND *cs, int x, int y, int w, int h, const char *l = 0);

  void soft(char x) {soft_ = x;}
  char soft() const {return soft_;}

  float ballscale() const {return ballsize;}
  void ballscale(float s) { ballsize=s;}

  void rotateball(float rotx=0.0f, float roty=0.0f, float rotz=0.0f);
  void getrot(float &rotx, float &roty, float &rotz);

  void stacks(int s) { ballstacks=s; }
  int stacks() const { return ballstacks; }

  void slices(int s) { ballslices=s; }
  int slices() const { return ballslices; }

  ~Fl_Ball();
};

/* ---- IV - Aug 23 2002 ---- included file: Fl_Knob.H */

/* generated by Fast Light User Interface Designer (fluid) version 2.00 */

class Fl_Knob : public Fl_Valuator {
 public:
    enum Fl_Knobtype {
      DOTLIN=0,
      DOTLOG_1,
      DOTLOG_2,
      DOTLOG_3,
      LINELIN,
      LINELOG_1,
      LINELOG_2,
      LINELOG_3
    };
 private:
    CSOUND *csound;
    int _type;
    float _percent;
    int _scaleticks;
    short a1, a2;
 public:
    Fl_Knob(CSOUND *cs, int xx, int yy, int ww, int hh, const char *l=0);
    ~Fl_Knob();
 private:
    void draw();
    int handle(int event);
 public:
    void type(int ty);
 private:
    void shadow(const int offs, const uchar r, uchar g, uchar b);
    void draw_scale(const int ox, const int oy, const int side);
    void draw_cursor(const int ox, const int oy, const int side);
 public:
    void cursor(const int pc);
    void scaleticks(const int tck);
};

/* ---- IV - Aug 23 2002 ---- included file: Fl_Spin.H */

class Fl_Spin : public Fl_Valuator {
 private:
    CSOUND * csound;
    int ix, iy, drag, indrag;
    int delta, deltadir;
    char soft_;
    uchar mouseobj;
    static PUBLIC void repeat_callback(void *);
    PUBLIC void increment_cb();

 public:
    PUBLIC void draw();
    PUBLIC int handle(int);
    PUBLIC Fl_Spin(CSOUND *cs, int x, int y, int w, int h, const char *l = 0);

    void soft(char x) {soft_ = x;}
    char soft() const {return soft_;}

    ~Fl_Spin();
};

/* ---- IV - Aug 23 2002 ---- included file: Fl_Value_Input_Spin.H */

class Fl_Value_Input_Spin : public Fl_Valuator {
 private:
    CSOUND * csound;
    int ix, iy, drag;
    int delta, deltadir;
    char soft_;
    uchar mouseobj;
    int butsize;
    static PUBLIC void input_cb(Fl_Widget*, void*);
    // cause damage() due to value() changing
    virtual PUBLIC void value_damage();
    static PUBLIC void repeat_callback(void *);
    PUBLIC void increment_cb();

 public:
    Fl_Input input;
    PUBLIC void draw();
    PUBLIC int handle(int);
    PUBLIC void resize(int, int, int, int);
    PUBLIC Fl_Value_Input_Spin(CSOUND *csound, int x, int y, int w, int h,
                                  const char *l = 0);

    void soft(char x) {soft_ = x;}
    char soft() const {return soft_;}

    Fl_Font textfont() const {return input.textfont();}
    void textfont(uchar s) { input.textfont(s);}
    uchar textsize() const {return input.textsize();}
    void textsize(uchar s) {input.textsize(s);}
    Fl_Color textcolor() const {return input.textcolor();}
    void textcolor(uchar n) {input.textcolor(n);}
    Fl_Color cursor_color() const {return input.cursor_color();}
    void cursor_color(uchar n) {input.cursor_color(n);}
    int buttonssize() const {return butsize;}
    void buttonssize(int s) { butsize=s;}
    ~Fl_Value_Input_Spin();
};

/* ---- IV - Aug 23 2002 ---- included file: Fl_Value_Slider_Input.H */

class Fl_Value_Slider_Input : public Fl_Value_Slider {
 private:
    CSOUND *csound;
    char soft_;
    int txtboxsize;

    static PUBLIC void input_cb(Fl_Widget*, void*);
    // cause damage() due to value() changing
    virtual PUBLIC void value_damage();

 public:
    Fl_Input input;
    PUBLIC void draw();
    PUBLIC int handle(int);
    PUBLIC void resize(int, int, int, int);
    PUBLIC Fl_Value_Slider_Input(CSOUND * cs, int x, int y, int w, int h,
                                    const char *l = 0);

    void soft(char x) {soft_ = x;}
    char soft() const {return soft_;}

    Fl_Font textfont() const {return input.textfont();}
    void textfont(uchar s) { input.textfont(s);}
    uchar textsize() const {return input.textsize();}
    void textsize(uchar s) {input.textsize(s);}
    Fl_Color textcolor() const {return input.textcolor();}
    void textcolor(uchar n) {input.textcolor(n);}
    Fl_Color cursor_color() const {return input.cursor_color();}
    void cursor_color(uchar n) {input.cursor_color(n);}
    void textboxsize(int s) { txtboxsize=s;}
    int textboxsize() const {return txtboxsize;}
};


// New widgets for Csound5.06 by Gabriel Maldonado
// Ported by Andres Cabrera. This section below comes
// from the file newwidgets.h

typedef struct {
        OPDS    h;
        MYFLT *ihandle;
} FLSLDBNK_GETHANDLE; //gab

typedef struct {
        OPDS    h;
        MYFLT *ihandle, *ifn, *startInd, *startSlid, *numSlid;
        //int oldx, oly;
} FLSLDBNK_SET;  //gab

typedef struct {
        OPDS    h;
        MYFLT *kflag, *ihandle, *ifn, *startInd, *startSlid, *numSlid;
        MYFLT oldValues[MAXSLIDERBANK];
        int numslid, startind, startslid;
        FLSLIDERBANK2 *q;
        MYFLT *table, *outable;
        //int oldx, oly;
} FLSLDBNK2_SETK;

typedef struct {
        OPDS    h;
        MYFLT *kflag, *ihandle, *ifn, *startInd, *startSlid, *numSlid;
        MYFLT oldValues[MAXSLIDERBANK];
        int numslid, startind, startslid;
        FLSLIDERBANK *q;
        MYFLT *table, *outable;
        //int oldx, oly;
} FLSLDBNK_SETK;

typedef struct {
        OPDS    h;
        MYFLT   *koutx, *kouty, *kinside; //outs
        MYFLT   *ioutx_min, *ioutx_max, *iouty_min, *iouty_max,
                    *iwindx_min, *iwindx_max, *iwindy_min, *iwindy_max,
                        *iexpx, *iexpy, *ioutx, *iouty; //ins
        MYFLT oldx, oldy, *tablex, *tabley;
        int expx, expy;
        long tablenx, tableny;
        double rangex, rangey, basex, basey;
        //int   pspace;
} FLXYIN; //gab

typedef struct  {
        OPDS    h;
//      MYFLT *ktrig, *kvalue, *ihandle;
        MYFLT *chan, *cc, *ihandle;
        int     ccVal, oldCCval;
        MYFLT log_base, min, max, range;
        void *WidgAddress, *opcode, *addrSetVal;
        int exp, widg_type;
} FL_MIDI_WIDGET_VALUE;


typedef struct  {
        OPDS    h;
        MYFLT   *kascii,*ifn;//, *ifnMap;
        MYFLT   *table;//, *tableMap;
        int             flag;
} FLKEYIN;

typedef struct  {
        OPDS    h;
        MYFLT  *group;
} FLSETSNAPGROUP;

typedef struct  {
        OPDS    h;
        MYFLT   *x,*y, *b1, *b2, *b3, *flagRaw;
        MYFLT height,width;
} FLMOUSE;

typedef struct  {
        OPDS    h;
        MYFLT *ihandle, *numlinesX, *numlinesY, *iwidth, *iheight, *ix, *iy,*image;
        int width, height;
} FL_HVSBOX;

typedef struct  {
        OPDS    h;
        MYFLT *kx, *ky, *ihandle;
        void *WidgAddress, *opcode;
        MYFLT old_x, old_y;
} FL_SET_HVS_VALUE;

typedef struct  {
        OPDS    h;
        MYFLT max[MAXCHNLS];
        unsigned long widg_address[MAXCHNLS];
        int dummycycles, dummycyc;
} FLTKMETER;

#endif          /* CSOUND_WIDGETS_CPP */
#endif          /* CSOUND_WIDGETS_H */