diff options
-rw-r--r-- | gtk2_ardour/region_gain_line.cc | 15 | ||||
-rw-r--r-- | gtk2_ardour/region_gain_line.h | 3 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index cbeb1224af..5ac985fa9a 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -30,6 +30,7 @@ #include "time_axis_view.h" #include "editor.h" +#include "gui_thread.h" #include "i18n.h" @@ -46,6 +47,8 @@ AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& _time_converter->set_origin_b (r.region()->position() - r.region()->start()); + r.region()->PropertyChanged.connect (_region_changed_connection, invalidator (*this), boost::bind (&AudioRegionGainLine::region_changed, this, _1), gui_context()); + group->raise_to_top (); group->set_y_position (2); set_uses_gain_mapping (true); @@ -96,3 +99,15 @@ AudioRegionGainLine::end_drag (bool with_push, uint32_t final_index) AutomationLine::end_drag (with_push, final_index); } +void +AudioRegionGainLine::region_changed (const PropertyChange& what_changed) +{ + PropertyChange interesting_stuff; + + interesting_stuff.add (ARDOUR::Properties::start); + interesting_stuff.add (ARDOUR::Properties::position); + + if (what_changed.contains (interesting_stuff)) { + _time_converter->set_origin_b (rv.region()->position() - rv.region()->start()); + } +} diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 1395bc3f6f..683537ee69 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -42,7 +42,10 @@ class AudioRegionGainLine : public AutomationLine void remove_point (ControlPoint&); + private: + PBD::ScopedConnection _region_changed_connection; + void region_changed (const PBD::PropertyChange& what_changed); AudioRegionView& rv; }; |