From 6305669aa526c2152300c8d14d874f7ab5d49811 Mon Sep 17 00:00:00 2001 From: Cubiking Date: Tue, 24 Mar 2026 12:24:32 +0000 Subject: [PATCH] Fix Instrument change text should show full instrument name --- src/engraving/dom/instrchange.cpp | 2 +- src/engraving/dom/instrument.cpp | 10 ++++++++++ src/engraving/dom/instrument.h | 1 + src/notation/internal/notationparts.cpp | 13 ------------- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/engraving/dom/instrchange.cpp b/src/engraving/dom/instrchange.cpp index 9bc9a30c0ee8c..b69d626a7b2ee 100644 --- a/src/engraving/dom/instrchange.cpp +++ b/src/engraving/dom/instrchange.cpp @@ -152,7 +152,7 @@ void InstrumentChange::setupInstrument(const Instrument* instrument) } //: The text of an "instrument change" marking. It is an instruction to the player to switch to another instrument. - const String newInstrChangeText = muse::mtrc("engraving", "To %1").arg(instrument->trackName()); + const String newInstrChangeText = muse::mtrc("engraving", "To %1").arg(instrument->trackNameWithTrait()); undoChangeProperty(Pid::TEXT, TextBase::plainToXmlText(newInstrChangeText)); } diff --git a/src/engraving/dom/instrument.cpp b/src/engraving/dom/instrument.cpp index 36df940fd7d5c..92a4f88372adb 100644 --- a/src/engraving/dom/instrument.cpp +++ b/src/engraving/dom/instrument.cpp @@ -22,6 +22,8 @@ #include "instrument.h" +#include "translation.h" + #include "drumset.h" #include "instrtemplate.h" #include "masterscore.h" @@ -1066,6 +1068,14 @@ String Instrument::trackName() const return m_trackName; } +String Instrument::trackNameWithTrait() const +{ + if (m_trait.type == TraitType::Transposition && !m_trait.isHiddenOnScore) { + return muse::mtrc("engraving", "%1 in %2").arg(m_trackName, m_trait.name); + } + return m_trackName; +} + void Instrument::setTrackName(const String& s) { m_trackName = s; diff --git a/src/engraving/dom/instrument.h b/src/engraving/dom/instrument.h index 95a01285bdcbf..3ead6126ef944 100644 --- a/src/engraving/dom/instrument.h +++ b/src/engraving/dom/instrument.h @@ -348,6 +348,7 @@ class Instrument String musicXmlId() const; String trackName() const; + String trackNameWithTrait() const; void setTrackName(const String& s); String nameAsXmlText() const; String nameAsPlainText() const; diff --git a/src/notation/internal/notationparts.cpp b/src/notation/internal/notationparts.cpp index f08afeb6c1641..187aab41f88c3 100644 --- a/src/notation/internal/notationparts.cpp +++ b/src/notation/internal/notationparts.cpp @@ -48,19 +48,6 @@ using namespace mu::engraving; static const mu::engraving::Fraction DEFAULT_TICK = mu::engraving::Fraction(0, 1); -static String formatInstrumentTitleOnScore(const String& instrumentName, const Trait& trait) -{ - // Comments for translators start with //: - - if (trait.type == TraitType::Transposition && !trait.isHiddenOnScore) { - //: %1=name ("Horn"), %2=transposition ("C alto"). Example: "Horn in C alto" - return muse::qtrc("notation", "%1 in %2", "Transposing instrument displayed in the score") - .arg(instrumentName, trait.name); - } - - return instrumentName; // Example: "Flute" -} - NotationParts::NotationParts(IGetScore* getScore, INotationInteractionPtr interaction, INotationUndoStackPtr undoStack) : m_getScore(getScore), m_undoStack(undoStack), m_interaction(interaction) {