| 1 | #ifndef _RealTierEditor_h_ |
| 2 | #define _RealTierEditor_h_ |
| 3 | /* RealTierEditor.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2005,2007-2012,2015-2018,2020-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 "RealTierArea.h" |
| 23 | #include "SoundArea.h" |
| 24 | |
| 25 | Thing_define (RealTierEditor, FunctionEditor) { |
| 26 | DEFINE_FunctionArea (1, RealTierArea, realTierArea) |
| 27 | DEFINE_FunctionArea (2, SoundArea, soundArea) |
| 28 | |
| 29 | void v1_dataChanged (Editor sender) override { |
| 30 | our RealTierEditor_Parent :: v1_dataChanged (sender); |
| 31 | our realTierArea() -> functionChanged (static_cast <RealTier> (our data())); |
| 32 | if (our soundArea()) |
| 33 | our soundArea() -> functionChanged (nullptr); // BUG: the copy probably doesn't change |
| 34 | } |
| 35 | void v_distributeAreas () override { |
| 36 | if (our soundArea()) { |
| 37 | our realTierArea() -> setGlobalYRange_fraction (0.0, 0.618); |
| 38 | our soundArea() -> setGlobalYRange_fraction (0.618, 1.0); |
| 39 | } else { |
| 40 | our realTierArea() -> setGlobalYRange_fraction (0.0, 1.0); |
| 41 | } |
| 42 | } |
| 43 | void v_play (double startTime, double endTime) override { |
| 44 | if (our soundArea()) |
| 45 | Sound_playPart (our soundArea() -> sound(), startTime, endTime, theFunctionEditor_playCallback, this); |
| 46 | } |
| 47 | void v_drawLegends () override { |
| 48 | FunctionArea_drawLegend (our realTierArea().get(), |
| 49 | FunctionArea_legend_LINES_SPECKLES U" ##modifiable RealTier", |
| 50 | DataGui_defaultForegroundColour (our realTierArea().get(), false) |
| 51 | ); |
| 52 | if (our soundArea()) |
| 53 | FunctionArea_drawLegend (our soundArea().get(), |
| 54 | FunctionArea_legend_WAVEFORM U" %%non-modifiable copy of sound", |
| 55 | DataGui_defaultForegroundColour (our soundArea().get(), false) |
| 56 | ); |
| 57 | } |
| 58 | }; |
| 59 | |
| 60 | autoRealTierEditor RealTierEditor_create (conststring32 title, RealTier tier, Sound optionalSoundToCopy); |
| 61 | |
| 62 | /* End of file RealTierEditor.h */ |
| 63 | #endif |