summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 2489114982..697122b101 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -4576,15 +4576,60 @@ CrossfadeEdgeDrag::start_grab (GdkEvent* event, Gdk::Cursor *cursor)
void
CrossfadeEdgeDrag::motion (GdkEvent*, bool)
{
+ double distance = _drags->current_pointer_x() - grab_x();
+ double new_length;
+ framecnt_t len;
+
+ boost::shared_ptr<AudioRegion> ar (arv->audio_region());
+
+ if (start) {
+ len = ar->fade_in()->back()->when;
+ } else {
+ len = ar->fade_out()->back()->when;
+ }
+
+ new_length = len + _editor->unit_to_frame (distance);
+
+ if (start) {
+ arv->redraw_start_xfade_to (ar, new_length);
+ } else {
+ arv->redraw_end_xfade_to (ar, new_length);
+ }
+
+ // _editor->update_canvas_now ();
}
void
CrossfadeEdgeDrag::finished (GdkEvent*, bool)
{
+ double distance = _drags->current_pointer_x() - grab_x();
+ double new_length;
+ framecnt_t len;
+
+ boost::shared_ptr<AudioRegion> ar (arv->audio_region());
+
+ if (start) {
+ len = ar->fade_in()->back()->when;
+ } else {
+ len = ar->fade_out()->back()->when;
+ }
+
+ new_length = len + _editor->unit_to_frame (distance);
+
+ if (start) {
+ ar->set_fade_in_length (new_length);
+ } else {
+ ar->set_fade_out_length (new_length);
+ }
}
void
CrossfadeEdgeDrag::aborted (bool)
{
+ if (start) {
+ arv->redraw_start_xfade ();
+ } else {
+ arv->redraw_end_xfade ();
+ }
}