| 1 | /* DurationTierEditor.cpp |
| 2 | * |
| 3 | * Copyright (C) 1992-2012,2014-2016,2018,2020,2022 Paul Boersma |
| 4 | * |
| 5 | * This code 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 2 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This code is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 | * See the 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 work. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "DurationTierEditor.h" |
| 20 | #include "EditorM.h" |
| 21 | |
| 22 | Thing_implement (DurationTierEditor, RealTierEditor, 0); |
| 23 | |
| 24 | static void menu_cb_DurationTierHelp (DurationTierEditor, EDITOR_ARGS) { Melder_help (U"DurationTier"); } |
| 25 | |
| 26 | void structDurationTierEditor :: v_createMenuItems_help (EditorMenu menu) { |
| 27 | DurationTierEditor_Parent :: v_createMenuItems_help (menu); |
| 28 | EditorMenu_addCommand (menu, U"DurationTier help", 0, menu_cb_DurationTierHelp); |
| 29 | } |
| 30 | |
| 31 | void structDurationTierEditor :: v_play (double fromTime, double toTime) { |
| 32 | if (our soundArea()) { |
| 33 | Sound_playPart (our soundArea() -> sound(), fromTime, toTime, nullptr, nullptr); |
| 34 | } else { |
| 35 | //DurationTier_playPart (data, fromTime, toTime, false); |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | autoDurationTierEditor DurationTierEditor_create (conststring32 title, DurationTier durationTier, Sound soundToCopy) { |
| 40 | try { |
| 41 | autoDurationTierEditor me = Thing_new (DurationTierEditor); |
| 42 | my realTierArea() = DurationTierArea_create (true, nullptr, me.get()); |
| 43 | if (soundToCopy) |
| 44 | my soundArea() = SoundArea_create (false, soundToCopy, me.get()); |
| 45 | FunctionEditor_init (me.get(), title, durationTier); |
| 46 | return me; |
| 47 | } catch (MelderError) { |
| 48 | Melder_throw (U"DurationTier window not created."); |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /* End of file DurationTierEditor.cpp */ |