From eee83c25a9e1e182d0ce1d90f5469b0a836f082c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 2 Jun 2016 08:54:33 -0400 Subject: make all TimeAxisView derived types return PresentationInfo for sorting --- gtk2_ardour/automation_time_axis.cc | 6 ++++++ gtk2_ardour/automation_time_axis.h | 2 ++ gtk2_ardour/editor_drag.cc | 17 +---------------- gtk2_ardour/route_time_axis.cc | 6 ++++++ gtk2_ardour/route_time_axis.h | 9 +++++---- gtk2_ardour/time_axis_view.h | 4 ++++ gtk2_ardour/vca_time_axis.cc | 6 ++++++ gtk2_ardour/vca_time_axis.h | 2 ++ 8 files changed, 32 insertions(+), 20 deletions(-) diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc index 9b5d999164..263073fc3b 100644 --- a/gtk2_ardour/automation_time_axis.cc +++ b/gtk2_ardour/automation_time_axis.cc @@ -1038,3 +1038,9 @@ AutomationTimeAxisView::cut_copy_clear_one (AutomationLine& line, Selection& sel } } } + +PresentationInfo const & +AutomationTimeAxisView::presentation_info () const +{ + return _route->presentation_info(); +} diff --git a/gtk2_ardour/automation_time_axis.h b/gtk2_ardour/automation_time_axis.h index aef1300405..e1aa9e4931 100644 --- a/gtk2_ardour/automation_time_axis.h +++ b/gtk2_ardour/automation_time_axis.h @@ -73,6 +73,8 @@ class AutomationTimeAxisView : public TimeAxisView { void set_samples_per_pixel (double); std::string name() const { return _name; } + ARDOUR::PresentationInfo const & presentation_info () const; + void add_automation_event (GdkEvent *, framepos_t, double, bool with_guard_points); void clear_lines (); diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index c29fa230d4..02e36d2bce 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -527,22 +527,7 @@ Drag::add_midi_region (MidiTimeAxisView* view, bool commit) struct PresentationInfoTimeAxisViewSorter { bool operator() (TimeAxisView* a, TimeAxisView* b) { - RouteTimeAxisView* ra = dynamic_cast (a); - RouteTimeAxisView* rb = dynamic_cast (b); - /* anything not a route goes at the end */ - if (!ra && rb) { - return false; - } - if (!rb && ra) { - return true; - } - if (!ra && !rb) { - /* XXXX pointer comparison. Should use - presentation_info in a time axis view - */ - return a < b; - } - return ra->route()->presentation_info () < rb->route()->presentation_info(); + return a->presentation_info() < b->presentation_info(); } }; diff --git a/gtk2_ardour/route_time_axis.cc b/gtk2_ardour/route_time_axis.cc index 303824638e..75ea85391c 100644 --- a/gtk2_ardour/route_time_axis.cc +++ b/gtk2_ardour/route_time_axis.cc @@ -2924,3 +2924,9 @@ RouteTimeAxisView::remove_child (boost::shared_ptr c) } } } + +PresentationInfo const & +RouteTimeAxisView::presentation_info () const +{ + return _route->presentation_info(); +} diff --git a/gtk2_ardour/route_time_axis.h b/gtk2_ardour/route_time_axis.h index 5e123f2fa7..37720e6f3a 100644 --- a/gtk2_ardour/route_time_axis.h +++ b/gtk2_ardour/route_time_axis.h @@ -75,16 +75,18 @@ class ItemCounts; class RouteTimeAxisView : public RouteUI, public TimeAxisView { public: - RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas); - virtual ~RouteTimeAxisView (); + RouteTimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas); + virtual ~RouteTimeAxisView (); void set_route (boost::shared_ptr); + ARDOUR::PresentationInfo const & presentation_info () const; + void show_selection (TimeSelection&); void set_button_names (); void set_samples_per_pixel (double); - void set_height (uint32_t h, TrackHeightMode m = OnlySelf); + void set_height (uint32_t h, TrackHeightMode m = OnlySelf); void show_timestretch (framepos_t start, framepos_t end, int layers, int layer); void hide_timestretch (); void selection_click (GdkEventButton*); @@ -333,4 +335,3 @@ private: }; #endif /* __ardour_route_time_axis_h__ */ - diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 4995c0e15e..daef126406 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -39,7 +39,9 @@ #include "pbd/signals.h" #include "ardour/types.h" +#include "ardour/presentation_info.h" #include "ardour/region.h" + #include "evoral/Parameter.hpp" #include "canvas/line.h" @@ -102,6 +104,8 @@ class TimeAxisView : public virtual AxisView static void setup_sizes (); + virtual ARDOUR::PresentationInfo const & presentation_info () const = 0; + /** @return index of this TimeAxisView within its parent */ int order () const { return _order; } diff --git a/gtk2_ardour/vca_time_axis.cc b/gtk2_ardour/vca_time_axis.cc index fc593369ac..742cbd412e 100644 --- a/gtk2_ardour/vca_time_axis.cc +++ b/gtk2_ardour/vca_time_axis.cc @@ -274,3 +274,9 @@ VCATimeAxisView::drop_release (GdkEventButton*) return true; } + +PresentationInfo const & +VCATimeAxisView::presentation_info () const +{ + return _vca->presentation_info(); +} diff --git a/gtk2_ardour/vca_time_axis.h b/gtk2_ardour/vca_time_axis.h index 42dd73f5b3..9aa92a1006 100644 --- a/gtk2_ardour/vca_time_axis.h +++ b/gtk2_ardour/vca_time_axis.h @@ -39,6 +39,8 @@ class VCATimeAxisView : public TimeAxisView VCATimeAxisView (PublicEditor&, ARDOUR::Session*, ArdourCanvas::Canvas& canvas); virtual ~VCATimeAxisView (); + ARDOUR::PresentationInfo const & presentation_info () const; + void set_vca (boost::shared_ptr); boost::shared_ptr vca() const { return _vca; } -- cgit v1.2.3