| 1 |
// ---------------------------------------------------------------------------- |
| 2 |
// |
| 3 |
// Copyright (C) 2003-2013 Fons Adriaensen <[email protected]> |
| 4 |
// |
| 5 |
// This program is free software; you can redistribute it and/or modify |
| 6 |
// it under the terms of the GNU General Public License as published by |
| 7 |
// the Free Software Foundation; either version 3 of the License, or |
| 8 |
// (at your option) any later version. |
| 9 |
// |
| 10 |
// This program is distributed in the hope that it will be useful, |
| 11 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
// GNU General Public License for more details. |
| 14 |
// |
| 15 |
// You should have received a copy of the GNU General Public License |
| 16 |
// along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
// |
| 18 |
// ---------------------------------------------------------------------------- |
| 19 |
|
| 20 |
|
| 21 |
#ifndef __MAINWIN_H |
| 22 |
#define __MAINWIN_H |
| 23 |
|
| 24 |
|
| 25 |
#include <clthreads.h> |
| 26 |
#include <clxclient.h> |
| 27 |
#include "global.h" |
| 28 |
#include "splashwin.h" |
| 29 |
#include "impdata.h" |
| 30 |
#include "editwin.h" |
| 31 |
#include "filewin.h" |
| 32 |
#include "filtwin.h" |
| 33 |
#include "progwin.h" |
| 34 |
#include "exptwin.h" |
| 35 |
#include "convolve.h" |
| 36 |
#include "acweight.h" |
| 37 |
|
| 38 |
|
| 39 |
class Mainwin : public X_window, public X_callback |
| 40 |
{ |
| 41 |
public: |
| 42 |
|
| 43 |
Mainwin (X_window *parent, X_resman *resman, X_callback *callb, Filewin *filewin, ITC_ctrl *itcctrl); |
| 44 |
~Mainwin (void); |
| 45 |
|
| 46 |
bool running (void) const { return _state != EXIT; } |
| 47 |
void stop (void); |
| 48 |
void handle_time (void); |
| 49 |
void handle_mesg (ITC_mesg *); |
| 50 |
void handle_prog (void); |
| 51 |
void set_sess (const char *sess) { _sessdir = sess; } |
| 52 |
|
| 53 |
private: |
| 54 |
|
| 55 |
enum { INIT, VIEW, CONV, EDIT, SINT, FILT, TERM, EXIT }; |
| 56 |
enum { LMAR = 5, TMAR = 60 }; |
| 57 |
enum |
| 58 |
{ |
| 59 |
XPOS = 100, YPOS = 100, |
| 60 |
XMIN = 650, YMIN = 350, |
| 61 |
XDEF = 800, YDEF = 500 |
| 62 |
}; |
| 63 |
|
| 64 |
enum |
| 65 |
{ |
| 66 |
B_SESS, B_LOAD, B_SAVE, B_IMPT, B_EXPT, |
| 67 |
B_SGEN, B_CAPT, B_CONV, B_EDIT, B_SINT, B_FILT, |
| 68 |
B_CANC, B_APPL, B_SONE, B_SALL, |
| 69 |
B_FILE, |
| 70 |
B_TREF, B_GAIN, B_TRM0, B_TRM1, B_FADE, |
| 71 |
B_FRMI, B_FRPL, B_CHAN |
| 72 |
}; |
| 73 |
|
| 74 |
virtual void handle_event (XEvent *); |
| 75 |
virtual void handle_callb (int, X_window *, XEvent *); |
| 76 |
|
| 77 |
void xcmesg (XClientMessageEvent *); |
| 78 |
void resize (XConfigureEvent *E); |
| 79 |
void makewin (void); |
| 80 |
void addtext (X_window *W, int xp, int yp, int xs, int ys, const char *text, int align); |
| 81 |
void askdata (X_textip *T); |
| 82 |
void ptime (int v, X_textip *T); |
| 83 |
void fileinfo (void); |
| 84 |
|
| 85 |
void settrace (int k, int b); |
| 86 |
void modif (X_window *W); |
| 87 |
void apply (void); |
| 88 |
void cancel (void); |
| 89 |
|
| 90 |
void next_sect (int d); |
| 91 |
void save_one (void); |
| 92 |
void save_all (void); |
| 93 |
|
| 94 |
void file_load (void); |
| 95 |
void file_save (void); |
| 96 |
void file_impt (void); |
| 97 |
void file_expt (void); |
| 98 |
|
| 99 |
void set_disp (Impdata *data, int nchan1, const char **labels); |
| 100 |
void set_view (void); |
| 101 |
void set_conv (void); |
| 102 |
void set_edit (void); |
| 103 |
void set_sint (void); |
| 104 |
void set_filt (void); |
| 105 |
|
| 106 |
void conv_init (void); |
| 107 |
int conv_prep (M_calc_conv *); |
| 108 |
int conv_save (const char *, bool); |
| 109 |
void conv_calc_one (const char *); |
| 110 |
void conv_done_one (M_calc_conv *); |
| 111 |
void conv_calc_all (const char *); |
| 112 |
void conv_done_all (M_calc_conv *); |
| 113 |
|
| 114 |
void edit_init (void); |
| 115 |
int edit_prep (M_calc_edit *); |
| 116 |
int edit_save (const char *, bool); |
| 117 |
void edit_calc_one (const char *); |
| 118 |
void edit_done_one (M_calc_edit *); |
| 119 |
void edit_calc_all (const char *); |
| 120 |
|
| 121 |
void edit_done_all (M_calc_edit *); |
| 122 |
void edit_tref (bool undo); |
| 123 |
void edit_gain (bool undo, bool norm); |
| 124 |
void edit_trim0 (bool undo); |
| 125 |
void edit_trim1 (bool undo); |
| 126 |
void edit_fade (bool undo); |
| 127 |
|
| 128 |
void sint_init (void); |
| 129 |
void sint_exec (void); |
| 130 |
|
| 131 |
Atom _xatom; |
| 132 |
X_callback *_callb; |
| 133 |
int _xp; |
| 134 |
int _yp; |
| 135 |
int _xs; |
| 136 |
int _ys; |
| 137 |
int _state; |
| 138 |
int _count; |
| 139 |
int _tmask; |
| 140 |
bool _flock; |
| 141 |
bool _doall; |
| 142 |
ITC_ctrl *_itcctrl; |
| 143 |
Splashwin *_splashw; |
| 144 |
Filewin *_filewin; |
| 145 |
Exptwin *_exptwin; |
| 146 |
Editwin *_editwin; |
| 147 |
Filtwin *_filtwin; |
| 148 |
Progwin *_progwin; |
| 149 |
X_window *_ifwview; |
| 150 |
X_window *_ifwconv; |
| 151 |
X_window *_ifwedit; |
| 152 |
X_window *_ifwsint; |
| 153 |
X_window *_ifwfilt; |
| 154 |
|
| 155 |
X_menuwin *_mfile; |
| 156 |
X_button *_bsess; |
| 157 |
X_button *_bload; |
| 158 |
X_button *_bsave; |
| 159 |
X_button *_bimpt; |
| 160 |
X_button *_bexpt; |
| 161 |
X_textip *_tfile; |
| 162 |
|
| 163 |
X_button *_bsgen; |
| 164 |
X_button *_bcapt; |
| 165 |
X_button *_bconv; |
| 166 |
X_button *_bedit; |
| 167 |
X_button *_bsint; |
| 168 |
X_button *_bfilt; |
| 169 |
|
| 170 |
X_tbutton *_bchan [4]; |
| 171 |
X_button *_bfrmi; |
| 172 |
X_button *_bfrpl; |
| 173 |
X_textip *_tfrag; |
| 174 |
|
| 175 |
X_window *_modwin; |
| 176 |
Impdata *_disp; |
| 177 |
char _file1 [1024]; |
| 178 |
char _file2 [1024]; |
| 179 |
char *_base1; |
| 180 |
Impdata *_data1; |
| 181 |
Impdata *_data2; |
| 182 |
int _nchan1; |
| 183 |
int _cmask2; |
| 184 |
|
| 185 |
X_tbutton *_bappl; |
| 186 |
X_textip *_tcfil; |
| 187 |
X_textip *_tcfil1; |
| 188 |
X_textip *_tcfil2; |
| 189 |
X_textip *_tctim1; |
| 190 |
X_textip *_tctim2; |
| 191 |
Convolver *_convol; |
| 192 |
unsigned int _convlen; |
| 193 |
|
| 194 |
X_tbutton *_btref; |
| 195 |
X_tbutton *_bgain; |
| 196 |
X_textip *_ttref; |
| 197 |
X_textip *_tgain; |
| 198 |
X_tbutton *_btrim0; |
| 199 |
X_tbutton *_btrim1; |
| 200 |
X_textip *_ttrm00; |
| 201 |
X_textip *_ttrm01; |
| 202 |
X_textip *_ttrm10; |
| 203 |
X_textip *_ttrm11; |
| 204 |
X_tbutton *_bfade; |
| 205 |
X_textip *_ttfade; |
| 206 |
X_textip *_tslope; |
| 207 |
int _offs; |
| 208 |
float _gain; |
| 209 |
int _ind0; |
| 210 |
int _ind1; |
| 211 |
int _trm00; |
| 212 |
int _trm01; |
| 213 |
int _trm10; |
| 214 |
int _trm11; |
| 215 |
int _tfade; |
| 216 |
float _slope; |
| 217 |
|
| 218 |
ACweight *_awfilt; |
| 219 |
int _subs; |
| 220 |
|
| 221 |
int _prog0; |
| 222 |
int _prog1; |
| 223 |
|
| 224 |
const char *_sessdir; |
| 225 |
|
| 226 |
// static X_menuwin_item _mfile_def []; |
| 227 |
}; |
| 228 |
|
| 229 |
|
| 230 |
#endif |