From a57b9cdd99b47fde8bfa265c0f72a380bb5cbb6f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 25 May 2010 15:51:32 +0000 Subject: Allow region-based automation axes to report whether they have automation data or not. Should fix #3177. git-svn-id: svn://localhost/ardour2/branches/3.0@7158 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_streamview.cc | 17 +++++++++++++++++ gtk2_ardour/automation_streamview.h | 2 ++ gtk2_ardour/automation_time_axis.cc | 7 +++++++ gtk2_ardour/automation_time_axis.h | 2 ++ gtk2_ardour/route_time_axis.cc | 2 +- 5 files changed, 29 insertions(+), 1 deletion(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 9471d7c406..3eeb3bd6eb 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -209,3 +209,20 @@ AutomationStreamView::automation_state () const return line->the_list()->automation_state (); } + +bool +AutomationStreamView::has_automation () const +{ + list::const_iterator i = region_views.begin (); + while (i != region_views.end()) { + AutomationRegionView* rv = static_cast (*i); + if (rv->line() && rv->line()->npoints() > 0) { + return true; + } + ++i; + } + + return false; +} + + diff --git a/gtk2_ardour/automation_streamview.h b/gtk2_ardour/automation_streamview.h index 9a40629438..f5463ca400 100644 --- a/gtk2_ardour/automation_streamview.h +++ b/gtk2_ardour/automation_streamview.h @@ -54,6 +54,8 @@ class AutomationStreamView : public StreamView return (_trackview.current_height() - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); } + bool has_automation () const; + private: void setup_rec_box (); diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 35af325357..b36ba59e0c 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -941,3 +941,10 @@ AutomationTimeAxisView::set_visibility (bool yn) return changed; } + +/** @return true if this view has any automation data to display */ +bool +AutomationTimeAxisView::has_automation () const +{ + return ( (_line && _line->npoints() > 0) || (_view && _view->has_automation()) ); +} diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 195511d333..9d4802f6fc 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -105,6 +105,8 @@ class AutomationTimeAxisView : public TimeAxisView { return _base_rect; } + bool has_automation () const; + protected: boost::shared_ptr _route; ///< Parent route boost::shared_ptr _control; ///< Control diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 873eb171d2..9093abca1b 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -1676,7 +1676,7 @@ RouteTimeAxisView::show_existing_automation () /* Show our automation */ for (AutomationTracks::iterator i = _automation_tracks.begin(); i != _automation_tracks.end(); ++i) { - if (i->second->line() && i->second->line()->npoints() > 0) { + if (i->second->has_automation()) { i->second->set_marked_for_display (true); i->second->canvas_display()->show(); i->second->get_state_node()->add_property ("shown", X_("yes")); -- cgit v1.2.3