Skip to content

Commit

Permalink
fix #306438: wrong default offset for chord symbols on fret diagrams
Browse files Browse the repository at this point in the history
Resolves: https://musescore.org/en/node/306438

The issue was introduced with a fix for
https://musescore.org/en/node/304057,
but the fix was too broad: it eliminated all reset of offset
for harmony objects on fret diagrams.
The original problem was we *always* reset it,
the fix was to *never* reset it.
The right answer is to reset it if styled.
Then manual adjustments are preserved,
but if no manual adjustments are present,
we reset it - which is to say, set is to the style default.
  • Loading branch information
MarcSabatella committed Jun 7, 2020
1 parent 86614bb commit 158b643
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
22 changes: 3 additions & 19 deletions libmscore/fret.cpp
Expand Up @@ -814,7 +814,7 @@ void FretDiagram::read(XmlReader& e)
else if (tag == "Harmony") {
Harmony* h = new Harmony(score());
h->read(e);
addLoaded(h);
add(h);
}
else if (!Element::readProperties(e))
e.unknown();
Expand Down Expand Up @@ -1195,7 +1195,8 @@ void FretDiagram::add(Element* e)
if (e->isHarmony()) {
_harmony = toHarmony(e);
_harmony->setTrack(track());
_harmony->resetProperty(Pid::OFFSET);
if (_harmony->propertyFlags(Pid::OFFSET) == PropertyFlags::STYLED)
_harmony->resetProperty(Pid::OFFSET);
_harmony->setProperty(Pid::ALIGN, int(Align::HCENTER | Align::TOP));
_harmony->setPropertyFlags(Pid::ALIGN, PropertyFlags::UNSTYLED);
}
Expand All @@ -1204,23 +1205,6 @@ void FretDiagram::add(Element* e)
}
}

//---------------------------------------------------------
// addLoaded
// used to add harmonies in read()
//---------------------------------------------------------

void FretDiagram::addLoaded(Element* e)
{
e->setParent(this);
if (e->isHarmony()) {
_harmony = toHarmony(e);
_harmony->setTrack(track());
}
else {
qWarning("FretDiagram: cannot add <%s>\n", e->name());
}
}

//---------------------------------------------------------
// remove
//---------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion libmscore/fret.h
Expand Up @@ -227,7 +227,6 @@ class FretDiagram final : public Element {
void init(Ms::StringData*, Chord*);

void add(Element*) override;
void addLoaded(Element*);
void remove(Element*) override;

bool acceptDrop(EditData&) const override;
Expand Down

0 comments on commit 158b643

Please sign in to comment.