| 1 | /* |
| 2 | cwindow.h: |
| 3 | |
| 4 | Copyright (C) 1990 Dan Ellis |
| 5 | |
| 6 | This file is part of Csound. |
| 7 | |
| 8 | The Csound Library is free software; you can redistribute it |
| 9 | and/or modify it under the terms of the GNU Lesser General Public |
| 10 | License as published by the Free Software Foundation; either |
| 11 | version 2.1 of the License, or (at your option) any later version. |
| 12 | |
| 13 | Csound is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU Lesser General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU Lesser General Public |
| 19 | License along with Csound; if not, write to the Free Software |
| 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 | 02110-1301 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef CWINDOW_H |
| 25 | #define CWINDOW_H |
| 26 | |
| 27 | /*******************************************************\ |
| 28 | * cwindow.h * |
| 29 | * portable window graphs stolen from Csound * |
| 30 | * necessary header declarations * |
| 31 | * 08nov90 dpwe * |
| 32 | \*******************************************************/ |
| 33 | |
| 34 | #include "csound.h" |
| 35 | |
| 36 | #define CAPSIZE 60 |
| 37 | |
| 38 | struct windat_ { |
| 39 | uintptr_t windid; /* set by MakeGraph() */ |
| 40 | MYFLT *fdata; /* data passed to DrawGraph */ |
| 41 | int32 npts; /* size of above array */ |
| 42 | char caption[CAPSIZE]; /* caption string for graph */ |
| 43 | int16 waitflg; /* set =1 to wait for ms after Draw */ |
| 44 | int16 polarity; /* controls positioning of X axis */ |
| 45 | MYFLT max, min; /* workspace .. extrema this frame */ |
| 46 | MYFLT absmax; /* workspace .. largest of above */ |
| 47 | MYFLT oabsmax; /* Y axis scaling factor */ |
| 48 | int danflag; /* set to 1 for extra Yaxis mid span */ |
| 49 | int absflag; /* set to 1 to skip abs check */ |
| 50 | }; |
| 51 | |
| 52 | enum { /* symbols for WINDAT.polarity field */ |
| 53 | NOPOL, |
| 54 | NEGPOL, |
| 55 | POSPOL, |
| 56 | BIPOL |
| 57 | }; |
| 58 | |
| 59 | struct xyindat_ { /* for 'joystick' input window */ |
| 60 | uintptr_t windid; /* xwindow handle */ |
| 61 | int m_x,m_y; /* current crosshair pixel adr */ |
| 62 | MYFLT x,y; /* current proportions of fsd */ |
| 63 | int down; |
| 64 | }; |
| 65 | |
| 66 | /* ------------------------------------------------------------------------ */ |
| 67 | |
| 68 | #ifdef __BUILDING_LIBCSOUND |
| 69 | |
| 70 | void dispset(CSOUND *, WINDAT *, MYFLT *, int32, char *, int, char *); |
| 71 | int dispexit(CSOUND *); |
| 72 | void display(CSOUND *, WINDAT*); |
| 73 | #if 0 |
| 74 | /* create window for a graph */ |
| 75 | void MakeGraph(CSOUND *, WINDAT *, const char *); |
| 76 | /* create a mouse input window; init scale */ |
| 77 | void MakeXYin(CSOUND *, XYINDAT *, MYFLT, MYFLT); |
| 78 | /* update graph in existing window */ |
| 79 | void DrawGraph(CSOUND *, WINDAT *); |
| 80 | /* fetch latest value from mouse input window */ |
| 81 | void ReadXYin(CSOUND *, XYINDAT *); |
| 82 | /* remove a graph window */ |
| 83 | void KillGraph(CSOUND *, WINDAT *); |
| 84 | /* remove a mouse input window */ |
| 85 | void KillXYin(CSOUND *, XYINDAT *); |
| 86 | /* print click-Exit message in most recently active window */ |
| 87 | int ExitGraph(CSOUND *); |
| 88 | #endif |
| 89 | |
| 90 | #endif /* __BUILDING_LIBCSOUND */ |
| 91 | |
| 92 | #endif /* CWINDOW_H */ |
| 93 |