From 81aef8b49138deea084942740de8dbfa2e30edc1 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 17 Feb 2011 16:18:15 +0000 Subject: Minor tidying-up. git-svn-id: svn://localhost/ardour2/branches/3.0@8882 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/automation_streamview.cc | 11 ++----- gtk2_ardour/automation_time_axis.cc | 61 ++++++++++++++++++++++-------------- gtk2_ardour/automation_time_axis.h | 11 +++++-- gtk2_ardour/midi_time_axis.cc | 22 +++++++------ 4 files changed, 62 insertions(+), 43 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/automation_streamview.cc b/gtk2_ardour/automation_streamview.cc index 883f0449b3..a543c9d68c 100644 --- a/gtk2_ardour/automation_streamview.cc +++ b/gtk2_ardour/automation_streamview.cc @@ -68,10 +68,7 @@ AutomationStreamView::~AutomationStreamView () RegionView* AutomationStreamView::add_region_view_internal (boost::shared_ptr region, bool wfd, bool /*recording*/) { - if ( ! region) { - cerr << "No region" << endl; - return NULL; - } + assert (region); if (wfd) { boost::shared_ptr mr = boost::dynamic_pointer_cast(region); @@ -105,7 +102,7 @@ AutomationStreamView::add_region_view_internal (boost::shared_ptr region (*i)->enable_display(wfd); display_region(arv); - return NULL; + return 0; } } @@ -166,10 +163,8 @@ AutomationStreamView::set_automation_state (AutoState state) void AutomationStreamView::redisplay_track () { - list::iterator i, tmp; - // Flag region views as invalid and disable drawing - for (i = region_views.begin(); i != region_views.end(); ++i) { + for (list::iterator i = region_views.begin(); i != region_views.end(); ++i) { (*i)->set_valid (false); (*i)->enable_display(false); } diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 2cdb6f7de9..35138e889b 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -59,20 +59,28 @@ const string AutomationTimeAxisView::state_node_name = "AutomationChild"; * For route child (e.g. plugin) automation, pass the child for \a. * For region automation (e.g. MIDI CC), pass null for \a. */ -AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptr r, - boost::shared_ptr a, boost::shared_ptr c, - PublicEditor& e, TimeAxisView& parent, bool show_regions, - ArdourCanvas::Canvas& canvas, const string & nom, const string & nomparent) - : AxisView (s), - TimeAxisView (s, e, &parent, canvas), - _route (r), - _control (c), - _automatable (a), - _controller(AutomationController::create(a, c->parameter(), c)), - _base_rect (0), - _view (show_regions ? new AutomationStreamView(*this) : NULL), - _name (nom), - auto_button (X_("")) /* force addition of a label */ +AutomationTimeAxisView::AutomationTimeAxisView ( + Session* s, + boost::shared_ptr r, + boost::shared_ptr a, + boost::shared_ptr c, + PublicEditor& e, + TimeAxisView& parent, + bool show_regions, + ArdourCanvas::Canvas& canvas, + const string & nom, + const string & nomparent + ) + : AxisView (s) + , TimeAxisView (s, e, &parent, canvas) + , _route (r) + , _control (c) + , _automatable (a) + , _controller (AutomationController::create (a, c->parameter(), c)) + , _base_rect (0) + , _view (show_regions ? new AutomationStreamView (*this) : 0) + , _name (nom) + , auto_button (X_("")) /* force addition of a label */ { if (!have_name_font) { name_font = get_font_for_style (X_("AutomationTrackName")); @@ -209,13 +217,17 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session* s, boost::shared_ptrattach (); - /* no regions, just a single line for the entire track (e.g. bus gain) */ } else { - boost::shared_ptr line(new AutomationLine ( - ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter()), - *this, - *_canvas_display, - _control->alist())); + /* no regions, just a single line for the entire track (e.g. bus gain) */ + + boost::shared_ptr line ( + new AutomationLine ( + ARDOUR::EventTypeMap::instance().to_symbol(_control->parameter()), + *this, + *_canvas_display, + _control->alist() + ) + ); line->set_line_color (ARDOUR_UI::config()->canvasvar_ProcessorAutomationLine.get()); line->queue_reset (); @@ -589,8 +601,9 @@ AutomationTimeAxisView::build_display_menu () void AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/, framepos_t when, double y) { - if (!_line) + if (!_line) { return; + } double x = 0; @@ -929,15 +942,17 @@ AutomationTimeAxisView::add_line (boost::shared_ptr line) void AutomationTimeAxisView::entered() { - if (_line) + if (_line) { _line->track_entered(); + } } void AutomationTimeAxisView::exited () { - if (_line) + if (_line) { _line->track_exited(); + } } void diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index 76e687da0d..885e95a864 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -58,6 +58,7 @@ class AutomationTimeAxisView : public TimeAxisView { boost::shared_ptr, boost::shared_ptr, boost::shared_ptr, + Evoral::Parameter, PublicEditor&, TimeAxisView& parent, bool show_regions, @@ -117,14 +118,18 @@ class AutomationTimeAxisView : public TimeAxisView { } protected: - boost::shared_ptr _route; ///< Parent route + /** parent route * + boost::shared_ptr _route; + /** control; 0 if we are editing region-based automation */ boost::shared_ptr _control; ///< Control - boost::shared_ptr _automatable; ///< Control owner, maybe = _route - + /** control owner; may be _route, or 0 if we are editing region-based automation */ + boost::shared_ptr _automatable; + /** controller owner; 0 if we are editing region-based automation */ boost::shared_ptr _controller; ArdourCanvas::SimpleRect* _base_rect; boost::shared_ptr _line; + /** AutomationStreamView if we are editing region-based automation (for MIDI), otherwise 0 */ AutomationStreamView* _view; diff --git a/gtk2_ardour/midi_time_axis.cc b/gtk2_ardour/midi_time_axis.cc index 3087f7be6b..84288db326 100644 --- a/gtk2_ardour/midi_time_axis.cc +++ b/gtk2_ardour/midi_time_axis.cc @@ -845,15 +845,19 @@ MidiTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool boost::shared_ptr c = _route->get_control (param); assert (c); - boost::shared_ptr track(new AutomationTimeAxisView (_session, - _route, - _route, - c, - _editor, - *this, - true, - parent_canvas, - _route->describe_parameter(param))); + boost::shared_ptr track ( + new AutomationTimeAxisView ( + _session, + _route, + _route, + c, + _editor, + *this, + true, + parent_canvas, + _route->describe_parameter(param) + ) + ); add_automation_child (param, track, show); } -- cgit v1.2.3