1 /* 2 * Copyright (C) 2007-2014 David Robillard <d@drobilla.net> 3 * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net> 4 * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License along 17 * with this program; if not, write to the Free Software Foundation, Inc., 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 */ 20 21 #ifndef __gtk_ardour_automation_region_view_h__ 22 #define __gtk_ardour_automation_region_view_h__ 23 24 #include "ardour/types.h" 25 26 #include "region_view.h" 27 #include "automation_time_axis.h" 28 #include "automation_line.h" 29 #include "enums.h" 30 31 namespace ARDOUR { 32 class AutomationList; 33 class Parameter; 34 }; 35 36 class TimeAxisView; 37 38 class AutomationRegionView : public RegionView 39 { 40 public: 41 AutomationRegionView(ArdourCanvas::Container*, 42 AutomationTimeAxisView&, 43 boost::shared_ptr<ARDOUR::Region>, 44 const Evoral::Parameter& parameter, 45 boost::shared_ptr<ARDOUR::AutomationList>, 46 double initial_samples_per_pixel, 47 uint32_t basic_color); 48 49 ~AutomationRegionView(); 50 51 void init (bool wfd); 52 53 bool paste (samplepos_t pos, 54 unsigned paste_count, 55 float times, 56 boost::shared_ptr<const ARDOUR::AutomationList> slist); 57 region_relative_time_converter()58 ARDOUR::DoubleBeatsSamplesConverter const & region_relative_time_converter () const { 59 return _region_relative_time_converter; 60 } 61 source_relative_time_converter()62 ARDOUR::DoubleBeatsSamplesConverter const & source_relative_time_converter () const { 63 return _source_relative_time_converter; 64 } 65 automation_view()66 inline AutomationTimeAxisView* automation_view() const 67 { return dynamic_cast<AutomationTimeAxisView*>(&trackview); } 68 line()69 boost::shared_ptr<AutomationLine> line() { return _line; } 70 71 // We are a ghost. Meta ghosts? Crazy talk. add_ghost(TimeAxisView &)72 virtual GhostRegion* add_ghost(TimeAxisView&) { return 0; } 73 74 uint32_t get_fill_color() const; 75 76 void set_height (double); 77 void reset_width_dependent_items(double pixel_width); 78 79 protected: 80 void create_line(boost::shared_ptr<ARDOUR::AutomationList> list); 81 bool set_position(samplepos_t pos, void* src, double* ignored); 82 void region_resized (const PBD::PropertyChange&); 83 bool canvas_group_event(GdkEvent* ev); 84 void add_automation_event (GdkEvent* event, samplepos_t when, double y, bool with_guard_points); 85 void mouse_mode_changed (); 86 void entered(); 87 void exited(); 88 89 private: 90 ARDOUR::DoubleBeatsSamplesConverter _region_relative_time_converter; 91 ARDOUR::DoubleBeatsSamplesConverter _source_relative_time_converter; 92 Evoral::Parameter _parameter; 93 boost::shared_ptr<AutomationLine> _line; 94 PBD::ScopedConnection _mouse_mode_connection; 95 }; 96 97 #endif /* __gtk_ardour_automation_region_view_h__ */ 98