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

Partial ties refinements #26048

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 31 additions & 22 deletions src/engraving/dom/tie.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,6 @@ Tie::Tie(const ElementType& type, EngravingItem* parent)

void Tie::updatePossibleJumpPoints()
{
MasterScore* master = masterScore();
const Note* note = toNote(parentItem());
const Chord* chord = note->chord();
const Measure* measure = chord->measure();
const MeasureBase* masterMeasureBase = master->measure(measure->index());
const Measure* masterMeasure = masterMeasureBase && masterMeasureBase->isMeasure() ? toMeasure(masterMeasureBase) : nullptr;
if (!tieJumpPoints()) {
return;
}
Expand All @@ -233,6 +227,13 @@ void Tie::updatePossibleJumpPoints()
return;
}

MasterScore* master = masterScore();
const Note* note = toNote(parentItem());
const Chord* chord = note->chord();
const Measure* measure = chord->measure();
const MeasureBase* masterMeasureBase = master->measure(measure->index());
const Measure* masterMeasure = masterMeasureBase && masterMeasureBase->isMeasure() ? toMeasure(masterMeasureBase) : nullptr;

int jumpPointIdx = 0;

Note* nextNote = searchTieNote(note);
Expand Down Expand Up @@ -293,7 +294,7 @@ void Tie::addTiesToJumpPoints()
jumpPoint->undoSetActive(true);
continue;
}
jumpPoints->addTieToScore(jumpPoint);
jumpPoints->undoAddTieToScore(jumpPoint);
}
}

Expand Down Expand Up @@ -499,10 +500,10 @@ const String TieJumpPoint::menuTitle() const
{
const Measure* measure = m_note->findMeasure();
const int measureNo = measure ? measure->no() + 1 : 0;
const TranslatableString tieTo("engraving", "Tie to ");
const String title = tieTo.str + precedingJumpItemName() + u" " + muse::mtrc("engraving", "(m. %1)").arg(measureNo);
const String measureStr = String::fromStdString(std::to_string(measureNo));

return title;
//: %1 represents the preceding jump item eg. coda. %2 represents the measure number
return muse::mtrc("engraving", "Tie to %1 (m. %2)").arg(precedingJumpItemName(), measureStr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I overlooked that measureNo is an int of course. You could do

return muse::mtrc("engraving", "Tie to %1 (m. %2)")
       .arg(precedingJumpItemName(), String::number(measureNo));

(Alternatively,

return muse::mtrc("engraving", "Tie to %1 (m. %2)")
       .arg(precedingJumpItemName()).arg(measureStr);

but that is less performant.)

}

String TieJumpPoint::precedingJumpItemName() const
Expand All @@ -512,7 +513,8 @@ String TieJumpPoint::precedingJumpItemName() const
const Measure* measure = seg->measure();

if (seg->score()->firstSegment(SegmentType::ChordRest) == seg) {
return muse::mtrc("engraving", "start of score");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "start of score", "partial tie menu");
}

// Markers
Expand All @@ -527,9 +529,11 @@ String TieJumpPoint::precedingJumpItemName() const
}

if (marker->markerType() == MarkerType::CODA || marker->markerType() == MarkerType::VARCODA) {
return muse::mtrc("engraving", "coda");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "coda", "partial tie menu");
} else {
return muse::mtrc("engraving", "segno");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "segno", "partial tie menu");
}
}

Expand All @@ -542,12 +546,14 @@ String TieJumpPoint::precedingJumpItemName() const

Volta* volta = toVolta(spanner.value);

return muse::mtrc("engraving", "“%1” volta").arg(volta->beginText());
//: Used at %1 in the string "Tie to %1 (m. %2)". %1 in this string represents the volta's text set by the user
return muse::mtrc("engraving", "“%1” volta", "partial tie menu").arg(volta->beginText());
}

// Repeat barlines
if (measure->repeatStart()) {
return muse::mtrc("engraving", "start repeat");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "start repeat", "partial tie menu");
}

for (Segment* prevSeg = seg->prev(SegmentType::BarLineType); prevSeg && prevSeg->tick() == seg->tick();
Expand All @@ -559,15 +565,18 @@ String TieJumpPoint::precedingJumpItemName() const

BarLine* bl = toBarLine(el);
if (bl->barLineType() & (BarLineType::START_REPEAT | BarLineType::END_START_REPEAT)) {
return muse::mtrc("engraving", "start repeat");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "start repeat", "partial tie menu");
}
}

if (m_note->tieBack() && m_note->tieBack()->startNote()) {
return muse::mtrc("engraving", "next note");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "next note", "partial tie menu");
}

return muse::mtrc("engraving", "invalid");
//: Used at %1 in the string "Tie to %1 (m. %2)"
return muse::mtrc("engraving", "invalid", "partial tie menu");
}

//---------------------------------------------------------
Expand Down Expand Up @@ -630,12 +639,12 @@ void TieJumpPointList::toggleJumpPoint(const String& id)
if (checked) {
undoRemoveTieFromScore(end);
} else {
addTieToScore(end);
undoAddTieToScore(end);
}
score->endCmd();
}

void TieJumpPointList::addTieToScore(TieJumpPoint* jumpPoint)
void TieJumpPointList::undoAddTieToScore(TieJumpPoint* jumpPoint)
{
Note* note = jumpPoint->note();
Score* score = note ? note->score() : nullptr;
Expand Down Expand Up @@ -714,8 +723,8 @@ Tie* Tie::changeTieType(Tie* oldTie, Note* endNote)
return nullptr;
}

TranslatableString undoCmd = addPartialTie ? TranslatableString("engraving", "Replace full tie with partial tie") : TranslatableString(
"engraving", "Replace partial tie with full tie");
TranslatableString undoCmd = addPartialTie ? TranslatableString("engraving", "Replace full tie with partial tie")
: TranslatableString("engraving", "Replace partial tie with full tie");
Tie* newTie = addPartialTie ? Factory::createPartialTie(score->dummy()->note()) : Factory::createTie(score->dummy()->note());

score->undoRemoveElement(oldTie);
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/tie.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TieJumpPointList
TieJumpPoint* findJumpPoint(const String& id);
void toggleJumpPoint(const String& id);

void addTieToScore(TieJumpPoint* jumpPoint);
void undoAddTieToScore(TieJumpPoint* jumpPoint);
void undoRemoveTieFromScore(TieJumpPoint* jumpPoint);

std::vector<TieJumpPoint*>::iterator begin() { return m_jumpPoints.begin(); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ StyledPopupView {
property alias navigationOrderStart: capoSettingsNavPanel.order
readonly property alias navigationOrderEnd: capoSettingsNavPanel.order

property QtObject model: capoModel
readonly property alias model: capoModel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this property at all, now that the model.canOpen call no longer happens in QML but in C++?



contentWidth: content.width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import MuseScore.NotationScene 1.0
StyledPopupView {
id: root

property QtObject model: harpModel
readonly property alias model: harpModel

property variant pedalState: harpModel.pedalState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ StyledPopupView {
property alias navigationOrderStart: partialTieNavPanel.order
readonly property alias navigationOrderEnd: partialTieNavPanel.order

property QtObject model: partialTiePopupModel
readonly property alias model: partialTiePopupModel

showArrow: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ StyledPopupView {
property alias navigationOrderStart: navPanel.order
readonly property alias navigationOrderEnd: navPanel.order

property QtObject model: stringTuningsModel
readonly property alias model: stringTuningsModel


contentWidth: content.width
Expand Down
2 changes: 1 addition & 1 deletion src/playback/qml/MuseScore/Playback/SoundFlagPopup.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ StyledPopupView {
property alias navigationOrderStart: navPanel.order
readonly property alias navigationOrderEnd: museSoundsParams.navigationPanelOrderEnd

property QtObject model: soundFlagModel
readonly property alias model: soundFlagModel

contentWidth: content.width
contentHeight: content.childrenRect.height
Expand Down