From 639750f815a856bd9a61355e0d8e331e0fe215b6 Mon Sep 17 00:00:00 2001 From: nick_m Date: Thu, 18 Jun 2015 03:48:39 +1000 Subject: Don't add history by clicking a control point, fix control point selection. - also make set_selected_control_point_from_click () return something useful. --- gtk2_ardour/editor_drag.cc | 16 +++++++++++----- gtk2_ardour/editor_drag.h | 1 + gtk2_ardour/editor_mouse.cc | 3 ++- gtk2_ardour/editor_selection.cc | 8 +++++++- 4 files changed, 21 insertions(+), 7 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index ab08f7f10b..9f52dea5b6 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -4035,6 +4035,7 @@ ControlPointDrag::ControlPointDrag (Editor* e, ArdourCanvas::Item* i) : Drag (e, i), _cumulative_x_drag (0), _cumulative_y_drag (0) + , _first_move (true) { if (_zero_gain_fraction < 0.0) { _zero_gain_fraction = gain_to_slider_position_with_max (dB_to_coefficient (0.0), Config->get_max_gain()); @@ -4061,9 +4062,6 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/) setup_snap_delta (pos); float const fraction = 1 - (_point->get_y() / _point->line().height()); - _editor->begin_reversible_command (_("automation event move")); - _point->line().start_drag_single (_point, _fixed_grab_x, fraction); - show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction)); _pushing = Keyboard::modifier_state_equals (event->button.state, ArdourKeyboard::push_points_modifier ()); @@ -4123,6 +4121,12 @@ ControlPointDrag::motion (GdkEvent* event, bool) float const fraction = 1.0 - (cy / _point->line().height()); + if (_first_move) { + _editor->begin_reversible_command (_("automation event move")); + _point->line().start_drag_single (_point, _fixed_grab_x, fraction); + _first_move = false; + } + _point->line().drag_motion (_editor->sample_to_pixel_unrounded (cx_frames), fraction, false, _pushing, _final_index); show_verbose_cursor_text (_point->line().get_verbose_cursor_string (fraction)); @@ -4142,8 +4146,10 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred) motion (event, false); } - _point->line().end_drag (_pushing, _final_index); - _editor->commit_reversible_command (); + if (!_first_move) { + _point->line().end_drag (_pushing, _final_index); + _editor->commit_reversible_command (); + } } void diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h index 6fcd92751a..40525de80b 100644 --- a/gtk2_ardour/editor_drag.h +++ b/gtk2_ardour/editor_drag.h @@ -834,6 +834,7 @@ private: double _fixed_grab_y; double _cumulative_x_drag; double _cumulative_y_drag; + bool _first_move; bool _pushing; uint32_t _final_index; static double _zero_gain_fraction; diff --git a/gtk2_ardour/editor_mouse.cc b/gtk2_ardour/editor_mouse.cc index 8c5e6711f9..07931a5479 100644 --- a/gtk2_ardour/editor_mouse.cc +++ b/gtk2_ardour/editor_mouse.cc @@ -512,7 +512,8 @@ Editor::button_selection (ArdourCanvas::Item* /*item*/, GdkEvent* event, ItemTyp break; case ControlPointItem: - set_selected_track_as_side_effect (op); + /* for object/track exclusivity, we don't call set_selected_track_as_side_effect (op); */ + if (eff_mouse_mode != MouseRange) { _mouse_changed_selection |= set_selected_control_point_from_click (press, op); } diff --git a/gtk2_ardour/editor_selection.cc b/gtk2_ardour/editor_selection.cc index b071ed6e1b..a04ea77f06 100644 --- a/gtk2_ardour/editor_selection.cc +++ b/gtk2_ardour/editor_selection.cc @@ -325,19 +325,23 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation if (!clicked_control_point) { return false; } + bool ret = false; switch (op) { case Selection::Set: if (press) { selection->set (clicked_control_point); + ret = true; } break; case Selection::Add: if (press) { selection->add (clicked_control_point); + ret = true; } break; case Selection::Toggle: + /* This is a bit of a hack; if we Primary-Click-Drag a control point (for push drag) we want the point we clicked on to be selected, otherwise we end up confusingly dragging an @@ -352,9 +356,11 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation */ selection->toggle (clicked_control_point); _control_point_toggled_on_press = true; + ret = true; } else if (!press && !_control_point_toggled_on_press) { /* This is the release, and the point wasn't toggled on the press, so do it now */ selection->toggle (clicked_control_point); + ret = true; } else { /* Reset our flag */ _control_point_toggled_on_press = false; @@ -365,7 +371,7 @@ Editor::set_selected_control_point_from_click (bool press, Selection::Operation break; } - return true; + return ret; } void -- cgit v1.2.3