Add Ctrl+C/V/X/D keyboard shortcuts for Song Editor clips - #8428
BernardoMalheiro wants to merge 1 commit into
Conversation
Closes LMMS#7630 LMMS had no keyboard clipboard shortcuts for clips in the Song Editor. This adds Ctrl+C (copy), Ctrl+V (paste at cursor or playhead), Ctrl+X (cut), and Ctrl+D (duplicate in place). Reuses existing ClipView serialization and TrackContentWidget::pasteSelection infrastructure. createClipDataFiles is promoted from protected to public to allow direct use in SongEditor::keyPressEvent. Co-authored-by: Diogo Carreira <diogo.f.carreira@tecnico.ulisboa.pt>
|
Hi @yohannd1, sorry to bother you. I saw you've recently reviewed changes to SongEditor.cpp (#8385), which is the main file this PR touches. Would you be able to take a look when you have a moment? It's been open a couple of weeks and me and @DiogopC05 are happy to address any feedback. Thanks for your time! |
yohannd1
left a comment
There was a problem hiding this comment.
This generally looks good, and I really like this change!
Note however that we are currently in a feature freeze (see #8259), and as such this will probably take a while until it's properly reviewed.
I did some preliminary testing and reviewing, however:
| QVector<ClipView *> getClickedClips(); | ||
|
|
||
| // Methods to remove, copy, cut, paste and mute a QVector of Clip views | ||
| DataFile createClipDataFiles(const QVector<ClipView *> & clips) const; |
There was a problem hiding this comment.
| DataFile createClipDataFiles(const QVector<ClipView *> & clips) const; | |
| DataFile createClipDataFiles(const QVector<ClipView*>& clips) const; |
| return; | ||
| } | ||
|
|
||
| std::sort(so.begin(), so.end(), [](ClipView* a, ClipView* b) |
There was a problem hiding this comment.
It might be a good idea to move refactor out this lambda, as it's used 3 times in the code. Maybe something like const auto sortClipByStart = ....
| return a->getClip()->startPosition() < b->getClip()->startPosition(); | ||
| }); | ||
|
|
||
| so.first()->copy(so); |
There was a problem hiding this comment.
There is a ClipView::cut method. Have you tried that out?
|
|
||
| TextFloat::displayMessage( | ||
| tr("Clipboard"), | ||
| tr("%n clip(s) copied", "", so.size()), |
There was a problem hiding this comment.
I imagine this should be "cut" instead of "copied"?
| tcw->pasteSelection(pastePos, &md, true); | ||
| TextFloat::displayMessage( | ||
| tr("Clipboard"), | ||
| tr("%n clip(s) pasted at cursor", "", clipCount), |
There was a problem hiding this comment.
Likewise, here and in line 718 the term "pasted" might be a bit off.
Closes #7630
LMMS had no keyboard clipboard shortcuts for clips in the Song Editor. This adds Ctrl+C (copy), Ctrl+V (paste at cursor or default to playhead), Ctrl+X (cut), and Ctrl+D (duplicate in place).
Reuses existing ClipView serialization and TrackContentWidget::pasteSelection infrastructure. createClipDataFiles is promoted from protected to public to allow direct use in SongEditor::keyPressEvent.