diff options
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/automation_region_view.h | 1 | ||||
-rw-r--r-- | gtk2_ardour/automation_streamview.cc | 34 | ||||
-rw-r--r-- | gtk2_ardour/automation_streamview.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/automation_time_axis.cc | 1 |
4 files changed, 26 insertions, 12 deletions
diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index 6d3a00d4b6..691e2cd050 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -54,7 +54,6 @@ public: inline AutomationTimeAxisView* automation_view() const { return dynamic_cast<AutomationTimeAxisView*>(&trackview); } - void set_line(boost::shared_ptr<AutomationLine> line) { _line = line; } boost::shared_ptr<AutomationLine> line() { return _line; } // We are a ghost. Meta ghosts? Crazy talk. diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index fad14006b2..006834c59d 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -58,6 +58,7 @@ AutomationStreamView::AutomationStreamView (AutomationTimeAxisView& tv) new ArdourCanvas::Group(*tv.canvas_display())) , _controller(tv.controller()) , _automation_view(tv) + , _pending_automation_state (Off) { //canvas_rect->property_fill_color_rgba() = stream_base_color; canvas_rect->property_outline_color_rgba() = RGBA_BLACK; @@ -82,9 +83,9 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region mr->midi_source()->load_model(); } - const boost::shared_ptr<AutomationControl> control - = boost::dynamic_pointer_cast<AutomationControl>( - region->control(_controller->controllable()->parameter())); + const boost::shared_ptr<AutomationControl> control = boost::dynamic_pointer_cast<AutomationControl> ( + region->control (_controller->controllable()->parameter(), true) + ); boost::shared_ptr<AutomationList> list; if (control) { @@ -130,6 +131,12 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr<Region> region /* catch regionview going away */ region->DropReferences.connect (*this, invalidator (*this), boost::bind (&AutomationStreamView::remove_region_view, this, boost::weak_ptr<Region>(region)), gui_context()); + /* setup automation state for this region */ + boost::shared_ptr<AutomationLine> line = region_view->line (); + if (line && line->the_list()) { + line->the_list()->set_automation_state (automation_state ()); + } + RegionViewAdded (region_view); return region_view; @@ -144,11 +151,18 @@ AutomationStreamView::display_region(AutomationRegionView* region_view) void AutomationStreamView::set_automation_state (AutoState state) { - std::list<RegionView *>::iterator i; - for (i = region_views.begin(); i != region_views.end(); ++i) { - boost::shared_ptr<AutomationLine> line = ((AutomationRegionView*)(*i))->line(); - if (line && line->the_list()) { - line->the_list()->set_automation_state (state); + /* XXX: not sure if this is right, but for now the automation state is basically held by + the regions' AutomationLists. Each region is always set to have the same AutoState. + */ + + if (region_views.empty()) { + _pending_automation_state = state; + } else { + for (std::list<RegionView *>::iterator i = region_views.begin(); i != region_views.end(); ++i) { + boost::shared_ptr<AutomationLine> line = dynamic_cast<AutomationRegionView*>(*i)->line(); + if (line && line->the_list()) { + line->the_list()->set_automation_state (state); + } } } } @@ -196,10 +210,8 @@ AutomationStreamView::color_handler () AutoState AutomationStreamView::automation_state () const { - /* XXX: bit of a hack: just return the state of our first RegionView */ - if (region_views.empty()) { - return Off; + return _pending_automation_state; } boost::shared_ptr<AutomationLine> line = ((AutomationRegionView*) region_views.front())->line (); diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index a3235f7b0e..01d3435714 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -69,6 +69,8 @@ class AutomationStreamView : public StreamView boost::shared_ptr<AutomationController> _controller; AutomationTimeAxisView& _automation_view; + /** automation state that should be applied when this view gets its first RegionView */ + ARDOUR::AutoState _pending_automation_state; }; #endif /* __ardour_automation_streamview_h__ */ diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 9163b10dc1..841ec65fb9 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -270,6 +270,7 @@ AutomationTimeAxisView::set_automation_state (AutoState state) #endif } + cout << "_view = " << _view << "\n"; if (_view) { _view->set_automation_state (state); |