Skip to content

Commit

Permalink
Fixes bug from issue #6002 (#6803)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
IanCaio authored Aug 12, 2023
1 parent 353221a commit e87d44b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/gui/tracks/TrackContentWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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++ )
{
Expand Down

0 comments on commit e87d44b

Please sign in to comment.