13
0

Implement invert selection for MIDI notes (#4087).

git-svn-id: svn://localhost/ardour2/branches/3.0@10198 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2011-10-07 20:27:12 +00:00
parent bbcb8125b7
commit 1567d362ad
3 changed files with 24 additions and 2 deletions

View File

@ -1231,8 +1231,6 @@ Editor::select_all_in_track (Selection::Operation op)
void
Editor::select_all_internal_edit (Selection::Operation)
{
/* currently limited to MIDI only */
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
if (mrv) {
@ -1274,6 +1272,7 @@ Editor::select_all (Selection::Operation op)
}
commit_reversible_command ();
}
void
Editor::invert_selection_in_track ()
{
@ -1292,6 +1291,16 @@ Editor::invert_selection ()
{
list<Selectable *> touched;
if (_internal_editing) {
for (RegionSelection::iterator i = selection->regions.begin(); i != selection->regions.end(); ++i) {
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
if (mrv) {
mrv->invert_selection ();
}
}
return;
}
for (TrackViewList::iterator iter = track_views.begin(); iter != track_views.end(); ++iter) {
if ((*iter)->hidden()) {
continue;

View File

@ -2027,6 +2027,18 @@ MidiRegionView::select_all_notes ()
}
}
void
MidiRegionView::invert_selection ()
{
for (Events::iterator i = _events.begin(); i != _events.end(); ++i) {
if ((*i)->selected()) {
remove_from_selection(*i);
} else {
add_to_selection (*i);
}
}
}
void
MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, bool add, bool extend)
{

View File

@ -192,6 +192,7 @@ public:
void delete_note (boost::shared_ptr<NoteType>);
size_t selection_size() { return _selection.size(); }
void select_all_notes ();
void invert_selection ();
void move_selection(double dx, double dy, double cumulative_dy);
void note_dropped (ArdourCanvas::CanvasNoteEvent* ev, ARDOUR::frameoffset_t, int8_t d_note);