mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-17 04:06:26 +01:00
make middle-click on piano roll track header more usefully select/unselect notes
This commit is contained in:
parent
fca33f903d
commit
4f9e46976c
2 changed files with 41 additions and 38 deletions
|
|
@ -2135,21 +2135,16 @@ MidiRegionView::invert_selection ()
|
||||||
void
|
void
|
||||||
MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend)
|
MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend)
|
||||||
{
|
{
|
||||||
|
bool have_selection = !_selection.empty();
|
||||||
uint8_t low_note = 127;
|
uint8_t low_note = 127;
|
||||||
uint8_t high_note = 0;
|
uint8_t high_note = 0;
|
||||||
MidiModel::Notes& notes (_model->notes());
|
MidiModel::Notes& notes (_model->notes());
|
||||||
_optimization_iterator = _events.begin();
|
_optimization_iterator = _events.begin();
|
||||||
|
|
||||||
if (!add) {
|
if (extend && !have_selection) {
|
||||||
clear_selection ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (extend && _selection.empty()) {
|
|
||||||
extend = false;
|
extend = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extend) {
|
|
||||||
|
|
||||||
/* scan existing selection to get note range */
|
/* scan existing selection to get note range */
|
||||||
|
|
||||||
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
|
for (Selection::iterator i = _selection.begin(); i != _selection.end(); ++i) {
|
||||||
|
|
@ -2161,6 +2156,18 @@ MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!add) {
|
||||||
|
clear_selection ();
|
||||||
|
|
||||||
|
if (!extend && (low_note == high_note) && (high_note == notenum)) {
|
||||||
|
/* only note previously selected is the one we are
|
||||||
|
* reselecting. treat this as cancelling the selection.
|
||||||
|
*/
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (extend) {
|
||||||
low_note = min (low_note, notenum);
|
low_note = min (low_note, notenum);
|
||||||
high_note = max (high_note, notenum);
|
high_note = max (high_note, notenum);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -514,18 +514,15 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev)
|
||||||
{
|
{
|
||||||
int note = _view.y_to_note(ev->y);
|
int note = _view.y_to_note(ev->y);
|
||||||
|
|
||||||
if (ev->button != 1) {
|
if (ev->button == 2 && ev->type == GDK_BUTTON_PRESS) {
|
||||||
|
if (Keyboard::no_modifiers_active (ev->state)) {
|
||||||
|
SetNoteSelection (note); // EMIT SIGNAL
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editor().current_mouse_mode() == Editing::MouseRange) {
|
if (ev->button == 1 && ev->type == GDK_BUTTON_PRESS && note >= 0 && note < 128) {
|
||||||
if (Keyboard::no_modifiers_active (ev->state)) {
|
|
||||||
SetNoteSelection (note); // EMIT SIGNAL
|
|
||||||
}
|
|
||||||
_dragging = true;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (ev->type == GDK_BUTTON_PRESS && note >= 0 && note < 128) {
|
|
||||||
|
|
||||||
add_modal_grab();
|
add_modal_grab();
|
||||||
_dragging = true;
|
_dragging = true;
|
||||||
|
|
@ -540,7 +537,6 @@ PianoRollHeader::on_button_press_event (GdkEventButton* ev)
|
||||||
reset_clicked_note(note);
|
reset_clicked_note(note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue