13
0

Clarify context menu for midi notes.

- right click on a note selects it if unselected or selection empty.

	- note_context_menu is shown as described in #6348
This commit is contained in:
nick_m 2015-11-01 05:22:55 +11:00
parent 0e809dd1d5
commit 336f8d47fe
2 changed files with 41 additions and 9 deletions

View 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)));

View 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;
}