Skip to content

Commit

Permalink
fix select-all-regions-within (it used to select everything overlapped)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenLoftis committed Jan 9, 2015
1 parent a6e45a4 commit 9e0cd98
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gtk2_ardour/automation_streamview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/automation_streamview.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/automation_time_axis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/automation_time_axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/) {}
Expand Down
4 changes: 2 additions & 2 deletions gtk2_ardour/editor_selection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down
6 changes: 3 additions & 3 deletions gtk2_ardour/route_time_axis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/route_time_axis.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class RouteTimeAxisView : public RouteUI, public TimeAxisView
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;
Expand Down
15 changes: 11 additions & 4 deletions gtk2_ardour/streamview.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}

}
}

Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/streamview.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class StreamView : public sigc::trackable, public PBD::ScopedConnectionList
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>) {}
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/time_axis_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion gtk2_ardour/time_axis_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down

0 comments on commit 9e0cd98

Please sign in to comment.