Skip to content

Commit

Permalink
Remove component from instrument when remmoving last layer
Browse files Browse the repository at this point in the history
  • Loading branch information
blablack committed Nov 8, 2014
1 parent d984dfa commit a7637e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/gui/src/InstrumentEditor/InstrumentEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,16 @@ void InstrumentEditor::buttonClicked( Button* pButton )
m_pInstrument->get_component(m_nSelectedComponent)->set_layer( NULL, m_nSelectedLayer );
delete pLayer;
}

int p_count = 0;
for( int n = 0; n < MAX_LAYERS; n++ ) {
InstrumentLayer* layer = m_pInstrument->get_component(m_nSelectedComponent)->get_layer( n );
if( layer )
p_count++;
}

if( p_count == 0 )
m_pInstrument->get_components()->erase( m_pInstrument->get_components()->begin() + m_nSelectedComponent );
}
AudioEngine::get_instance()->unlock();
selectedInstrumentChangedEvent(); // update all
Expand Down

0 comments on commit a7637e6

Please sign in to comment.