Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_type)
{
bool commit = false;
- bool c1;
- bool c2;
/* in object/audition/timefx mode, any button press sets
the selection if the object can be selected. this is a
if (((mouse_mode != MouseObject) &&
(mouse_mode != MouseAudition || item_type != RegionItem) &&
- (mouse_mode != MouseTimeFX || item_type != RegionItem)) ||
+ (mouse_mode != MouseTimeFX || item_type != RegionItem) &&
+ (mouse_mode != MouseRange)) ||
+
(event->type != GDK_BUTTON_PRESS && event->type != GDK_BUTTON_RELEASE || event->button.button > 3)) {
return;
}
+
+ if (event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) {
+
+ if ((event->button.state & Keyboard::RelevantModifierKeyMask) && event->button.button != 1) {
+
+ /* no selection action on modified button-2 or button-3 events */
+
+ return;
+ }
+ }
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool press = (event->type == GDK_BUTTON_PRESS);
switch (item_type) {
case RegionItem:
- /* XXX make tying track/region selection optional */
- c1 = set_selected_track_from_click (op, true);
- c2 = set_selected_regionview_from_click (press, op, true);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ }
break;
case RegionViewNameHighlight:
case RegionViewName:
- /* XXX make tying track/region selection optional */
- c1 = set_selected_track_from_click (op, true);
- c2 = set_selected_regionview_from_click (press, op, true);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ }
break;
case FadeInHandleItem:
case FadeInItem:
case FadeOutHandleItem:
case FadeOutItem:
- /* XXX make tying track/region selection optional */
- c1 = set_selected_track_from_click (op, true);
- c2 = set_selected_regionview_from_click (press, op, true);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_regionview_from_click (press, op, true);
+ }
+ break;
case GainAutomationControlPointItem:
case PanAutomationControlPointItem:
case RedirectAutomationControlPointItem:
- /* XXX make tying track/region selection optional */
- c1 = set_selected_track_from_click (op, true);
- c2 = set_selected_control_point_from_click (op, false);
- commit = (c1 || c2);
+ if (mouse_mode != MouseRange) {
+ commit = set_selected_control_point_from_click (op, false);
+ }
break;
case StreamItem:
- commit = set_selected_track_from_click (op, true);
+ /* for context click or range selection, select track */
+ if (event->button.button == 3) {
+ commit = set_selected_track_from_click (press, op, true);
+ } else if (event->type == GDK_BUTTON_PRESS && mouse_mode == MouseRange) {
+ commit = set_selected_track_from_click (press, op, false);
+ }
break;
case AutomationTrackItem:
- commit = set_selected_track_from_click (op, true);
+ commit = set_selected_track_from_click (press, op, true);
break;
default:
break;
}
-#define SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
-#ifdef SELECT_TRACK_FROM_CANVAS_IN_RANGE_MODE
- /* in range mode, button 1/2/3 press potentially selects a track */
-
- if (mouse_mode == MouseRange &&
- event->type == GDK_BUTTON_PRESS &&
- event->button.button <= 3) {
-
- switch (item_type) {
- case StreamItem:
- case RegionItem:
- case AutomationTrackItem:
- commit = set_selected_track_from_click (op, true);
- break;
-
- default:
- break;
- }
- }
-#endif
if (commit) {
commit_reversible_command ();
}
break;
case MouseObject:
- if (Keyboard::modifier_state_contains (event->button.state,
- Keyboard::ModifierMask(Keyboard::Control|Keyboard::Alt))
- && event->type == GDK_BUTTON_PRESS) {
-
+ if (Keyboard::modifier_state_contains (event->button.state, Keyboard::ModifierMask(Keyboard::Control|Keyboard::Alt)) &&
+ event->type == GDK_BUTTON_PRESS) {
+
start_rubberband_select (item, event);
} else if (event->type == GDK_BUTTON_PRESS) {
return;
}
-// if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
-// snap_to (drag_info.current_pointer_frame);
-
-// if (drag_info.first_move) {
-// snap_to (drag_info.grab_frame);
-// }
-// }
-
+ if (!Keyboard::modifier_state_contains (event->button.state, Keyboard::snap_modifier())) {
+ if (drag_info.first_move) {
+ snap_to (drag_info.grab_frame);
+ }
+ snap_to (drag_info.current_pointer_frame);
+ }
/* base start and end on initial click position */
+
if (drag_info.current_pointer_frame < drag_info.grab_frame) {
start = drag_info.current_pointer_frame;
end = drag_info.grab_frame;
if (drag_info.current_pointer_y < drag_info.grab_y) {
y1 = drag_info.current_pointer_y;
y2 = drag_info.grab_y;
- }
- else {
+ } else {
y2 = drag_info.current_pointer_y;
y1 = drag_info.grab_y;
}
Selection::Operation op = Keyboard::selection_type (event->button.state);
bool commit;
- begin_reversible_command (_("select regions"));
+ begin_reversible_command (_("rubberband selection"));
if (drag_info.grab_frame < drag_info.last_pointer_frame) {
commit = select_all_within (drag_info.grab_frame, drag_info.last_pointer_frame, y1, y2, op);
}
} else {
+ selection->clear_tracks();
selection->clear_regions();
selection->clear_points ();
selection->clear_lines ();