Skip to content

Commit

Permalink
Repeat last chord after inputting a rest
Browse files Browse the repository at this point in the history
Backport of musescore#18951 plus fixing some a clazy warnings
  • Loading branch information
bakajikara authored and Jojo-Schmitz committed Feb 16, 2025
1 parent 3c982d3 commit d95535e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions mscore/scoreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include "libmscore/score.h"
#include "libmscore/segment.h"
#include "libmscore/shadownote.h"
#include "libmscore/shape.h"
#include "libmscore/slur.h"
#include "libmscore/spanner.h"
#include "libmscore/staff.h"
Expand All @@ -75,14 +76,13 @@
#include "libmscore/systemtext.h"
#include "libmscore/textframe.h"
#include "libmscore/text.h"
#include "libmscore/textline.h"
#include "libmscore/timesig.h"
#include "libmscore/tuplet.h"
#include "libmscore/undo.h"
#include "libmscore/utils.h"
#include "libmscore/volta.h"
#include "libmscore/xml.h"
#include "libmscore/textline.h"
#include "libmscore/shape.h"

#ifdef AVSOMR
#include "avsomr/avsomr.h"
Expand Down Expand Up @@ -1934,7 +1934,7 @@ void ScoreView::normalCopy()
QMimeData* mimeData = new QMimeData;
mimeData->setData(mimeType, _score->selection().mimeData());
if (MScore::debugMode)
qDebug("cmd copy: <%s>", mimeData->data(mimeType).data());
qDebug("cmd copy: <%s>", mimeData->data(mimeType).constData());
QApplication::clipboard()->setMimeData(mimeData);
}
}
Expand Down Expand Up @@ -5056,18 +5056,18 @@ void ScoreView::cmdRepeatSelection()

if (noteEntryMode() && selection.isSingle()) {
Element* el = _score->selection().element();
if (el && el->type() == ElementType::NOTE) {
if (!_score->inputState().endOfScore()) {
_score->startCmd();
bool addTo = false;
Chord* c = static_cast<Note*>(el)->chord();
for (Note* note : c->notes()) {
NoteVal nval = note->noteVal();
_score->addPitch(nval, addTo);
addTo = true;
}
_score->endCmd();
while (el && el->type() != ElementType::NOTE)
el = el->prevSegmentElement();
if (el && el->type() == ElementType::NOTE && !_score->inputState().endOfScore()) {
_score->startCmd();
bool addTo = false;
Chord* c = toNote(el)->chord();
for (Note* note : c->notes()) {
NoteVal nval = note->noteVal();
_score->addPitch(nval, addTo);
addTo = true;
}
_score->endCmd();
}
return;
}
Expand All @@ -5089,7 +5089,7 @@ void ScoreView::cmdRepeatSelection()
QMimeData* mimeData = new QMimeData;
mimeData->setData(mimeType, selection.mimeData());
if (MScore::debugMode)
qDebug("cmdRepeatSelection: <%s>", mimeData->data(mimeType).data());
qDebug("cmdRepeatSelection: <%s>", mimeData->data(mimeType).constData());
QApplication::clipboard()->setMimeData(mimeData);

QByteArray d(mimeData->data(mimeType));
Expand Down Expand Up @@ -5631,7 +5631,7 @@ static const Element* visibleElementInScore(const Element* orig, const Score* s)
if (orig->score() == s && orig->bbox().isValid())
return orig;

for (const ScoreElement* se : orig->linkList()) {
for (ScoreElement*& se : orig->linkList()) {
const Element* e = toElement(se);
if (e->score() == s && e->bbox().isValid()) // bbox check to ensure the element is indeed visible
return e;
Expand Down

0 comments on commit d95535e

Please sign in to comment.