summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_line.cc17
-rw-r--r--gtk2_ardour/automation_line.h4
-rw-r--r--gtk2_ardour/editor_drag.cc18
-rw-r--r--gtk2_ardour/editor_drag.h2
-rw-r--r--gtk2_ardour/region_gain_line.cc4
-rw-r--r--gtk2_ardour/region_gain_line.h2
6 files changed, 31 insertions, 16 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index b067757cb0..63b9740c00 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -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;
diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h
index 16a410a2fc..cafeeee2ac 100644
--- a/gtk2_ardour/automation_line.h
+++ b/gtk2_ardour/automation_line.h
@@ -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;
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index a8e9a78dc5..0c309d7234 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -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 ();
diff --git a/gtk2_ardour/editor_drag.h b/gtk2_ardour/editor_drag.h
index e78a9fa96a..e3e4b5e665 100644
--- a/gtk2_ardour/editor_drag.h
+++ b/gtk2_ardour/editor_drag.h
@@ -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;
};
diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc
index 39e1b7fda3..8dfbdeeff4 100644
--- a/gtk2_ardour/region_gain_line.cc
+++ b/gtk2_ardour/region_gain_line.cc
@@ -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);
}
diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h
index aca8b523a1..c0b843acd0 100644
--- a/gtk2_ardour/region_gain_line.h
+++ b/gtk2_ardour/region_gain_line.h
@@ -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&);