13
0

Don't allow drag of automation range unless the mouse is inside the range.

Add a fade in/out on automation range drags.
Allow trim of selected range even when in linked object mode.


git-svn-id: svn://localhost/ardour2/branches/3.0@6433 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Carl Hetherington 2010-01-02 01:19:47 +00:00
parent 4d927a495c
commit 85d0894475
2 changed files with 45 additions and 18 deletions

View File

@ -2880,8 +2880,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (_editor->clicked_axisview) { if (_editor->clicked_axisview) {
_editor->clicked_axisview->order_selection_trims (_item, true); _editor->clicked_axisview->order_selection_trims (_item, true);
} }
Drag::start_grab (event, cursor); Drag::start_grab (event, _editor->trimmer_cursor);
cursor = _editor->trimmer_cursor;
start = _editor->selection->time[_editor->clicked_selection].start; start = _editor->selection->time[_editor->clicked_selection].start;
_pointer_frame_offset = grab_frame() - start; _pointer_frame_offset = grab_frame() - start;
break; break;
@ -2890,8 +2889,7 @@ SelectionDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
if (_editor->clicked_axisview) { if (_editor->clicked_axisview) {
_editor->clicked_axisview->order_selection_trims (_item, false); _editor->clicked_axisview->order_selection_trims (_item, false);
} }
Drag::start_grab (event, cursor); Drag::start_grab (event, _editor->trimmer_cursor);
cursor = _editor->trimmer_cursor;
end = _editor->selection->time[_editor->clicked_selection].end; end = _editor->selection->time[_editor->clicked_selection].end;
_pointer_frame_offset = grab_frame() - end; _pointer_frame_offset = grab_frame() - end;
break; break;
@ -3554,12 +3552,26 @@ AutomationRangeDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
boost::shared_ptr<AutomationList> the_list = _line->the_list (); boost::shared_ptr<AutomationList> the_list = _line->the_list ();
for (list<AudioRange>::const_iterator j = _ranges.begin(); j != _ranges.end(); ++j) { for (list<AudioRange>::const_iterator j = _ranges.begin(); j != _ranges.end(); ++j) {
/* fade into and out of the region that we're dragging;
64 samples length plucked out of thin air.
*/
nframes64_t const h = (j->start + j->end) / 2;
nframes64_t a = j->start + 64;
if (a > h) {
a = h;
}
nframes64_t b = j->end - 64;
if (b < h) {
b = h;
}
the_list->add (j->start, the_list->eval (j->start)); the_list->add (j->start, the_list->eval (j->start));
_line->add_always_in_view (j->start); _line->add_always_in_view (j->start);
the_list->add (j->start + 1, the_list->eval (j->start + 1)); the_list->add (a, the_list->eval (a));
_line->add_always_in_view (j->start + 1); _line->add_always_in_view (a);
the_list->add (j->end - 1, the_list->eval (j->end - 1)); the_list->add (b, the_list->eval (b));
_line->add_always_in_view (j->end - 1); _line->add_always_in_view (b);
the_list->add (j->end, the_list->eval (j->end)); the_list->add (j->end, the_list->eval (j->end));
_line->add_always_in_view (j->end); _line->add_always_in_view (j->end);
} }

View File

@ -612,6 +612,28 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
break; break;
} }
if (_join_object_range_state == JOIN_OBJECT_RANGE_OBJECT) {
/* special case: allow trim of range selections in joined object mode;
in theory eff should equal MouseRange in this case, but it doesn't
because entering the range selection canvas item results in entered_regionview
being set to 0, so update_join_object_range_location acts as if we aren't
over a region.
*/
switch (item_type) {
case StartSelectionTrimItem:
assert (_drag == 0);
_drag = new SelectionDrag (this, item, SelectionDrag::SelectionStartTrim);
_drag->start_grab (event);
break;
case EndSelectionTrimItem:
assert (_drag == 0);
_drag = new SelectionDrag (this, item, SelectionDrag::SelectionEndTrim);
_drag->start_grab (event);
break;
}
}
Editing::MouseMode eff = effective_mouse_mode (); Editing::MouseMode eff = effective_mouse_mode ();
switch (eff) { switch (eff) {
@ -770,15 +792,8 @@ Editor::button_press_handler_1 (ArdourCanvas::Item* item, GdkEvent* event, ItemT
case AutomationTrackItem: case AutomationTrackItem:
assert (_drag == 0); assert (_drag == 0);
/* rubberband drag to select automation points */
if (join_object_range_button.get_active()) {
/* smart "join" mode: drag automation */
_drag = new AutomationRangeDrag (this, item, selection->time);
} else {
/* otherwise: rubberband drag to select automation points */
_drag = new RubberbandSelectDrag (this, item); _drag = new RubberbandSelectDrag (this, item);
}
_drag->start_grab (event); _drag->start_grab (event);
break; break;