Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No Note copy/paste #6002

Closed
ben83bb opened this issue Apr 28, 2021 · 6 comments · Fixed by #6803
Closed

No Note copy/paste #6002

ben83bb opened this issue Apr 28, 2021 · 6 comments · Fixed by #6803
Labels
Milestone

Comments

@ben83bb
Copy link

ben83bb commented Apr 28, 2021

Lmms 1.3.0 Alpha

If i want to copy Notes by right clicking in the BB-Editor form one Instrument to another. I cant paste it to the other Instrument. It has no effect.

@ben83bb ben83bb added the bug label Apr 28, 2021
@qnebra
Copy link

qnebra commented Apr 28, 2021

Why you want to do that? For me it is quite illogical that copy & paste options are in BB-Editor, as they are completly inactive.

@ben83bb
Copy link
Author

ben83bb commented Apr 28, 2021

In LMMS 1.2.2 i can copy n paste same Notes to other instruments.
The Reason why i want to have this Option is, that i want to clone Notes and set them in different Octaves

@IanCaio
Copy link
Contributor

IanCaio commented Apr 28, 2021

I did some testing here, pasting works fine when you paste on the Song Editor, but pasting inside the BB editor is in fact not working as it used to work on Stable.

There was a serious refactoring of the Clipboard functionality plus some improvements (like selection Copy/Paste, pasting in the timeline, etc) and with them the way the Copying and Pasting code works changed. Something along the changes probably turned out incompatible with the BBEditor, I'm not sure. I'll have to investigate it a bit further.

For now you can use the Piano Roll and copy and paste the notes directly as a workaround.

@IanCaio
Copy link
Contributor

IanCaio commented Apr 28, 2021

I tracked the problem down to this conditional on TrackContentWidget::canPasteSelection:

// We can only paste into tracks of the same type
if( type != ( "tco_" + QString::number( t->type() ) ) ||
m_trackView->trackContainerView()->fixedTCOs() == true )
{
return false;
}

One of the changes on the clipboard refactoring is that pasting a single TCO or multiple ones both use the same method. This was done to avoid duplication of code and to allow a more flexible Copy/Pasting UI. The problem is that one of the conditionals of the selection pasting was that it couldn't be done on TrackViews that used fixedTCOs, which was probably done because the BBEditor uses the TCO position to define which BBTrack that TCO is part of, so pasting selections over the BBTrack could cause issues with TCOs being placed in different or even inexistent BBTracks (which is also why setAcceptDrops is false on the BBEditor).

I still have to think what a good solution would be, because simply allowing the selection to be pasted isn't safe because of the same reasons it wasn't safe before. There will probably have to be another conditional for when the TrackView is from the BBEditor which would check if there's only one TCO being pasted and that it's size is the same as the BBTCO size.

I'm leaving this fix for after the refactor, but at least it's already clarified where the problem lies. Thanks for bringing it to attention @ben83bb !

@zonkmachine
Copy link
Member

zonkmachine commented Aug 9, 2023

@IanCaio In #6756 I bisected your original branch down to this guilty commit (ebc808e). Closing #6756 as a duplicate.

I tracked the problem down to this conditional on TrackContentWidget::canPasteSelection:

// We can only paste into tracks of the same type
if( type != ( "tco_" + QString::number( t->type() ) ) ||
m_trackView->trackContainerView()->fixedTCOs() == true )
{
return false;
}

I can confirm that removing the fixedTCO condition turns copy/paste on again in the Pattern Editor. I don't know what other issues this may bring. Can you look into patching this now?

@zonkmachine zonkmachine added this to the 1.3 milestone Aug 9, 2023
@IanCaio
Copy link
Contributor

IanCaio commented Aug 9, 2023

@IanCaio In #6756 I bisected your original branch down to this guilty commit (ebc808e). Closing #6756 as a duplicate.

I tracked the problem down to this conditional on TrackContentWidget::canPasteSelection:

// We can only paste into tracks of the same type
if( type != ( "tco_" + QString::number( t->type() ) ) ||
m_trackView->trackContainerView()->fixedTCOs() == true )
{
return false;
}

I can confirm that removing the fixedTCO condition turns copy/paste on again in the Pattern Editor. I don't know what other issues this may bring. Can you look into patching this now?

It's been a while, had to read my own reply to remember what this bug was about. Well, you can remove the fixedTCO conditional but you run into the same problem I mentioned: You'll be able to copy TCOs from the SongEditor and paste them to the BBEditor/ClipEditor, which behaves differently by using the TCO position to determine the BBTrack that it belongs to. When you're copying from an instrument inside the BBEditor to another one also on the BBEditor this will make no difference, but if you're copying from the Song Editor and pasting to the BBEditor you might create TCOs in positions that belong to other BBTracks or to non-existent BBTracks. If that is an acceptable behavior that fix is fine. If not this requires some more elaborate fix.

Honestly, I'd actually think just removing the fixedTCO is acceptable (with the cost of that weird behavior when copying and pasting from different editors, which shouldn't be something people will be doing much anyways), mostly because if things keep walking in the direction I think they should the BBEditor days are counted.

IanCaio added a commit to IanCaio/lmms that referenced this issue Aug 10, 2023
	Since the refactoring of the Copy/Paste features, it was not
possible to paste inside the BBEditor (now Pattern Editor), as reported
on issue LMMS#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.
IanCaio added a commit that referenced this issue Aug 12, 2023
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants