1 /* 2 * Copyright (C) 2016-2017 Nick Mainsbridge <mainsbridge@gmail.com> 3 * Copyright (C) 2017-2019 Robin Gareus <robin@gareus.org> 4 * 5 * This program 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 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 #ifndef __gtk_ardour_tempo_curve_h__ 21 #define __gtk_ardour_tempo_curve_h__ 22 23 #include <string> 24 #include <glib.h> 25 26 #include <sigc++/signal.h> 27 28 #include "ardour/ardour.h" 29 #include "pbd/signals.h" 30 31 #include "canvas/types.h" 32 #include "canvas/framed_curve.h" 33 #include "canvas/text.h" 34 35 namespace ARDOUR { 36 class TempoSection; 37 } 38 class PublicEditor; 39 40 class TempoCurve : public sigc::trackable 41 { 42 public: 43 TempoCurve (PublicEditor& editor, ArdourCanvas::Container &, guint32 rgba, ARDOUR::TempoSection& temp, samplepos_t sample, bool handle_events); 44 ~TempoCurve (); 45 46 static PBD::Signal1<void,TempoCurve*> CatchDeletion; 47 48 static void setup_sizes (const double timebar_height); 49 50 ArdourCanvas::Item& the_item() const; 51 void canvas_height_set (double); 52 53 void set_position (samplepos_t lower, samplepos_t upper); 54 void set_color_rgba (uint32_t rgba); position()55 samplepos_t position() const { return sample_position; } 56 get_parent()57 ArdourCanvas::Container* get_parent() { return _parent; } 58 void reparent (ArdourCanvas::Container& parent); 59 60 void hide (); 61 void show (); 62 tempo()63 ARDOUR::TempoSection& tempo () const { return _tempo; } 64 set_max_tempo(const double & max)65 void set_max_tempo (const double& max) { _max_tempo = max; } set_min_tempo(const double & min)66 void set_min_tempo (const double& min) { _min_tempo = min; } 67 68 protected: 69 PublicEditor& editor; 70 71 ArdourCanvas::Container* _parent; 72 ArdourCanvas::Container* group; 73 ArdourCanvas::Points* points; 74 ArdourCanvas::FramedCurve* _curve; 75 76 double unit_position; 77 samplepos_t sample_position; 78 samplepos_t _end_sample; 79 bool _shown; 80 double _canvas_height; 81 uint32_t _color; 82 83 void reposition (); 84 85 private: 86 /* disallow copy construction */ 87 TempoCurve (TempoCurve const &); 88 89 TempoCurve & operator= (TempoCurve const &); 90 91 double _min_tempo; 92 double _max_tempo; 93 94 ARDOUR::TempoSection& _tempo; 95 ArdourCanvas::Text* _start_text; 96 ArdourCanvas::Text* _end_text; 97 }; 98 #endif /* __gtk_ardour_tempo_curve_h__ */ 99