13
0

fix for #3977 - shift-tab and shift-ctrl-tab move to the next/previous note like tab, but leave existing selected note(s) selected

git-svn-id: svn://localhost/ardour2/branches/3.0@9838 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2011-07-11 13:17:01 +00:00
parent 58a700e968
commit 07b584f312
2 changed files with 30 additions and 22 deletions

View File

@ -723,13 +723,26 @@ MidiRegionView::key_press (GdkEventKey* ev)
} else if (ev->keyval == GDK_Tab) {
if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
goto_previous_note ();
if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
goto_previous_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
} else {
goto_next_note ();
goto_next_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
}
return true;
} else if (ev->keyval == GDK_ISO_Left_Tab) {
/* Shift-TAB generates ISO Left Tab, for some reason */
if (Keyboard::modifier_state_contains (ev->state, Keyboard::PrimaryModifier)) {
goto_previous_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
} else {
goto_next_note (Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier));
}
return true;
} else if (ev->keyval == GDK_Up) {
bool allow_smush = Keyboard::modifier_state_contains (ev->state, Keyboard::TertiaryModifier);
@ -2054,15 +2067,6 @@ MidiRegionView::note_selected(ArdourCanvas::CanvasNoteEvent* ev, bool add, bool
add_to_selection (*i);
}
#if 0
/* if events were guaranteed to be time sorted, we could do this.
but as of sept 10th 2009, they no longer are.
*/
if ((*i)->note()->time() > latest) {
break;
}
#endif
}
}
}
@ -3141,9 +3145,8 @@ MidiRegionView::time_sort_events ()
}
void
MidiRegionView::goto_next_note ()
MidiRegionView::goto_next_note (bool add_to_selection)
{
// framepos_t pos = -1;
bool use_next = false;
if (_events.back()->selected()) {
@ -3157,8 +3160,11 @@ MidiRegionView::goto_next_note ()
use_next = true;
continue;
} else if (use_next) {
unique_select (*i);
// pos = _region->position() + beats_to_frames ((*i)->note()->time());
if (!add_to_selection) {
unique_select (*i);
} else {
note_selected (*i, true, false);
}
return;
}
}
@ -3170,9 +3176,8 @@ MidiRegionView::goto_next_note ()
}
void
MidiRegionView::goto_previous_note ()
MidiRegionView::goto_previous_note (bool add_to_selection)
{
// framepos_t pos = -1;
bool use_next = false;
if (_events.front()->selected()) {
@ -3186,8 +3191,11 @@ MidiRegionView::goto_previous_note ()
use_next = true;
continue;
} else if (use_next) {
unique_select (*i);
// pos = _region->position() + beats_to_frames ((*i)->note()->time());
if (!add_to_selection) {
unique_select (*i);
} else {
note_selected (*i, true, false);
}
return;
}
}

View File

@ -258,8 +258,8 @@ public:
/** Convert a timestamp in frames to beats (both relative to region start) */
double frames_to_beats(framepos_t) const;
void goto_previous_note ();
void goto_next_note ();
void goto_previous_note (bool add_to_selection);
void goto_next_note (bool add_to_selection);
void change_note_lengths (bool, bool, Evoral::MusicalTime beats, bool start, bool end);
void change_velocities (bool up, bool fine, bool allow_smush);
void transpose (bool up, bool fine, bool allow_smush);