fix push-drags of automation data - previously we did not resync the model with the view for the points that were pushed (i.e. not selected, but moved anyway)
git-svn-id: svn://localhost/ardour2/branches/3.0@13681 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
37906d067e
commit
30237aad7f
|
@ -583,7 +583,7 @@ AutomationLine::start_drag_common (double x, float fraction)
|
|||
* @return x position and y fraction that were actually used (once clamped).
|
||||
*/
|
||||
pair<double, float>
|
||||
AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool with_push)
|
||||
AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool with_push, uint32_t& final_index)
|
||||
{
|
||||
if (_drag_points.empty()) {
|
||||
return pair<double,float> (x,fraction);
|
||||
|
@ -662,8 +662,9 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
|
|||
(*ccp)->move (dx, dy);
|
||||
}
|
||||
if (with_push) {
|
||||
uint32_t i = contiguous_points.back()->back()->view_index () + 1;
|
||||
final_index = contiguous_points.back()->back()->view_index () + 1;
|
||||
ControlPoint* p;
|
||||
uint32_t i = final_index;
|
||||
while ((p = nth (i)) != 0 && p->can_slide()) {
|
||||
p->move_to (p->get_x() + dx, p->get_y(), ControlPoint::Full);
|
||||
reset_line_coords (*p);
|
||||
|
@ -688,7 +689,7 @@ AutomationLine::drag_motion (double const x, float fraction, bool ignore_x, bool
|
|||
|
||||
/** Should be called to indicate the end of a drag */
|
||||
void
|
||||
AutomationLine::end_drag ()
|
||||
AutomationLine::end_drag (bool with_push, uint32_t final_index)
|
||||
{
|
||||
if (!_drag_had_movement) {
|
||||
return;
|
||||
|
@ -696,6 +697,16 @@ AutomationLine::end_drag ()
|
|||
|
||||
alist->freeze ();
|
||||
sync_model_with_view_points (_drag_points);
|
||||
|
||||
if (with_push) {
|
||||
ControlPoint* p;
|
||||
uint32_t i = final_index;
|
||||
while ((p = nth (i)) != 0 && p->can_slide()) {
|
||||
sync_model_with_view_point (*p);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
alist->thaw ();
|
||||
|
||||
update_pending = false;
|
||||
|
|
|
@ -83,8 +83,8 @@ class AutomationLine : public sigc::trackable, public PBD::StatefulDestructible
|
|||
virtual void start_drag_single (ControlPoint*, double, float);
|
||||
virtual void start_drag_line (uint32_t, uint32_t, float);
|
||||
virtual void start_drag_multiple (std::list<ControlPoint*>, float, XMLNode *);
|
||||
virtual std::pair<double, float> drag_motion (double, float, bool, bool with_push);
|
||||
virtual void end_drag ();
|
||||
virtual std::pair<double, float> drag_motion (double, float, bool, bool with_push, uint32_t& final_index);
|
||||
virtual void end_drag (bool with_push, uint32_t final_index);
|
||||
|
||||
ControlPoint* nth (uint32_t);
|
||||
ControlPoint const * nth (uint32_t) const;
|
||||
|
|
|
@ -2885,6 +2885,8 @@ ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
|
|||
|
||||
_editor->verbose_cursor()->show ();
|
||||
|
||||
_pushing = Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
|
||||
|
||||
if (!_point->can_slide ()) {
|
||||
_x_constrained = true;
|
||||
}
|
||||
|
@ -2938,9 +2940,8 @@ ControlPointDrag::motion (GdkEvent* event, bool)
|
|||
cx_frames = min (cx_frames, _point->line().maximum_time());
|
||||
|
||||
float const fraction = 1.0 - (cy / _point->line().height());
|
||||
bool const push = Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
|
||||
|
||||
_point->line().drag_motion (_editor->frame_to_unit_unrounded (cx_frames), fraction, false, push);
|
||||
_point->line().drag_motion (_editor->frame_to_unit_unrounded (cx_frames), fraction, false, _pushing, _final_index);
|
||||
|
||||
_editor->verbose_cursor()->set_text (_point->line().get_verbose_cursor_string (fraction));
|
||||
}
|
||||
|
@ -2960,7 +2961,7 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
|
|||
motion (event, false);
|
||||
}
|
||||
|
||||
_point->line().end_drag ();
|
||||
_point->line().end_drag (_pushing, _final_index);
|
||||
_editor->session()->commit_reversible_command ();
|
||||
}
|
||||
|
||||
|
@ -3051,10 +3052,10 @@ LineDrag::motion (GdkEvent* event, bool)
|
|||
cy = min ((double) _line->height(), cy);
|
||||
|
||||
double const fraction = 1.0 - (cy / _line->height());
|
||||
bool const push = !Keyboard::modifier_state_contains (event->button.state, Keyboard::PrimaryModifier);
|
||||
uint32_t ignored;
|
||||
|
||||
/* we are ignoring x position for this drag, so we can just pass in anything */
|
||||
_line->drag_motion (0, fraction, true, push);
|
||||
_line->drag_motion (0, fraction, true, false, ignored);
|
||||
|
||||
_editor->verbose_cursor()->set_text (_line->get_verbose_cursor_string (fraction));
|
||||
}
|
||||
|
@ -3063,7 +3064,7 @@ void
|
|||
LineDrag::finished (GdkEvent* event, bool)
|
||||
{
|
||||
motion (event, false);
|
||||
_line->end_drag ();
|
||||
_line->end_drag (false, 0);
|
||||
_editor->session()->commit_reversible_command ();
|
||||
}
|
||||
|
||||
|
@ -4376,7 +4377,8 @@ AutomationRangeDrag::motion (GdkEvent*, bool /*first_move*/)
|
|||
for (list<Line>::iterator l = _lines.begin(); l != _lines.end(); ++l) {
|
||||
float const f = y_fraction (l->line, _drags->current_pointer_y());
|
||||
/* we are ignoring x position for this drag, so we can just pass in anything */
|
||||
l->line->drag_motion (0, f, true, false);
|
||||
uint32_t ignored;
|
||||
l->line->drag_motion (0, f, true, false, ignored);
|
||||
show_verbose_cursor_text (l->line->get_verbose_cursor_relative_string (l->original_fraction, f));
|
||||
}
|
||||
}
|
||||
|
@ -4390,7 +4392,7 @@ AutomationRangeDrag::finished (GdkEvent* event, bool)
|
|||
|
||||
motion (event, false);
|
||||
for (list<Line>::iterator i = _lines.begin(); i != _lines.end(); ++i) {
|
||||
i->line->end_drag ();
|
||||
i->line->end_drag (false, 0);
|
||||
}
|
||||
|
||||
_editor->session()->commit_reversible_command ();
|
||||
|
|
|
@ -706,6 +706,8 @@ private:
|
|||
double _fixed_grab_y;
|
||||
double _cumulative_x_drag;
|
||||
double _cumulative_y_drag;
|
||||
bool _pushing;
|
||||
uint32_t _final_index;
|
||||
static double _zero_gain_fraction;
|
||||
};
|
||||
|
||||
|
|
|
@ -87,13 +87,13 @@ AudioRegionGainLine::remove_point (ControlPoint& cp)
|
|||
}
|
||||
|
||||
void
|
||||
AudioRegionGainLine::end_drag ()
|
||||
AudioRegionGainLine::end_drag (bool with_push, uint32_t final_index)
|
||||
{
|
||||
if (!rv.audio_region()->envelope_active()) {
|
||||
rv.audio_region()->set_envelope_active(true);
|
||||
trackview.session()->add_command(new MementoCommand<AudioRegion>(*(rv.audio_region().get()), 0, &rv.audio_region()->get_state()));
|
||||
}
|
||||
|
||||
AutomationLine::end_drag ();
|
||||
AutomationLine::end_drag (with_push, final_index);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class AudioRegionGainLine : public AutomationLine
|
|||
AudioRegionGainLine (const std::string & name, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr<ARDOUR::AutomationList>);
|
||||
|
||||
void start_drag_single (ControlPoint*, double, float);
|
||||
void end_drag ();
|
||||
void end_drag (bool with_push, uint32_t final_index);
|
||||
|
||||
void remove_point (ControlPoint&);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user