Skip to content

Commit

Permalink
Ensure correct TCOs after cloning tracks into the BB editor
Browse files Browse the repository at this point in the history
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 43b700d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/gui/editors/BBEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 43b700d

Please sign in to comment.