| 1 |
#ifndef _MovieWindow_h_ |
| 2 |
#define _MovieWindow_h_ |
| 3 |
/* MovieWindow.h |
| 4 |
* |
| 5 |
* Copyright (C) 2011,2012,2014-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 "MovieArea.h" |
| 23 |
#include "SoundArea.h" |
| 24 |
#include "SoundAnalysisArea.h" |
| 25 |
|
| 26 |
Thing_define (MovieWindow, FunctionEditor) { |
| 27 |
DEFINE_FunctionArea (1, MovieArea, videoArea) |
| 28 |
DEFINE_FunctionArea (2, SoundArea, soundArea) |
| 29 |
DEFINE_FunctionArea (3, SoundAnalysisArea, soundAnalysisArea) |
| 30 |
|
| 31 |
Movie movie() { return static_cast <Movie> (our data()); } |
| 32 |
|
| 33 |
void v1_dataChanged (Editor sender) override { |
| 34 |
MovieWindow_Parent :: v1_dataChanged (sender); // BUG: calls multiple functionChanged() |
| 35 |
our videoArea() -> functionChanged (our movie()); |
| 36 |
our soundArea() -> functionChanged (our movie() -> d_sound.get()); |
| 37 |
our soundAnalysisArea() -> functionChanged (our movie() -> d_sound.get()); |
| 38 |
} |
| 39 |
void v_distributeAreas () override { |
| 40 |
if (our soundAnalysisArea() -> hasContentToShow ()) { |
| 41 |
our videoArea() -> setGlobalYRange_fraction (0.0, 0.3); |
| 42 |
our soundArea() -> setGlobalYRange_fraction (0.7, 1.0); |
| 43 |
our soundAnalysisArea() -> setGlobalYRange_fraction (0.3, 0.7); |
| 44 |
} else { |
| 45 |
our videoArea() -> setGlobalYRange_fraction (0.0, 0.3); |
| 46 |
our soundArea() -> setGlobalYRange_fraction (0.3, 1.0); |
| 47 |
our soundAnalysisArea() -> setGlobalYRange_fraction (0.0, 0.0); |
| 48 |
} |
| 49 |
} |
| 50 |
void v_draw () override { |
| 51 |
if (our soundArea()) { |
| 52 |
FunctionArea_prepareCanvas (our soundArea().get()); |
| 53 |
if (our soundAnalysisArea() -> instancePref_pulses_show()) |
| 54 |
our soundAnalysisArea() -> v_draw_analysis_pulses (); |
| 55 |
FunctionArea_drawInside (our soundArea().get()); |
| 56 |
if (our soundAnalysisArea() -> hasContentToShow ()) { |
| 57 |
FunctionArea_prepareCanvas (our soundAnalysisArea().get()); |
| 58 |
our soundAnalysisArea() -> v_draw_analysis (); |
| 59 |
} |
| 60 |
} |
| 61 |
FunctionArea_drawOne (our videoArea().get()); |
| 62 |
} |
| 63 |
void v_play (double startTime, double endTime) override { |
| 64 |
Movie_play (our movie(), our graphics.get(), startTime, endTime, theFunctionEditor_playCallback, this); |
| 65 |
} |
| 66 |
}; |
| 67 |
|
| 68 |
autoMovieWindow MovieWindow_create (conststring32 title, Movie movie); |
| 69 |
|
| 70 |
/* End of file MovieWindow.h */ |
| 71 |
#endif |