Skip to content

Commit

Permalink
have getSelectedNotes() return the selected notes, rather than append…
Browse files Browse the repository at this point in the history
…ing them to a write-back parameter
  • Loading branch information
Wallacoloo committed Sep 11, 2015
1 parent ff94f8b commit db18fa6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class PianoRoll : public QWidget
int width, const Note * n, const QColor & noteCol );
void removeSelection();
void selectAll();
void getSelectedNotes( NoteVector & selected_notes );
NoteVector getSelectedNotes();

// for entering values with dblclick in the vol/pan bars
void enterValue( NoteVector* nv );
Expand Down
23 changes: 11 additions & 12 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3480,20 +3480,21 @@ void PianoRoll::selectAll()


// returns vector with pointers to all selected notes
void PianoRoll::getSelectedNotes(NoteVector & selected_notes )
NoteVector PianoRoll::getSelectedNotes()
{
if( ! hasValidPattern() )
{
return;
}
NoteVector selectedNotes;

for( Note *note : m_pattern->notes() )
if (hasValidPattern())
{
if( note->selected() )
for( Note *note : m_pattern->notes() )
{
selected_notes.push_back( note );
if( note->selected() )
{
selectedNotes.push_back( note );
}
}
}
return selectedNotes;
}


Expand Down Expand Up @@ -3567,8 +3568,7 @@ void PianoRoll::copyToClipboard( const NoteVector & notes ) const

void PianoRoll::copySelectedNotes()
{
NoteVector selected_notes;
getSelectedNotes( selected_notes );
NoteVector selected_notes = getSelectedNotes();

if( ! selected_notes.empty() )
{
Expand All @@ -3586,8 +3586,7 @@ void PianoRoll::cutSelectedNotes()
return;
}

NoteVector selected_notes;
getSelectedNotes( selected_notes );
NoteVector selected_notes = getSelectedNotes();

if( ! selected_notes.empty() )
{
Expand Down

0 comments on commit db18fa6

Please sign in to comment.