if (collecting) {
- results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
+ AutomationSelectable* s = new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview);
+ PointSelection& ps = trackview.editor().get_selection().points;
+ if (find (ps.begin(), ps.end(), *s) != ps.end()) {
+ s->set_selected (true);
+ }
+
+ results.push_back (s);
collecting = false;
nstart = DBL_MAX;
nend = 0;
}
if (collecting) {
- results.push_back (new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview));
+ AutomationSelectable* s = new AutomationSelectable (nstart, nend, botfrac, topfrac, &trackview);
+
+ PointSelection& ps = trackview.editor().get_selection().points;
+ if (find (ps.begin(), ps.end(), *s) != ps.end()) {
+ s->set_selected (true);
+ }
+
+ results.push_back (s);
}
}
/* object rubberband select process */
- bool select_all_within (nframes64_t, nframes64_t, double, double, TrackViewList const &, Selection::Operation op);
+ bool select_all_within (nframes64_t, nframes64_t, double, double, TrackViewList const &, Selection::Operation, bool);
ArdourCanvas::SimpleRect *rubberband_rect;
_editor->begin_reversible_command (_("rubberband selection"));
if (grab_frame() < last_pointer_frame()) {
- committed = _editor->select_all_within (grab_frame(), last_pointer_frame() - 1, y1, y2, _editor->track_views, op);
+ committed = _editor->select_all_within (grab_frame(), last_pointer_frame() - 1, y1, y2, _editor->track_views, op, false);
} else {
- committed = _editor->select_all_within (last_pointer_frame(), grab_frame() - 1, y1, y2, _editor->track_views, op);
+ committed = _editor->select_all_within (last_pointer_frame(), grab_frame() - 1, y1, y2, _editor->track_views, op, false);
}
if (!committed) {
switch (_editor->mouse_mode) {
case MouseObject:
/* find the two markers on either side and then make the selection from it */
- _editor->select_all_within (start, end, 0.0f, FLT_MAX, _editor->track_views, Selection::Set);
+ _editor->select_all_within (start, end, 0.0f, FLT_MAX, _editor->track_views, Selection::Set, false);
break;
case MouseRange:
bool is_start;
if (((l = find_location_from_marker (marker, is_start)) != 0) && (l->end() > l->start())) {
- select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, track_views, Selection::Set);
+ select_all_within (l->start(), l->end() - 1, 0, DBL_MAX, track_views, Selection::Set, false);
}
}
return true;
}
- button_selection (item, event, item_type);
-
if (!_drags->active () &&
(Keyboard::is_delete_event (&event->button) ||
Keyboard::is_context_menu_event (&event->button) ||
return true;
}
- /* first, see if we're finishing a drag ... */
+ /* see if we're finishing a drag */
bool were_dragging = false;
if (_drags->active ()) {
return false;
}
- if (clicked_control_point->selected()) {
- /* the clicked control point is already selected; others may be as well, so
- don't change the selection.
- */
- return true;
- }
-
/* We know the ControlPoint that was clicked, but (as discussed in automation_selectable.h)
* selected automation data are described by areas on the AutomationLine. A ControlPoint
* represents any model points in the space that it takes up, so the AutomationSelectable
_trackview_group->w2i (dummy, y2);
/* and set up the selection */
- return select_all_within (x1, x2, y1, y2, selection->tracks, op);
+ return select_all_within (x1, x2, y1, y2, selection->tracks, op, true);
}
void
* @param end End time in session frames.
* @param top Top (lower) y limit in trackview coordinates (ie 0 at the top of the track view)
* @param bottom Bottom (higher) y limit in trackview coordinates (ie 0 at the top of the track view)
+ * @param preserve_if_selected true to leave the current selection alone if all of the selectables within the region are already selected.
*/
bool
-Editor::select_all_within (framepos_t start, framepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op)
+Editor::select_all_within (
+ framepos_t start, framepos_t end, double top, double bot, const TrackViewList& tracklist, Selection::Operation op, bool preserve_if_selected
+ )
{
list<Selectable*> found;
return false;
}
+ if (preserve_if_selected) {
+ list<Selectable*>::iterator i = found.begin();
+ while (i != found.end() && (*i)->get_selected()) {
+ ++i;
+ }
+
+ if (i == found.end()) {
+ return false;
+ }
+ }
+
begin_reversible_command (_("select all within"));
switch (op) {
case Selection::Add: