diff --git a/include/Pattern.h b/include/Pattern.h index 505aff63e80..0e6ab452939 100644 --- a/include/Pattern.h +++ b/include/Pattern.h @@ -135,6 +135,8 @@ protected slots: private: + void resizeToFirstTrack(); + InstrumentTrack * m_instrumentTrack; PatternTypes m_patternType; diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index 15565ab7e4e..d7116121088 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -65,26 +65,11 @@ Pattern::Pattern( InstrumentTrack * _instrument_track ) : m_steps( MidiTime::stepsPerTact() ) { setName( _instrument_track->name() ); - - // Resize this track to be the same as existing tracks in the BB - const TrackContainer::TrackList & tracks = - m_instrumentTrack->trackContainer()->tracks(); - for(unsigned int trackID = 0; trackID < tracks.size(); ++trackID) + if( _instrument_track->trackContainer() + == Engine::getBBTrackContainer() ) { - if(tracks.at(trackID)->type() == Track::InstrumentTrack) - { - if(tracks.at(trackID) != m_instrumentTrack) - { - unsigned int currentTCO = m_instrumentTrack-> - getTCOs().indexOf(this); - m_steps = static_cast - (tracks.at(trackID)->getTCO(currentTCO)) - ->m_steps; - } - break; - } + resizeToFirstTrack(); } - init(); setAutoResize( true ); } @@ -135,6 +120,31 @@ Pattern::~Pattern() +void Pattern::resizeToFirstTrack() +{ + // Resize this track to be the same as existing tracks in the BB + const TrackContainer::TrackList & tracks = + m_instrumentTrack->trackContainer()->tracks(); + for(unsigned int trackID = 0; trackID < tracks.size(); ++trackID) + { + if(tracks.at(trackID)->type() == Track::InstrumentTrack) + { + if(tracks.at(trackID) != m_instrumentTrack) + { + unsigned int currentTCO = m_instrumentTrack-> + getTCOs().indexOf(this); + m_steps = static_cast + (tracks.at(trackID)->getTCO(currentTCO)) + ->m_steps; + } + break; + } + } +} + + + + void Pattern::init() { connect( Engine::getSong(), SIGNAL( timeSignatureChanged( int, int ) ),