Skip to content
Permalink
Browse files
Ensure correct TCOs after cloning tracks into the BB editor
Previously BBTrackContainerView::dropEvent always deleted
the TCOs of dropped tracks. It made dropped tracks unusable.
As of this commit, the function checks for correct TCOs.
If incorrect TCOs exist, the function remove them and add empty ones.
  • Loading branch information
PhysSong committed Oct 8, 2018
1 parent 5a92105 commit 43b700d23cfabc45e924bf134ede9c7093ac973a
Showing with 19 additions and 1 deletion.
  1. +19 −1 src/gui/editors/BBEditor.cpp
@@ -258,7 +258,25 @@ void BBTrackContainerView::dropEvent(QDropEvent* de)
DataFile dataFile( value.toUtf8() );
Track * t = Track::create( dataFile.content().firstChild().toElement(), model() );

t->deleteTCOs();
// Ensure BB TCOs exist
bool hasValidBBTCOs = false;
if (t->getTCOs().size() == m_bbtc->numOfBBs())
{
hasValidBBTCOs = true;
for (int i = 0; i < t->getTCOs().size(); ++i)
{
if (t->getTCOs()[i]->startPosition() != MidiTime(i, 0))
{
hasValidBBTCOs = false;
break;
}
}
}
if (!hasValidBBTCOs)
{
t->deleteTCOs();
t->createTCOsForBB(m_bbtc->numOfBBs() - 1);
}
m_bbtc->updateAfterTrackAdd();

de->accept();

0 comments on commit 43b700d

Please sign in to comment.