use dedicated counter for sidechain port numbering
[ardour.git] / gtk2_ardour / editor_mouse.cc
index 23961cef91f156c8019c8e840369e5197bf8c2dd..a1a7b793b6f5ce382010464adb1d248c3dd06b47 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "gtkmm2ext/bindings.h"
 #include "gtkmm2ext/utils.h"
-#include "gtkmm2ext/tearoff.h"
 
 #include "canvas/canvas.h"
 
@@ -333,12 +332,12 @@ Editor::update_time_selection_display ()
        switch (mouse_mode) {
        case MouseRange:
                selection->clear_objects ();
-               selection->ClearMidiNoteSelection ();  /* EMIT SIGNAL */
+               selection->clear_midi_notes ();
                break;
        case MouseObject:
                selection->clear_time ();
                selection->clear_tracks ();
-               selection->ClearMidiNoteSelection ();  /* EMIT SIGNAL */
+               selection->clear_midi_notes ();
                break;
        case MouseDraw:
                /* Clear regions, but not time or tracks, since that
@@ -458,7 +457,9 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
 
                        /* almost no selection action on modified button-2 or button-3 events */
 
-                       if ((item_type != RegionItem && event->button.button != 2) && !(item_type == ControlPointItem && event->button.button == 3)) {
+                       if ((item_type != RegionItem && event->button.button != 2)
+                           /* for selection of control points prior to delete (shift-right click) */
+                           && !(item_type == ControlPointItem && event->button.button == 3 && event->type == GDK_BUTTON_PRESS)) {
                                return;
                        }
                }
@@ -628,6 +629,20 @@ Editor::button_selection (ArdourCanvas::Item* item, GdkEvent* event, ItemType it
                }
                break;
 
+       case NoteItem:
+               if (press && event->button.button == 3) {
+                       NoteBase* cnote = reinterpret_cast<NoteBase*> (item->get_data ("notebase"));
+                       assert (cnote);
+                       if (cnote->region_view().selection_size() == 0 || !cnote->selected()) {
+                               selection->clear_points();
+                               cnote->region_view().unique_select (cnote);
+                               /* we won't get the release, so store the selection change now */
+                               begin_reversible_selection_op (X_("Button 3 Note Selection"));
+                               commit_reversible_selection_op ();
+                       }
+               }
+               break;
+
        default:
                break;
        }
@@ -2441,7 +2456,7 @@ Editor::escape ()
                selection->clear ();
        }
 
-       reset_focus ();
+       reset_focus (&contents());
 }
 
 /** Update _join_object_range_state which indicate whether we are over the top