kbd bindings: fix issues with delete & backspace bindings in draw/i-edit mode

We now use the same actions in all modes, and the logic is:

1. is there a selected mixer strip and are we in it: if so, delete selected
   processors
2. are we in draw or internal mode? if so ..
   2a. if there are selected control points, delete them
   2b. if not, attempt to delete MIDI notes
   2c. done
3. continue with delete operation as before
This commit is contained in:
Paul Davis 2023-04-25 11:38:16 -06:00
parent 595e2e2914
commit 87b5849a7b
4 changed files with 26 additions and 9 deletions

View File

@ -484,9 +484,7 @@ This mode provides many different operations on both regions and control points,
@notes|Notes/quantize-selected-notes|q|Quantize Selected Notes
@notes|Notes/delete| Backspace|Delete Note Selection
@notes|Notes/alt-delete| Delete|Delete Note Selection
@notes|Main/Escape|Clear selection
@notes|Main/Escape| Clear selection
@notes|Notes/select-next| Tab|Select next note
@notes|Notes/select-previous| <@PRIMARY@>Tab|Select previous note

View File

@ -1408,6 +1408,7 @@ private:
void split_region ();
void delete_ ();
void alt_delete_ ();
void cut ();
void copy ();
void paste (float times, bool from_context_menu);

View File

@ -821,9 +821,6 @@ Editor::register_midi_actions (Bindings* midi_bindings)
/* two versions to allow same action for Delete and Backspace */
ActionManager::register_action (_midi_actions, X_("delete"), _("Delete Selection"), sigc::bind (sigc::mem_fun (*this, &Editor::midi_action), &MidiRegionView::delete_selection));
ActionManager::register_action (_midi_actions, X_("alt-delete"), _("Delete Selection (alternate)"), sigc::bind (sigc::mem_fun (*this, &Editor::midi_action), &MidiRegionView::delete_selection));
ActionManager::register_action (_midi_actions, X_("clear-selection"), _("Clear Note Selection"), sigc::bind (sigc::mem_fun (*this, &Editor::midi_action), &MidiRegionView::clear_note_selection));
ActionManager::register_action (_midi_actions, X_("invert-selection"), _("Invert Note Selection"), sigc::bind (sigc::mem_fun (*this, &Editor::midi_action), &MidiRegionView::invert_selection));
ActionManager::register_action (_midi_actions, X_("extend-selection"), _("Extend Note Selection"), sigc::bind (sigc::mem_fun (*this, &Editor::midi_action), &MidiRegionView::extend_selection));

View File

@ -4418,11 +4418,32 @@ Editor::delete_ ()
//special case: if the user is pointing in the editor/mixer strip, they may be trying to delete a plugin.
//we need this because the editor-mixer strip is in the editor window, so it doesn't get the bindings from the mix window
bool deleted = false;
if (current_mixer_strip && current_mixer_strip == MixerStrip::entered_mixer_strip())
deleted = current_mixer_strip->delete_processors ();
if (!deleted)
if (current_mixer_strip && current_mixer_strip == MixerStrip::entered_mixer_strip()) {
deleted = current_mixer_strip->delete_processors ();
}
if (internal_editing()) {
if (!selection->points.empty()) {
begin_reversible_command (_("delete control points"));
cut_copy_points (Delete, timepos_t (Temporal::AudioTime));
selection->clear_points ();
commit_reversible_command ();
} else {
midi_action (&MidiRegionView::delete_selection);
}
return;
}
if (!deleted) {
cut_copy (Delete);
}
}
void
Editor::alt_delete_ ()
{
delete_ ();
}
/** Cut selected regions, automation points or a time range */