Remove internal edit mode and add "content" tool.
[ardour.git] / gtk2_ardour / editor_drag.cc
index ea36be25adb61daf0f9e997ec8f07210b54c892c..73a6e4dad66ba20dad63a361d69c96fc0f19ab73 100644 (file)
@@ -840,6 +840,12 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
 {
        if (_copy && first_move) {
 
+               if (_x_constrained) {
+                       _editor->begin_reversible_command (Operations::fixed_time_region_copy);
+               } else {
+                       _editor->begin_reversible_command (Operations::region_copy);
+               }
+
                /* duplicate the regionview(s) and region(s) */
 
                list<DraggingView> new_regionviews;
@@ -890,6 +896,14 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
 
                        swap_grab (new_regionviews.front().view->get_canvas_group (), 0, event ? event->motion.time : 0);
                }
+
+       } else if (!_copy && first_move) {
+
+               if (_x_constrained) {
+                       _editor->begin_reversible_command (_("fixed time region drag"));
+               } else {
+                       _editor->begin_reversible_command (Operations::region_drag);
+               }
        }
 
        RegionMotionDrag::motion (event, first_move);
@@ -1020,12 +1034,6 @@ RegionMoveDrag::finished_copy (bool const changed_position, bool const /*changed
                return;
        }
 
-       if (_x_constrained) {
-               _editor->begin_reversible_command (Operations::fixed_time_region_copy);
-       } else {
-               _editor->begin_reversible_command (Operations::region_copy);
-       }
-
        /* insert the regions into their new playlists */
        for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end();) {
 
@@ -1102,12 +1110,6 @@ RegionMoveDrag::finished_no_copy (
                return;
        }
 
-       if (_x_constrained) {
-               _editor->begin_reversible_command (_("fixed time region drag"));
-       } else {
-               _editor->begin_reversible_command (Operations::region_drag);
-       }
-
        for (list<DraggingView>::const_iterator i = _views.begin(); i != _views.end(); ) {
 
                RegionView* rv = i->view;
@@ -2592,7 +2594,7 @@ MeterMarkerDrag::motion (GdkEvent* event, bool first_move)
                _marker = new MeterMarker (
                        *_editor,
                        *_editor->meter_group,
-                       ARDOUR_UI::config()->get_MeterMarker(),
+                       ARDOUR_UI::config()->color ("meter marker"),
                        name,
                        *new MeterSection (_marker->meter())
                );
@@ -2723,7 +2725,7 @@ TempoMarkerDrag::motion (GdkEvent* event, bool first_move)
                _marker = new TempoMarker (
                        *_editor,
                        *_editor->tempo_group,
-                       ARDOUR_UI::config()->get_TempoMarker(),
+                       ARDOUR_UI::config()->color ("tempo marker"),
                        name,
                        *new TempoSection (_marker->tempo())
                        );
@@ -3632,7 +3634,7 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
        }
 
        _point->line().end_drag (_pushing, _final_index);
-       _editor->session()->commit_reversible_command ();
+       _editor->commit_reversible_command ();
 }
 
 void
@@ -3644,8 +3646,8 @@ ControlPointDrag::aborted (bool)
 bool
 ControlPointDrag::active (Editing::MouseMode m)
 {
-       if (m == Editing::MouseGain) {
-               /* always active in mouse gain */
+       if (m == Editing::MouseDraw) {
+               /* always active in mouse draw */
                return true;
        }
 
@@ -3746,7 +3748,7 @@ LineDrag::finished (GdkEvent* event, bool movement_occured)
                }
        }
 
-       _editor->session()->commit_reversible_command ();
+       _editor->commit_reversible_command ();
 }
 
 void
@@ -4453,8 +4455,8 @@ RangeMarkerBarDrag::RangeMarkerBarDrag (Editor* e, ArdourCanvas::Item* i, Operat
                                                                      physical_screen_height (_editor->get_window())));
        _drag_rect->hide ();
 
-       _drag_rect->set_fill_color (ARDOUR_UI::config()->get_RangeDragRect());
-       _drag_rect->set_outline_color (ARDOUR_UI::config()->get_RangeDragRect());
+       _drag_rect->set_fill_color (ARDOUR_UI::config()->color ("range drag rect"));
+       _drag_rect->set_outline_color (ARDOUR_UI::config()->color ("range drag rect"));
 }
 
 void
@@ -5043,7 +5045,7 @@ AutomationRangeDrag::finished (GdkEvent* event, bool)
                i->line->end_drag (false, 0);
        }
 
-       _editor->session()->commit_reversible_command ();
+       _editor->commit_reversible_command ();
 }
 
 void
@@ -5189,9 +5191,11 @@ EditorRubberbandSelectDrag::select_things (int button_state, framepos_t x1, fram
        }
        
        Selection::Operation op = ArdourKeyboard::selection_type (button_state);
-       
+
        _editor->begin_reversible_command (_("rubberband selection"));
+
        _editor->select_all_within (x1, x2 - 1, y1, y2, _editor->track_views, op, false);
+
        _editor->commit_reversible_command ();
 }
 
@@ -5211,7 +5215,7 @@ NoteCreateDrag::NoteCreateDrag (Editor* e, ArdourCanvas::Item* i, MidiRegionView
        , _region_view (rv)
        , _drag_rect (0)
 {
-       
+       _note[0] = _note[1] = 0;
 }
 
 NoteCreateDrag::~NoteCreateDrag ()
@@ -5249,6 +5253,7 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
        }
 
        _note[0] = adjusted_frame (pf, event) - _region_view->region()->position ();
+       _note[1] = _note[0];
 
        MidiStreamView* sv = _region_view->midi_stream_view ();
        double const x = _editor->sample_to_pixel (_note[0]);