diff options
author | nick_m <mainsbridge@gmail.com> | 2017-01-27 00:41:17 +1100 |
---|---|---|
committer | nick_m <mainsbridge@gmail.com> | 2017-02-04 22:57:36 +1100 |
commit | 59daffea1d78cb55b35fe19c135cc4ab472bd01d (patch) | |
tree | 45e514f2e4f5a1935e360fd4fa3e2475ec217006 /gtk2_ardour/editor_canvas.cc | |
parent | a21a414615505269bf770ad2358482e698e841af (diff) |
rework snap
snap now fills in a struct (MusicFrame) which contins a snapped frame
along with a music divisor.
this gives useful information wrt magnetic snap which may or may not
have rounded to an exact musical position.
region position may now be set musically (using quarter notes for now).
this patch fixes several problems in the current code:
- dragging a list of music-locked regions now maintains correct
musical offsets within the list.
- splitting regions using magnetic snap works correctly (#7192)
- cut drag should now work correctly with magnetic snap.
- musical length of split midi regions is no longer frame based.
Diffstat (limited to 'gtk2_ardour/editor_canvas.cc')
-rw-r--r-- | gtk2_ardour/editor_canvas.cc | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index bc457453bc..f847a3f707 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -449,7 +449,6 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, { vector<string> paths; GdkEvent ev; - framepos_t frame; double cy; if (convert_drop_to_paths (paths, context, x, y, data, info, time) == 0) { @@ -461,9 +460,8 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, ev.button.x = x; ev.button.y = y; - frame = window_event_sample (&ev, 0, &cy); - - snap_to (frame); + MusicFrame when (window_event_sample (&ev, 0, &cy), 0); + snap_to (when); bool copy = ((context->get_actions() & (Gdk::ACTION_COPY | Gdk::ACTION_LINK | Gdk::ACTION_MOVE)) == Gdk::ACTION_COPY); #ifdef __APPLE__ @@ -471,9 +469,9 @@ Editor::drop_paths (const RefPtr<Gdk::DragContext>& context, the main event loop with GTK/Quartz. Since import/embed wants to push up a progress dialog, defer all this till we go idle. */ - Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, frame, cy, copy)); + Glib::signal_idle().connect (sigc::bind (sigc::mem_fun (*this, &Editor::idle_drop_paths), paths, when.frame, cy, copy)); #else - drop_paths_part_two (paths, frame, cy, copy); + drop_paths_part_two (paths, when.frame, cy, copy); #endif } |