fix select-all-regions-within (it used to select everything overlapped)
authorBen Loftis <ben@harrisonconsoles.com>
Fri, 9 Jan 2015 18:20:02 +0000 (12:20 -0600)
committerBen Loftis <ben@harrisonconsoles.com>
Fri, 9 Jan 2015 18:21:10 +0000 (12:21 -0600)
gtk2_ardour/automation_streamview.cc
gtk2_ardour/automation_streamview.h
gtk2_ardour/automation_time_axis.cc
gtk2_ardour/automation_time_axis.h
gtk2_ardour/editor_selection.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/route_time_axis.h
gtk2_ardour/streamview.cc
gtk2_ardour/streamview.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view.h

index 9b68c55d2356164cc645eebaec9cc8d566edba77..7eaec7cae461709ba62694a9b0a7d39460bbab46 100644 (file)
@@ -284,7 +284,7 @@ AutomationStreamView::clear ()
  *  confusing.
  */
 void
-AutomationStreamView::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results)
+AutomationStreamView::get_selectables (framepos_t start, framepos_t end, double botfrac, double topfrac, list<Selectable*>& results, bool /*within*/)
 {
        for (list<RegionView*>::iterator i = region_views.begin(); i != region_views.end(); ++i) {
                AutomationRegionView* arv = dynamic_cast<AutomationRegionView*> (*i);
index 082e3cc379bafb250db2206b5d5b37ad1df82397..67f720dc5ff8792a73505ccd5be589622d9e9fbd 100644 (file)
@@ -60,7 +60,7 @@ class AutomationStreamView : public StreamView
 
        void clear ();
 
-       void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*> &);
+       void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*> &, bool within = false);
        void set_selected_points (PointSelection &);
 
        std::list<boost::shared_ptr<AutomationLine> > get_lines () const;
index ff50c7bece816974db39567fea27505514c872af..60552ce14eaafb4d3dbb5742ff4faf7d1a81b84d 100644 (file)
@@ -693,7 +693,7 @@ AutomationTimeAxisView::paste_one (framepos_t pos, unsigned paste_count, float t
 }
 
 void
-AutomationTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results)
+AutomationTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool /*within*/)
 {
        if (!_line && !_view) {
                return;
index b726de64405c98c6eb03b2015c0f648f06acd81c..53928724d85fbca16a881c3bf25de13159e2a521 100644 (file)
@@ -84,7 +84,7 @@ class AutomationTimeAxisView : public TimeAxisView {
        std::list<boost::shared_ptr<AutomationLine> > lines () const;
 
        void set_selected_points (PointSelection&);
-       void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
+       void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
        void get_inverted_selectables (Selection&, std::list<Selectable*>& results);
 
        void show_timestretch (framepos_t /*start*/, framepos_t /*end*/, int /*layers*/, int /*layer*/) {}
index 117459263cecb17851692310070301072e7a260c..60f8b0433b9a21c03eecb12156b712ed201965bb 100644 (file)
@@ -1791,7 +1791,7 @@ Editor::select_all_selectables_using_edit (bool after)
 }
 
 void
-Editor::select_all_selectables_between (bool /*within*/)
+Editor::select_all_selectables_between (bool within)
 {
        framepos_t start;
        framepos_t end;
@@ -1821,7 +1821,7 @@ Editor::select_all_selectables_between (bool /*within*/)
                if ((*iter)->hidden()) {
                        continue;
                }
-               (*iter)->get_selectables (start, end, 0, DBL_MAX, touched);
+               (*iter)->get_selectables (start, end, 0, DBL_MAX, touched, within);
        }
 
        begin_reversible_selection_op(_("Select all Selectables Between"));
index c54775d8451504a72a50308edc4c4bec9566cbe2..d2d48203084fa69806cad1815e9bcb465d22586b 100644 (file)
@@ -1342,7 +1342,7 @@ RouteTimeAxisView::set_selected_regionviews (RegionSelection& regions)
  * @param results List to add things to.
  */
 void
-RouteTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results)
+RouteTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool within)
 {
        double speed = 1.0;
 
@@ -1354,14 +1354,14 @@ RouteTimeAxisView::get_selectables (framepos_t start, framepos_t end, double top
        framepos_t const end_adjusted   = session_frame_to_track_frame(end, speed);
 
        if ((_view && ((top < 0.0 && bot < 0.0))) || touched (top, bot)) {
-               _view->get_selectables (start_adjusted, end_adjusted, top, bot, results);
+               _view->get_selectables (start_adjusted, end_adjusted, top, bot, results, within);
        }
 
        /* pick up visible automation tracks */
 
        for (Children::iterator i = children.begin(); i != children.end(); ++i) {
                if (!(*i)->hidden()) {
-                       (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results);
+                       (*i)->get_selectables (start_adjusted, end_adjusted, top, bot, results, within);
                }
        }
 }
index 7ea86e9b1b38e2eca97a36e36dcda11ab88b0eb6..3aedc4d336ed97b020c6b7bfef0e5a6b89805434 100644 (file)
@@ -90,7 +90,7 @@ public:
        void selection_click (GdkEventButton*);
        void set_selected_points (PointSelection&);
        void set_selected_regionviews (RegionSelection&);
-       void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&);
+       void get_selectables (ARDOUR::framepos_t start, ARDOUR::framepos_t end, double top, double bot, std::list<Selectable *>&, bool within = false);
        void get_inverted_selectables (Selection&, std::list<Selectable*>&);
        void set_layer_display (LayerDisplay d, bool apply_to_selection = false);
        LayerDisplay layer_display () const;
index de94c70060b58c9fb05be794e8d2d4796945b0aa..1d50a06a2ef6b4bf3d27a1f862e702cf7e958cc2 100644 (file)
@@ -548,7 +548,7 @@ StreamView::set_selected_regionviews (RegionSelection& regions)
  *  @param result Filled in with selectable things.
  */
 void
-StreamView::get_selectables (framepos_t start, framepos_t end, double top, double bottom, list<Selectable*>& results)
+StreamView::get_selectables (framepos_t start, framepos_t end, double top, double bottom, list<Selectable*>& results, bool within)
 {
        if (_trackview.editor().internal_editing()) {
                return;  // Don't select regions with an internal tool
@@ -584,10 +584,17 @@ StreamView::get_selectables (framepos_t start, framepos_t end, double top, doubl
                        layer_t const l = (*i)->region()->layer ();
                        layer_ok = (min_layer <= l && l <= max_layer);
                }
-
-               if ((*i)->region()->coverage (start, end) != Evoral::OverlapNone && layer_ok) {
-                       results.push_back (*i);
+               
+               if (within) {
+                       if ((*i)->region()->coverage (start, end) == Evoral::OverlapExternal && layer_ok) {
+                               results.push_back (*i);
+                       }
+               } else {
+                       if ((*i)->region()->coverage (start, end) != Evoral::OverlapNone && layer_ok) {
+                               results.push_back (*i);
+                       }
                }
+               
        }
 }
 
index 73b1f0a420b3563e2eca3397b4281b513732a549..0c3faf3b21a382710018fc9aacf1460225fcd404 100644 (file)
@@ -97,7 +97,7 @@ public:
        void         foreach_selected_regionview (sigc::slot<void,RegionView*> slot);
 
        void set_selected_regionviews (RegionSelection&);
-       void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&);
+       void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable* >&, bool within = false);
        void get_inverted_selectables (Selection&, std::list<Selectable* >& results);
 
        virtual void update_contents_metrics(boost::shared_ptr<ARDOUR::Region>) {}
index 648d2521ebf8cbd7d2aca417e908de1ed09cb188..3032d834bfda4bacbef7fc21b9e17831d623195d 100644 (file)
@@ -1088,7 +1088,7 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
  *  @param result Filled in with selectable things.
  */
 void
-TimeAxisView::get_selectables (framepos_t /*start*/, framepos_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/)
+TimeAxisView::get_selectables (framepos_t /*start*/, framepos_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/, bool /*within*/)
 {
        return;
 }
index 7935d4025db3d91470799df3bac0bdc12aab641c..6827251472b8fe9ee09f37a8b348b27eba10eb4b 100644 (file)
@@ -187,7 +187,7 @@ class TimeAxisView : public virtual AxisView
 
        void order_selection_trims (ArdourCanvas::Item *item, bool put_start_on_top);
 
-       virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&);
+       virtual void get_selectables (ARDOUR::framepos_t, ARDOUR::framepos_t, double, double, std::list<Selectable*>&, bool within = false);
        virtual void get_inverted_selectables (Selection&, std::list<Selectable *>& results);
 
        void add_ghost (RegionView*);