amend be62d335ee
[ardour.git] / gtk2_ardour / editor_drag.cc
index dfab9f89906cf4ddc382813b4a944243ba98b56b..35e9d395c54bade152c75fa91c3e08dbabc76197 100644 (file)
@@ -629,7 +629,6 @@ RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView
        , _pdropzone (0)
        , _ddropzone (0)
 {
-       _last_position = MusicFrame (_primary->region()->position(), 0);
        DEBUG_TRACE (DEBUG::Drags, "New RegionMotionDrag\n");
 }
 
@@ -2427,14 +2426,16 @@ RegionCreateDrag::RegionCreateDrag (Editor* e, ArdourCanvas::Item* i, TimeAxisVi
 void
 RegionCreateDrag::motion (GdkEvent* event, bool first_move)
 {
+
        if (first_move) {
                _editor->begin_reversible_command (_("create region"));
                _region = add_midi_region (_view, false);
                _view->playlist()->freeze ();
        } else {
+
                if (_region) {
                        framepos_t const f = adjusted_current_frame (event);
-                       if (f < grab_frame()) {
+                       if (f <= grab_frame()) {
                                _region->set_initial_position (f);
                        }
 
@@ -2444,9 +2445,10 @@ RegionCreateDrag::motion (GdkEvent* event, bool first_move)
                           a bit confusing as if a region starts 1 frame after a snap point, one cannot
                           place snapped notes at the start of the region.
                        */
-
-                       framecnt_t const len = (framecnt_t) fabs ((double)(f - grab_frame () - 1));
-                       _region->set_length (len < 1 ? 1 : len, _editor->get_grid_music_divisions (event->button.state));
+                       if (f != grab_frame()) {
+                               framecnt_t const len = (framecnt_t) fabs ((double)(f - grab_frame () - 1));
+                               _region->set_length (len < 1 ? 1 : len, _editor->get_grid_music_divisions (event->button.state));
+                       }
                }
        }
 }
@@ -3002,11 +3004,14 @@ TrimDrag::motion (GdkEvent* event, bool first_move)
                                vector<boost::shared_ptr<Playlist> > all_playlists;
                                _editor->session()->playlists->get (all_playlists);
                                for (vector<boost::shared_ptr<Playlist> >::iterator x = all_playlists.begin(); x != all_playlists.end(); ++x) {
+
                                        if ((*x)->uses_source (rv->region()->source(0))) {
                                                insert_result = _editor->motion_frozen_playlists.insert (*x);
                                                if (insert_result.second) {
-                                                       pl->freeze();
+                                                       (*x)->clear_owned_changes ();
+                                                       (*x)->freeze();
                                                }
+
                                        }
                                }
                        }
@@ -3957,7 +3962,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
                }
 
 
-               if (AudioEngine::instance()->connected()) {
+               if (AudioEngine::instance()->running()) {
 
                        /* do this only if we're the engine is connected
                         * because otherwise this request will never be
@@ -3967,7 +3972,7 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
                         */
 
                        s->request_suspend_timecode_transmission ();
-                       while (AudioEngine::instance()->connected() && !s->timecode_transmission_suspended ()) {
+                       while (AudioEngine::instance()->running() && !s->timecode_transmission_suspended ()) {
                                /* twiddle our thumbs */
                        }
                }