mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
Don't add history by clicking a control point, fix control point selection.
- also make set_selected_control_point_from_click () return something useful.
This commit is contained in:
parent
80090f0f71
commit
639750f815
4 changed files with 21 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue