fix select-all-regions-within (it used to select everything overlapped)

This commit is contained in:
Ben Loftis 2015-01-09 12:20:02 -06:00
parent a6e45a471a
commit 9e0cd98ad4
11 changed files with 24 additions and 17 deletions

View 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);

View 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;

View 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;

View 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*/) {}

View 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"));

View 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);
}
}
}

View 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;

View 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);
}
}
}
}

View 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>) {}

View 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;
}

View 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*);