-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fixes bug from issue #6002 #6803
Conversation
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.
only has a single clip... This works. The code is clear and the behavior acceptable. It's not likely to accidentally copy two patterns as you first need to turn on the selection mode in the song editor. The only time this could be confusing would be if your're trying to paste over a note clip that is already there and the one your pasting is similar. The original pattern will stay and there will be no clear confirmation if something has happened, which it hasn't. I think this is a good solution and it should be merged. |
I agree that the name shouldn't be copied with the pattern. I wonder if it was dropped intentionally. |
Interesting, after a quick test it seems the name is being copied and pasted, but not displayed when the clip only contains step notes (both on the SongEditor and the PatternEditor). I wonder if this is more related to the paintEvent of the clip, it seems so because after adding a regular note the name of the pattern is displayed on both editors. Also, changing the name manually on a clip that only has step notes changes the name but doesn't display it. It's possible that #5902 might fix it since it changes a little bit of the paintEvent code, but I can't be sure. Does the name of the clip display even on clips that only have stepNotes on 1.2.2? If it does we'd have to investigate further what change caused this, but at least I noticed that the copying and pasting is actually copying the name of the clip and pasting it to the new one, so probably something unrelated to this PR. In the nightly build the clip name is also not displayed on clips containing step notes only, so it's another hint that this issue started before and is at least not related to this fix. If nobody wishes to review, I plan to merge this tomorrow (if someone manifests interest in reviewing it too I can merge later though) |
Yes indeed. I think it's just unnecessary noise on the pattern. I can understand naming a note clip but not a pattern on a drum machine. |
👍 |
Investigating a bit, on 1.2.2 the name drawing is made on //Line 1052
bool isDefaultName = m_pat->name() == m_pat->instrumentTrack()->name();
if( !isDefaultName && m_staticTextName.text() != m_pat->name() )
{
m_staticTextName.setText( m_pat->name() );
}
// ... Line 1067
if( !isDefaultName )
{
p.setPen( textShadowColor() );
p.drawStaticText( textLeft + 1, textTop + 1, m_staticTextName );
p.setPen( textColor() );
p.drawStaticText( textLeft, textTop, m_staticTextName );
} While on the nightly it changes to this: // src/gui/clips/MidiClipView.cpp Line 432
// Check whether we will paint a text box and compute its potential height
// This is needed so we can paint the notes underneath it.
bool const drawName = !m_clip->name().isEmpty();
bool const drawTextBox = !beatClip && drawName;
// ... Line 656
// clip name
if (drawTextBox)
{
paintTextLabel(m_clip->name(), p);
} and // src/gui/clips/PatternClipView.cpp Line 137
// clip name
paintTextLabel(m_patternClip->name(), p); Which is a little confusing because I don't see the part of the PatternClipView::paintEvent that draws the step notes itself, so it makes me wonder how it's being called and where. But bottom point, the paint event changed a lot and on MidiClipView.cpp the conditional doesn't allow the stepnote clips to have its name displayed (because Anyways, sounds like a rabbit hole issue, which might require it's own debugging and proper fixing, but out of scope for this PR. |
^This. Should perhaps have a ticket of it's own. |
I'm facepalming right now: PatternClips are the clips that we add to BBTracks inside the SongEditor, to mark where the Pattern should be played in the song, so obviously there will be no notes being drawn there. The clips inside the BBEditor are all MidiClips, whether they contain regular notes or step notes, so all the drawing of those will be done by MidiClipView::paintEvent. So mistery solved, the way the paint event is written now makes it so beatClips (clips made of only step notes) don't have their name drawn. |
OK, good and problem solved! |
Sounds perfect. Thanks! |
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.
Fixes #6002