Improve ctrl-click behaviour of automation points. Should fix #3385.

git-svn-id: svn://localhost/ardour2/branches/3.0@7584 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-08-10 01:52:49 +00:00
parent 75d265e388
commit 48063c15df
6 changed files with 37 additions and 19 deletions

View File

@ -990,7 +990,13 @@ AutomationLine::get_selectables (
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;
@ -1000,7 +1006,14 @@ AutomationLine::get_selectables (
}
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);
}
}

View File

@ -1657,7 +1657,7 @@ public:
/* 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;

View File

@ -3107,9 +3107,9 @@ RubberbandSelectDrag::finished (GdkEvent* event, bool movement_occurred)
_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) {
@ -3662,7 +3662,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
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:

View File

@ -764,7 +764,7 @@ Editor::marker_menu_select_all_selectables_using_range ()
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);
}
}

View File

@ -1070,8 +1070,6 @@ Editor::button_press_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemTyp
return true;
}
button_selection (item, event, item_type);
if (!_drags->active () &&
(Keyboard::is_delete_event (&event->button) ||
Keyboard::is_context_menu_event (&event->button) ||
@ -1113,7 +1111,7 @@ Editor::button_release_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemT
return true;
}
/* first, see if we're finishing a drag ... */
/* see if we're finishing a drag */
bool were_dragging = false;
if (_drags->active ()) {

View File

@ -241,13 +241,6 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
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
@ -270,7 +263,7 @@ Editor::set_selected_control_point_from_click (Selection::Operation op, bool /*n
_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
@ -983,9 +976,12 @@ Editor::invert_selection ()
* @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;
@ -1002,6 +998,17 @@ Editor::select_all_within (framepos_t start, framepos_t end, double top, double
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: