| 1 |
#ifndef _EEGWindow_h_ |
| 2 |
#define _EEGWindow_h_ |
| 3 |
/* EEGWindow.h |
| 4 |
* |
| 5 |
* Copyright (C) 2011-2018,2022 Paul Boersma |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 |
* See the GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "FunctionEditor.h" |
| 22 |
#include "EEGArea.h" |
| 23 |
#include "EEGAnalysisArea.h" |
| 24 |
#include "TextGridArea.h" |
| 25 |
|
| 26 |
Thing_define (EEGWindow, FunctionEditor) { |
| 27 |
DEFINE_FunctionArea (1, EEGArea, eegArea) |
| 28 |
DEFINE_FunctionArea (2, EEGAnalysisArea, eegAnalysisArea) |
| 29 |
DEFINE_FunctionArea (3, TextGridArea, textGridArea) |
| 30 |
|
| 31 |
EEG eeg() { return static_cast <EEG> (our data()); } |
| 32 |
|
| 33 |
bool v_hasText () override { return true; } |
| 34 |
bool v_hasSelectionViewer () override { return true; } |
| 35 |
void v_drawSelectionViewer () override { |
| 36 |
TextGridArea_drawSelectionViewer (our textGridArea().get()); |
| 37 |
} |
| 38 |
void v_clickSelectionViewer (double x_fraction, double y_fraction) override { |
| 39 |
TextGridArea_clickSelectionViewer (our textGridArea().get(), x_fraction, y_fraction); |
| 40 |
} |
| 41 |
conststring32 v_selectionViewerName () |
| 42 |
override { return U"IPA chart"; } |
| 43 |
void v1_dataChanged (Editor sender) override { |
| 44 |
our EEGWindow_Parent :: v1_dataChanged (sender); |
| 45 |
our eegArea() -> functionChanged (our eeg() -> sound.get()); |
| 46 |
our eegAnalysisArea() -> functionChanged (our eeg() -> sound.get()); |
| 47 |
our textGridArea() -> functionChanged (our eeg() -> textgrid.get()); |
| 48 |
} |
| 49 |
void v_distributeAreas () override { |
| 50 |
our eegArea() -> setGlobalYRange_fraction (0.65, 1.0); |
| 51 |
our eegAnalysisArea() -> setGlobalYRange_fraction (0.35, 0.65); |
| 52 |
our textGridArea() -> setGlobalYRange_fraction (0.0, 0.35); |
| 53 |
} |
| 54 |
void v_draw () override { |
| 55 |
FunctionArea_drawOne (our eegArea().get()); |
| 56 |
if (our eegAnalysisArea() -> hasContentToShow()) { |
| 57 |
FunctionArea_prepareCanvas (our eegAnalysisArea().get()); |
| 58 |
our eegAnalysisArea() -> v_draw_analysis (); |
| 59 |
} |
| 60 |
FunctionArea_drawOne (our textGridArea().get()); |
| 61 |
} |
| 62 |
void v_createMenuItems_help (EditorMenu menu) |
| 63 |
override; |
| 64 |
void v_createMenus () |
| 65 |
override; |
| 66 |
void v_updateMenuItems () |
| 67 |
override; |
| 68 |
void v_drawLegends () override { |
| 69 |
FunctionArea_drawLegend (our textGridArea().get(), |
| 70 |
FunctionArea_legend_TEXTGRID U" ##modifiable TextGrid", |
| 71 |
DataGui_defaultForegroundColour (our textGridArea().get(), false) |
| 72 |
); |
| 73 |
FunctionArea_drawLegend (our eegArea().get(), |
| 74 |
FunctionArea_legend_WAVEFORM U" %%non-modifiable EEG-internal sound", |
| 75 |
DataGui_defaultForegroundColour (our eegArea().get(), false) |
| 76 |
); |
| 77 |
SoundAnalysisArea_drawDefaultLegends (our eegAnalysisArea().get()); |
| 78 |
} |
| 79 |
|
| 80 |
GuiMenuItem extractSelectedEEGPreserveTimesButton, extractSelectedEEGTimeFromZeroButton; |
| 81 |
|
| 82 |
#include "EEGWindow_prefs.h" |
| 83 |
}; |
| 84 |
|
| 85 |
autoEEGWindow EEGWindow_create (conststring32 title, EEG eeg); |
| 86 |
|
| 87 |
/* End of file EEGWindow.h */ |
| 88 |
#endif |