Fixes bug from issue #6002 (#6803)

* Fixes bug from issue 6002

	Since the refactoring of the Copy/Paste features, it was not
possible to paste inside the BBEditor (now Pattern Editor), as reported
on issue #6002. The reason for that is better explained in the issue
discussion.
	This PR fixes this by allowing pasting inside the Pattern Editor
when the clipboard has a single Clip, which is what was allowed on the
previous workflow, while at the same time avoiding the unexpected
behavior of pasting multiple Clips that might invade the positions
reserved for different Pattern Tracks.
This commit is contained in:
IanCaio
2023-08-12 11:54:26 -03:00
committed by GitHub
parent 353221a02c
commit e87d44b42c

View File

@@ -325,8 +325,7 @@ bool TrackContentWidget::canPasteSelection( TimePos clipPos, const QMimeData* md
QString value = decodeValue( md );
// We can only paste into tracks of the same type
if( type != ( "clip_" + QString::number( t->type() ) ) ||
m_trackView->trackContainerView()->fixedClips() == true )
if (type != ("clip_" + QString::number(t->type())))
{
return false;
}
@@ -360,6 +359,14 @@ bool TrackContentWidget::canPasteSelection( TimePos clipPos, const QMimeData* md
QDomElement clipParent = dataFile.content().firstChildElement("clips");
QDomNodeList clipNodes = clipParent.childNodes();
// If we are pasting into the PatternEditor, only a single Clip is allowed to be pasted
// so we don't have the unexpected behavior of pasting on different PatternTracks
if (m_trackView->trackContainerView()->fixedClips() == true &&
clipNodes.length() > 1)
{
return false;
}
// Determine if all the Clips will land on a valid track
for( int i = 0; i < clipNodes.length(); i++ )
{