have getSelectedNotes() return the selected notes, rather than appending them to a write-back parameter

This commit is contained in:
Colin Wallace
2015-09-06 15:33:13 -07:00
parent ff94f8b4ce
commit db18fa61fe
2 changed files with 12 additions and 13 deletions

View File

@@ -129,7 +129,7 @@ protected:
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 );

View File

@@ -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;
}
@@ -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() )
{
@@ -3586,8 +3586,7 @@ void PianoRoll::cutSelectedNotes()
return;
}
NoteVector selected_notes;
getSelectedNotes( selected_notes );
NoteVector selected_notes = getSelectedNotes();
if( ! selected_notes.empty() )
{