Clarify context menu for midi notes.
authornick_m <mainsbridge@gmail.com>
Sat, 31 Oct 2015 18:22:55 +0000 (05:22 +1100)
committernick_m <mainsbridge@gmail.com>
Sat, 31 Oct 2015 18:22:55 +0000 (05:22 +1100)
- right click on a note selects it if unselected or selection empty.

- note_context_menu is shown as described in #6348

gtk2_ardour/editor.cc
gtk2_ardour/editor_mouse.cc

index 4a559167e85a0e0986c9b8c18569e667e70e80b4..5601fd4987f0be7358dfbb44caaf1893c1f90c40 100644 (file)
@@ -5954,22 +5954,38 @@ Editor::popup_note_context_menu (ArdourCanvas::Item* item, GdkEvent* event)
 
        MidiRegionView&       mrv = note->region_view();
        const RegionSelection rs  = get_regions_from_selection_and_entered ();
+       const uint32_t sel_size = mrv.selection_size ();
 
        MenuList& items = _note_context_menu.items();
        items.clear();
 
-       items.push_back(MenuElem(_("Delete"),
-                                sigc::mem_fun(mrv, &MidiRegionView::delete_selection)));
-       items.push_back(MenuElem(_("Edit..."),
-                                sigc::bind(sigc::mem_fun(*this, &Editor::edit_notes), &mrv)));
+       if (sel_size > 0) {
+               items.push_back(MenuElem(_("Delete"),
+                                        sigc::mem_fun(mrv, &MidiRegionView::delete_selection)));
+       }
+
+       if (sel_size == 1) {
+               items.push_back(MenuElem(_("Edit..."),
+                                        sigc::bind(sigc::mem_fun(*this, &Editor::edit_notes), &mrv)));
+       }
+
        items.push_back(MenuElem(_("Transpose..."),
                                 sigc::bind(sigc::mem_fun(*this, &Editor::transpose_regions), rs)));
-       items.push_back(MenuElem(_("Legatize"),
-                                sigc::bind(sigc::mem_fun(*this, &Editor::legatize_regions), rs, false)));
+
+       if (sel_size > 1) {
+               items.push_back(MenuElem(_("Legatize"),
+                                        sigc::bind(sigc::mem_fun(*this, &Editor::legatize_regions), rs, false)));
+       }
+
        items.push_back(MenuElem(_("Quantize..."),
                                 sigc::bind(sigc::mem_fun(*this, &Editor::quantize_regions), rs)));
-       items.push_back(MenuElem(_("Remove Overlap"),
-                                sigc::bind(sigc::mem_fun(*this, &Editor::legatize_regions), rs, true)));
+
+       if (sel_size > 1) {
+               items.push_back(MenuElem(_("Remove Overlap"),
+                                        sigc::bind(sigc::mem_fun(*this, &Editor::legatize_regions), rs, true)));
+
+       }
+
        items.push_back(MenuElem(_("Transform..."),
                                 sigc::bind(sigc::mem_fun(*this, &Editor::transform_regions), rs)));
 
index 23961cef91f156c8019c8e840369e5197bf8c2dd..7740cb9b17c67bc4083849a651cc9eb691015fef 100644 (file)
@@ -458,7 +458,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 +630,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;
        }