more MIDI paste improvements, plus move region-mute binding to PRIMARY-m and use...
[ardour.git] / gtk2_ardour / editor_drag.cc
index 982f003c88f05c12b116a18ba74cb9130d4c5e62..1f7447ca0ed00166b0e2def9edf1f456f3ab9774 100644 (file)
@@ -145,8 +145,6 @@ Drag::end_grab (GdkEvent* event)
 
        _editor->hide_verbose_canvas_cursor();
 
-       update_selection ();
-       
        _ending = false;
 
        return _had_movement;
@@ -253,14 +251,6 @@ RegionDrag::region_going_away (RegionView* v)
        _views.remove (v);
 }
 
-void
-RegionDrag::update_selection ()
-{
-       list<Selectable*> s;
-       copy (_views.begin(), _views.end(), back_inserter (s));
-       _editor->selection->set (s);
-}
-
 RegionMotionDrag::RegionMotionDrag (Editor* e, ArdourCanvas::Item* i, RegionView* p, list<RegionView*> const & v, bool b)
        : RegionDrag (e, i, p, v),
          _dest_trackview (0),
@@ -730,7 +720,7 @@ RegionMoveDrag::motion (GdkEvent* event, bool first_move)
 }
 
 void
-RegionMoveDrag::finished (GdkEvent* event, bool movement_occurred)
+RegionMoveDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 {
        bool nocommit = true;
        vector<RegionView*> copies;
@@ -1253,7 +1243,7 @@ RegionMotionDrag::find_time_axis_views ()
 
 
 void
-RegionInsertDrag::finished (GdkEvent* event, bool movement_occurred)
+RegionInsertDrag::finished (GdkEvent* /*event*/, bool /*movement_occurred*/)
 {
        _editor->update_canvas_now ();
 
@@ -1290,7 +1280,7 @@ struct RegionSelectionByPosition {
 };
 
 void
-RegionSpliceDrag::motion (GdkEvent* event, bool)
+RegionSpliceDrag::motion (GdkEvent* /*event*/, bool)
 {
        RouteTimeAxisView* tv;
        layer_t layer;
@@ -1348,7 +1338,7 @@ RegionSpliceDrag::motion (GdkEvent* event, bool)
 }
 
 void
-RegionSpliceDrag::finished (GdkEvent* event, bool)
+RegionSpliceDrag::finished (GdkEvent* /*event*/, bool)
 {
        
 }
@@ -1371,7 +1361,7 @@ RegionCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
 
 
 void
-RegionCreateDrag::motion (GdkEvent* event, bool first_move)
+RegionCreateDrag::motion (GdkEvent* /*event*/, bool first_move)
 {
        if (first_move) {
                // TODO: create region-create-drag region view here
@@ -1425,7 +1415,7 @@ RegionCreateDrag::finished (GdkEvent* event, bool movement_occurred)
 
 
 void
-RegionGainDrag::motion (GdkEvent* event, bool)
+RegionGainDrag::motion (GdkEvent* /*event*/, bool)
 {
        
 }
@@ -2444,7 +2434,7 @@ ControlPointDrag::ControlPointDrag (Editor* e, ArdourCanvas::Item* i)
 
 
 void
-ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+ControlPointDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
 {
        Drag::start_grab (event, _editor->fader_cursor);
 
@@ -2542,6 +2532,18 @@ ControlPointDrag::finished (GdkEvent* event, bool movement_occurred)
        _point->line().end_drag (_point);
 }
 
+bool
+ControlPointDrag::active (Editing::MouseMode m)
+{
+       if (m == Editing::MouseGain) {
+               /* always active in mouse gain */
+               return true;
+       }
+
+       /* otherwise active if the point is on an automation line (ie not if its on a region gain line) */
+       return dynamic_cast<AutomationLine*> (&(_point->line())) != 0;
+}
+
 LineDrag::LineDrag (Editor* e, ArdourCanvas::Item* i)
        : Drag (e, i),
          _line (0),
@@ -2550,7 +2552,7 @@ LineDrag::LineDrag (Editor* e, ArdourCanvas::Item* i)
 
 }
 void
-LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
+LineDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*cursor*/)
 {
        _line = reinterpret_cast<AutomationLine*> (_item->get_data ("line"));
        assert (_line);
@@ -2769,7 +2771,7 @@ TimeFXDrag::motion (GdkEvent* event, bool)
 }
 
 void
-TimeFXDrag::finished (GdkEvent* event, bool movement_occurred)
+TimeFXDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 {
        _primary->get_time_axis_view().hide_timestretch ();
 
@@ -2812,13 +2814,13 @@ ScrubDrag::start_grab (GdkEvent* event, Gdk::Cursor *)
 }
 
 void
-ScrubDrag::motion (GdkEvent* event, bool)
+ScrubDrag::motion (GdkEvent* /*event*/, bool)
 {
        _editor->scrub ();
 }
 
 void
-ScrubDrag::finished (GdkEvent* event, bool movement_occurred)
+ScrubDrag::finished (GdkEvent* /*event*/, bool movement_occurred)
 {
        if (movement_occurred && _editor->session) {
                /* make sure we stop */
@@ -3179,6 +3181,7 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
        
        if (movement_occurred) {
                motion (event, false);
+               _drag_rect->hide();
 
                switch (_operation) {
                case CreateRangeMarker:
@@ -3200,15 +3203,12 @@ RangeMarkerBarDrag::finished (GdkEvent* event, bool movement_occurred)
                        XMLNode &after = _editor->session->locations()->get_state();
                        _editor->session->add_command(new MementoCommand<Locations>(*(_editor->session->locations()), &before, &after));
                        _editor->commit_reversible_command ();
-                       
-                       _drag_rect->hide();
                        break;
                    }
 
                case CreateTransportMarker:
                        // popup menu to pick loop or punch
                        _editor->new_transport_marker_context_menu (&event->button, _item);
-                       
                        break;
                }
        } else {