| 1 |
#ifndef _SpectrumEditor_h_ |
| 2 |
#define _SpectrumEditor_h_ |
| 3 |
/* SpectrumEditor.h |
| 4 |
* |
| 5 |
* Copyright (C) 1992-2005,2007-2013,2015,2016,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 "SpectrumArea.h" |
| 23 |
|
| 24 |
Thing_define (SpectrumEditor, FunctionEditor) { |
| 25 |
DEFINE_FunctionArea (1, SpectrumArea, spectrumArea) |
| 26 |
|
| 27 |
void v1_dataChanged (Editor sender) override { |
| 28 |
SpectrumEditor_Parent :: v1_dataChanged (sender); |
| 29 |
Thing_cast (Spectrum, spectrum, our data()); |
| 30 |
our spectrumArea() -> functionChanged (spectrum); |
| 31 |
} |
| 32 |
void v_distributeAreas () override { |
| 33 |
our spectrumArea() -> setGlobalYRange_fraction (0.0, 1.0); |
| 34 |
} |
| 35 |
void v_createMenuItems_help (EditorMenu menu) |
| 36 |
override; |
| 37 |
void v_play (double fromFrequency, double toFrequency) override { |
| 38 |
SpectrumArea_play (our spectrumArea().get(), fromFrequency, toFrequency); |
| 39 |
} |
| 40 |
conststring32 v_domainName () |
| 41 |
override { return U"frequency"; } |
| 42 |
conststring32 v_format_domain () |
| 43 |
override { return U"Frequency"; } |
| 44 |
const char * v_format_short () |
| 45 |
override { return "%.0f"; } |
| 46 |
const char * v_format_long () |
| 47 |
override { return "%.2f"; } |
| 48 |
int v_fixedPrecision_long () |
| 49 |
override { return 2; } |
| 50 |
conststring32 v_format_units_long () |
| 51 |
override { return U"hertz"; } |
| 52 |
conststring32 v_format_units_short () |
| 53 |
override { return U"Hz"; } |
| 54 |
const char * v_format_totalDuration () |
| 55 |
override { return u8"Total bandwidth %.2f hertz"; } |
| 56 |
const char * v_format_window () |
| 57 |
override { return u8"Visible part %.2f hertz"; } |
| 58 |
const char * v_format_selection () |
| 59 |
override { return u8"%.2f Hz"; } |
| 60 |
|
| 61 |
#include "SpectrumEditor_prefs.h" |
| 62 |
}; |
| 63 |
|
| 64 |
autoSpectrumEditor SpectrumEditor_create (conststring32 title, Spectrum data); |
| 65 |
|
| 66 |
/* End of file SpectrumEditor.h */ |
| 67 |
#endif |