-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Harp pedalling diagrams and harp notation palette #12269
Conversation
setXmlText(diagram); | ||
} | ||
|
||
const String HarpPedalDiagram::getStringName(HarpString str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be static and should be declared directly in this file. Also, HarpString should be renamed to HarpStringType (and the argument to "type" accordingly). After these manipulations the method itself should be renamed to harpStringTypeToString
@@ -788,6 +788,24 @@ const std::array<StyleDef::StyleValue, size_t(Sid::STYLES)> StyleDef::styleValue | |||
{ Sid::stringNumberFrameBgColor, "stringNumberFrameBgColor", PropertyValue::fromValue(draw::Color::transparent) }, | |||
{ Sid::stringNumberOffset, "stringNumberOffset", PointF(0.0, 0.0) }, | |||
|
|||
{ Sid::harpPedalDiagramFontFace, "harpPedalDiagramFontFace", "Leland" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should not be Leland, since <sym>
symbols will automatically use the "Text" variant of the currently selected score font (e.g. Leland Text).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also consider using these symbols for the accidentals (they will be a better size): https://www.w3.org/2019/03/smufl13/tables/standard-accidentals-for-chord-symbols.html
diagram.append(strName + String("<sym>accidentalNatural</sym>, ")); | ||
break; | ||
case PedalPosition::SHARP: | ||
diagram.append(strName + String("<sym>accidentalSharp</sym>, ")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is not usual to include a comma. Also, from what I can find on the internet, it is common to put D, C, and B on a second line. This is from Dorico:
@oktophonie Can you confirm that this is desirable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The text diagrams in the design I'm following from @Tantacrul are only supposed to show the changes over previous settings, but yes the above is what I'd expect as a sort of initial state.
I'm still working on the text diagrams so can change this if need be!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oktophonie - thoughts about having two lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two lines is standard, as arranged in the Dorico example, and there should be no commas.
(One line is possible (D C B E F G A) but I've very rarely seen this - it would usually be just to save space in particularly tight situations.)
Harp pedal diagrams can now be added to score.
Both types of pedal diagrams are now finished. The UI to edit them can be submitted as a separate PR or added to this one. |
@@ -1209,6 +1209,18 @@ void LayoutSystem::layoutSystemElements(const LayoutOptions& options, LayoutCont | |||
} | |||
} | |||
} | |||
|
|||
//------------------------------------------------------------- | |||
// Harp pedal diagrams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By putting this at the bottom of the function, harp pedal diagrams will be stacked 'outside' of everything else. For example, if they are above the staff, they will appear even above tempo markings and rehearsal marks. @oktophonie What would be the correct stacking order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@miiizen, as suggested by @oktophonie, let's place them for now "outside" ottavas but "inside" anything else. That would mean moving this block of code to just above
MuseScore/src/engraving/layout/layoutsystem.cpp
Lines 1090 to 1094 in 3ee3c7e
// | |
// We need to known if we have FretDiagrams in the system to decide when to layout the Harmonies | |
// | |
bool hasFretDiagram = false; |
Like other indications of playing technique I'd expect them to stay close to the stave without too much getting in between. This is pretty easy if they are between the staves or below the bottom one. For placing them above, someone with access to a lot of solo harp material might better advise. I'd expect them to go outside of 8va markings but inside anything else(?) |
@@ -522,6 +524,9 @@ EngravingItem* ChordRest::drop(EditData& data) | |||
if (fromPalette) { | |||
r->setXmlText(score()->createRehearsalMarkText(r)); | |||
} | |||
} else if (e->isHarpPedalDiagram()) { | |||
HarpPedalDiagram* h = toHarpPedalDiagram(e); | |||
h->updateDiagramText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could consider overriding the added()
method in HarpPedalDiagram
and then moving the call to updateDiagramText();
to the added()
method.
|
||
class HarpPedalDiagram final : public TextBase | ||
{ | ||
std::vector<PedalPosition> _pedalState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the number of entries is/should always be 7, how about using std::array<PedalPosition, 7>
?
static std::vector<std::pair<String, String> > symbolReplacements { | ||
{ u"\ued60", u"b " }, | ||
{ u"\ued61", u" nat " }, | ||
{ u"\ued62", u"# " } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case HarpStringType::A: | ||
return String("A"); | ||
case HarpStringType::B: | ||
return String("B"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to take into account German note names. @oktophonie what do you think?
If yes, I'm not completely sure how to do that. We could do this through the 'normal' translation system that is also used for the UI, but that means that scores will look different if you open them in a MuseScore with a different language, which seems a bit dangerous to me. ISTR that we have some code somewhere to compute German note names, but I don't remember where and how it should be used.
using namespace mu::engraving; | ||
|
||
// Position of separator character in diagram | ||
static const int SEPARATOR_IDX = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be constexpr
instead of just const
using namespace mu::engraving; | ||
|
||
namespace mu::engraving { | ||
enum class PedalPosition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could write enum class PedalPosition : char {
, to specify that this enum only needs the space of a char
(1 byte). Same for HarpStringType
. Tiny memory usage optimization.
for (int idx = 0; idx < _pedalState.size(); idx++) { | ||
if (idx == SEPARATOR_IDX) { | ||
// insert separator | ||
diagram.append(String("\ue683")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there are reason to not use
<sym>harpPedalDivider</sym>
<sym>harpPedalRaised</sym>
<sym>harpPedalCentered</sym>
<sym>harpPedalLowered</sym>
respectively instead of the unicode values? That way, Leland should be used automatically as the font for the symbols. See also https://github.com/musescore/MuseScore/pull/12269/files#r915853649
(We might need to make sure here too that we're using Leland and not Leland Text; see
if (t->isDynamic() || t->textStyleType() == TextStyleType::OTTAVA) { |
@@ -99,6 +99,7 @@ const char* PaletteCell::translationContext() const | |||
case ElementType::BREATH: | |||
case ElementType::FERMATA: | |||
case ElementType::SYMBOL: | |||
case ElementType::HARP_DIAGRAM: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For ElementType::HARP_DIAGRAM
, this method should return "palette" (it should correspond with:
sp->appendElement(pedalDiagram, QT_TRANSLATE_NOOP("palette", "Harp pedal diagram"));
^~~~~~~
and
sp->appendElement(pedalTextDiagram, QT_TRANSLATE_NOOP("palette", "Harp pedal text"));
^~~~~~~
@@ -163,6 +164,7 @@ static const ElementName elementNames[] = { | |||
{ ElementType::STAFFTYPE_CHANGE, "StaffTypeChange", QT_TRANSLATE_NOOP("elementName", "Staff type change") }, | |||
{ ElementType::HARMONY, "Harmony", QT_TRANSLATE_NOOP("elementName", "Chord symbol") }, | |||
{ ElementType::FRET_DIAGRAM, "FretDiagram", QT_TRANSLATE_NOOP("elementName", "Fretboard diagram") }, | |||
{ ElementType::HARP_DIAGRAM, "HarpPedalDiagram", QT_TRANSLATE_NOOP("elementName", "Harp Pedal Diagram") }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing: for ui texts, we use "Sentence case" instead of "Title Case". So this one would be "Harp pedal diagram".
|
||
auto pedalTextDiagram = Factory::makeHarpPedalDiagram(gpaletteScore->dummy()->segment()); | ||
pedalTextDiagram->setIsDiagram(false); | ||
pedalTextDiagram->updateDiagramText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also consider to call updateDiagramText()
in layout()
, so that you don't need to remember to call it and so that it will always be up-to-date when other diagrams earlier in the score are modified.
(If you decide to do so, then my comment in src/engraving/libmscore/chordrest.cpp doesn't apply anymore)
A rebase is needed. It would have my preference to merge this PR first, so that we can review the new changes in #12597 in isolation. |
case HarpStringType::G: | ||
return String("G"); | ||
} | ||
return String(""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better just String()
instead of String("")
(in all places where an empty String is created).
Also, those String
literals should be prefixed with u
. So: String(u"A")
or simply u"A"
.
Otherwise, you are converting from const char*
to QString and then from QString to String. That's undesired because we want that the engraving module doesn't depend on Qt.
Some quick tips for rebasing, in case it's useful:
So in this case, the best strategy is often to choose the changes from the master branch and then reapply your additions. Of course, during rebasing, you can still see your changes (as they were before the rebase) here on GitHub, which you can use as a reference. Finally: you could save the SHA of your last commit, 340ad21, so that if it goes completely wrong you can do |
Huh? |
Sorry for the confusion, please see #12597! |
But how does that match with #12269 (comment) ? |
@Jojo-Schmitz We changed the plans a bit; it is not very convenient for @miiizen to continuously maintain two PRs. We decided to move on with #12597. |
This pull request adds harp pedalling diagrams to MuseScore for GSoC 2022.
These diagrams will be editable through a UI which will be built in the coming weeks.
Known issues