From 43b700d23cfabc45e924bf134ede9c7093ac973a Mon Sep 17 00:00:00 2001 From: Hyunjin Song Date: Thu, 4 Oct 2018 20:24:15 +0900 Subject: [PATCH] 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. --- src/gui/editors/BBEditor.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gui/editors/BBEditor.cpp b/src/gui/editors/BBEditor.cpp index 699ff252473..577f8fe6a43 100644 --- a/src/gui/editors/BBEditor.cpp +++ b/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();