1 #ifndef _RealTierArea_h_
2 #define _RealTierArea_h_
3 /* RealTierArea.h
4 *
5 * Copyright (C) 1992-2005,2007-2012,2015-2018,2020,2021 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 "FunctionArea.h"
22 #include "RealTier.h"
23
Thing_define(RealTierArea,FunctionArea)24 Thing_define (RealTierArea, FunctionArea) {
25 virtual double v_minimumLegalY () { return undefined; }
26 virtual double v_maximumLegalY () { return undefined; }
27 virtual conststring32 v_rightTickUnits () { return U""; }
28
29 double ymin, ymax, ycursor;
30 double anchorTime = undefined, anchorY;
31 bool draggingSelection;
32 double dt = 0.0, dy = 0.0;
33 integer firstSelected, lastSelected;
34
35 void viewRealTierAsWorldByWorld () const {
36 our setViewport ();
37 Graphics_setWindow (our graphics(), our startWindow(), our endWindow(), our ymin, our ymax);
38 }
39
40 #include "RealTierArea_prefs.h"
41 };
42
43 void RealTierArea_addPointAt (RealTierArea me, RealTier tier, double time, double desiredY);
44
45 void RealTierArea_removePoints (RealTierArea me, RealTier tier);
46
47 void RealTierArea_addPointAtCursor (RealTierArea me, RealTier tier);
48
49 void RealTierArea_updateScaling (RealTierArea me, RealTier tier);
50
51 void RealTierArea_draw (RealTierArea me, RealTier tier);
52
53 void RealTierArea_drawWhileDragging (RealTierArea me, RealTier tier);
54
55 bool RealTierArea_mouse (RealTierArea me, RealTier tier, GuiDrawingArea_MouseEvent event, double x_world, double y_fraction);
56
RealTierArea_init(RealTierArea me,FunctionEditor editor,double ymin_fraction,double ymax_fraction)57 inline void RealTierArea_init (RealTierArea me, FunctionEditor editor, double ymin_fraction, double ymax_fraction) {
58 FunctionArea_init (me, editor, ymin_fraction, ymax_fraction);
59 Melder_assert (isdefined (my p_dataFreeMinimum));
60 Melder_assert (isdefined (my p_dataFreeMaximum));
61 }
62
RealTierArea_create(FunctionEditor editor,double ymin_fraction,double ymax_fraction)63 inline autoRealTierArea RealTierArea_create (FunctionEditor editor, double ymin_fraction, double ymax_fraction) {
64 autoRealTierArea me = Thing_new (RealTierArea);
65 RealTierArea_init (me.get(), editor, ymin_fraction, ymax_fraction);
66 return me;
67 }
68
69 /* End of file RealTierArea.h */
70 #endif
71