| 1 |
#ifndef _PointEditor_h_ |
| 2 |
#define _PointEditor_h_ |
| 3 |
/* PointEditor.h |
| 4 |
* |
| 5 |
* Copyright (C) 1992-2011,2012,2015,2016,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 "PointArea.h" |
| 23 |
#include "SoundArea.h" |
| 24 |
#include "PointProcess_and_Sound.h" |
| 25 |
|
| 26 |
Thing_define (PointEditor, FunctionEditor) { |
| 27 |
DEFINE_FunctionArea (1, PointArea, pointArea) |
| 28 |
DEFINE_FunctionArea (2, SoundArea, soundArea) |
| 29 |
|
| 30 |
void v1_dataChanged (Editor sender) override { |
| 31 |
PointEditor_Parent :: v1_dataChanged (sender); |
| 32 |
our pointArea() -> functionChanged (static_cast <PointProcess> (our data())); |
| 33 |
if (our soundArea()) |
| 34 |
our soundArea() -> functionChanged (nullptr); |
| 35 |
} |
| 36 |
void v_distributeAreas () override { |
| 37 |
our pointArea() -> setGlobalYRange_fraction (0.0, 1.0); |
| 38 |
if (our soundArea()) |
| 39 |
our soundArea() -> setGlobalYRange_fraction (0.0, 1.0); |
| 40 |
} |
| 41 |
void v_draw () override { |
| 42 |
if (our soundArea()) |
| 43 |
FunctionArea_drawTwo (our soundArea().get(), our pointArea().get()); |
| 44 |
else |
| 45 |
FunctionArea_drawOne (our pointArea().get()); |
| 46 |
} |
| 47 |
void v_createMenuItems_help (EditorMenu menu) |
| 48 |
override; |
| 49 |
void v_play (double startTime, double endTime) override { |
| 50 |
if (our soundArea()) |
| 51 |
Sound_playPart (our soundArea() -> sound(), startTime, endTime, theFunctionEditor_playCallback, this); |
| 52 |
else |
| 53 |
PointProcess_playPart (our pointArea() -> pointProcess(), startTime, endTime, theFunctionEditor_playCallback, this); |
| 54 |
} |
| 55 |
}; |
| 56 |
|
| 57 |
autoPointEditor PointEditor_create (conststring32 title, PointProcess point, Sound optionalCopyOfSound); |
| 58 |
|
| 59 |
/* End of file PointEditor.h */ |
| 60 |
#endif |