update drobilla's fascistic dir-locals.el to force emacs users into whitespace submis...
[ardour.git] / gtk2_ardour / automation_region_view.cc
index ca1e787f3a3fb2332244baca48f50c6303ce9023..f26923de414b3a7aa1f0f9cd3f672fdbb8775578 100644 (file)
 
 #include "i18n.h"
 
-AutomationRegionView::AutomationRegionView(ArdourCanvas::Group*                      parent,
-                                           AutomationTimeAxisView&                   time_axis,
-                                           boost::shared_ptr<ARDOUR::Region>         region,
-                                           const Evoral::Parameter&                  param,
-                                           boost::shared_ptr<ARDOUR::AutomationList> list,
-                                           double                                    spu,
-                                           Gdk::Color const &                        basic_color)
+AutomationRegionView::AutomationRegionView (ArdourCanvas::Group*                      parent,
+                                           AutomationTimeAxisView&                   time_axis,
+                                           boost::shared_ptr<ARDOUR::Region>         region,
+                                           const Evoral::Parameter&                  param,
+                                           boost::shared_ptr<ARDOUR::AutomationList> list,
+                                           double                                    spu,
+                                           Gdk::Color const &                        basic_color)
        : RegionView(parent, time_axis, region, spu, basic_color, true)
        , _parameter(param)
 {
@@ -67,8 +67,6 @@ AutomationRegionView::init (Gdk::Color const & basic_color, bool /*wfd*/)
 
        set_height (trackview.current_height());
 
-       _region->PropertyChanged.connect (*this, invalidator (*this), ui_bind (&RegionView::region_changed, this, _1), gui_context());
-
        set_colors ();
 
        _enable_display = true;
@@ -88,10 +86,11 @@ AutomationRegionView::create_line (boost::shared_ptr<ARDOUR::AutomationList> lis
        _line->show();
        _line->show_all_control_points();
        _line->set_maximum_time (_region->length());
+       _line->set_offset (_region->start ());
 }
 
 bool
-AutomationRegionView::canvas_event(GdkEvent* ev)
+AutomationRegionView::canvas_event (GdkEvent* ev)
 {
        PublicEditor& e = trackview.editor ();
 
@@ -126,7 +125,7 @@ AutomationRegionView::canvas_event(GdkEvent* ev)
  *  @param y y position, relative to our TimeAxisView.
  */
 void
-AutomationRegionView::add_automation_event (GdkEvent *, nframes_t when, double y)
+AutomationRegionView::add_automation_event (GdkEvent *, framepos_t when, double y)
 {
        if (!_line) {
                boost::shared_ptr<Evoral::Control> c = _region->control(_parameter, true);
@@ -179,7 +178,7 @@ AutomationRegionView::set_height (double h)
 }
 
 bool
-AutomationRegionView::set_position (nframes64_t pos, void* src, double* ignored)
+AutomationRegionView::set_position (framepos_t pos, void* src, double* ignored)
 {
        if (_line) {
                _line->set_maximum_time (_region->length ());
@@ -203,10 +202,17 @@ AutomationRegionView::reset_width_dependent_items (double pixel_width)
 void
 AutomationRegionView::region_resized (const PBD::PropertyChange& what_changed)
 {
-       RegionView::region_resized(what_changed);
+       RegionView::region_resized (what_changed);
 
-       if (_line) {
-               _line->reset();
+       if (!_line) {
+               return;
+       }
+
+       if (what_changed.contains (ARDOUR::Properties::start)) {
+               _line->set_offset (_region->start ());
+       }
+
+       if (what_changed.contains (ARDOUR::Properties::length)) {
                _line->set_maximum_time (_region->length());
        }
 }
@@ -215,15 +221,16 @@ AutomationRegionView::region_resized (const PBD::PropertyChange& what_changed)
 void
 AutomationRegionView::entered (bool)
 {
-       if (_line)
+       if (_line) {
                _line->track_entered();
+       }
 }
 
 
 void
-AutomationRegionView::exited()
+AutomationRegionView::exited ()
 {
-       if (_line)
+       if (_line) {
                _line->track_exited();
+       }
 }
-