sfdb paths are saved and restored.
[ardour.git] / gtk2_ardour / editor_mouse.cc
index c140213bb29732d4e4a971ded8e13ad83a6ac222..8b6729cc4a3bf43ac39534920478214bbeb8105f 100644 (file)
@@ -61,6 +61,7 @@
 
 using namespace std;
 using namespace ARDOUR;
+using namespace PBD;
 using namespace sigc;
 using namespace Gtk;
 using namespace Editing;
@@ -2028,7 +2029,7 @@ Editor::start_marker_grab (ArdourCanvas::Item* item, GdkEvent* event)
 
        drag_info.copied_location = new Location (*location);
        drag_info.pointer_frame_offset = drag_info.grab_frame - (is_start ? location->start() : location->end());       
-       
+
        update_marker_drag_item (location);
 
        if (location->is_mark()) {
@@ -2087,31 +2088,39 @@ Editor::marker_drag_motion_callback (ArdourCanvas::Item* item, GdkEvent* event)
                move_both = true;
        }
 
-       if (is_start) { // start marker
+       if (copy_location->is_mark()) {
+               /* just move it */
 
-               if (move_both) {
-                       copy_location->set_start (newframe);
-                       copy_location->set_end (newframe + f_delta);
-               } else  if (newframe < copy_location->end()) {
-                       copy_location->set_start (newframe);
-               } else { 
-                       snap_to (next, 1, true);
-                       copy_location->set_end (next);
-                       copy_location->set_start (newframe);
-               }
+               copy_location->set_start (newframe);
 
-       } else { // end marker
+       } else {
 
-               if (move_both) {
-                       copy_location->set_end (newframe);
-                       copy_location->set_start (newframe - f_delta);
-               } else if (newframe > copy_location->start()) {
-                       copy_location->set_end (newframe);
+               if (is_start) { // start-of-range marker
+                       
+                       if (move_both) {
+                               copy_location->set_start (newframe);
+                               copy_location->set_end (newframe + f_delta);
+                       } else  if (newframe < copy_location->end()) {
+                               copy_location->set_start (newframe);
+                       } else { 
+                               snap_to (next, 1, true);
+                               copy_location->set_end (next);
+                               copy_location->set_start (newframe);
+                       }
                        
-               } else if (newframe > 0) {
-                       snap_to (next, -1, true);
-                       copy_location->set_start (next);
-                       copy_location->set_end (newframe);
+               } else { // end marker
+                       
+                       if (move_both) {
+                               copy_location->set_end (newframe);
+                               copy_location->set_start (newframe - f_delta);
+                       } else if (newframe > copy_location->start()) {
+                               copy_location->set_end (newframe);
+                               
+                       } else if (newframe > 0) {
+                               snap_to (next, -1, true);
+                               copy_location->set_start (next);
+                               copy_location->set_end (newframe);
+                       }
                }
        }
 
@@ -2144,7 +2153,11 @@ Editor::marker_drag_finished_callback (ArdourCanvas::Item* item, GdkEvent* event
        Location * location = find_location_from_marker (marker, is_start);
        
        if (location) {
-               location->set (drag_info.copied_location->start(), drag_info.copied_location->end());
+               if (location->is_mark()) {
+                       location->set_start (drag_info.copied_location->start());
+               } else {
+                       location->set (drag_info.copied_location->start(), drag_info.copied_location->end());
+               }
        }
 
        session->add_redo_no_execute( session->locations()->get_memento() );