Skip to content

Commit

Permalink
fix #275102 Default A note is A3, but was A4 in 2.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 9, 2018
1 parent d5b8938 commit 4247e09
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 13 deletions.
4 changes: 2 additions & 2 deletions libmscore/cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3329,7 +3329,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert)
int curPitch = 60;
if (is.segment()) {
Staff* staff = Score::staff(is.track() / VOICES);
Segment* seg = is.segment()->prev1(SegmentType::ChordRest | SegmentType::Clef);
Segment* seg = is.segment()->prev1(SegmentType::ChordRest | SegmentType::Clef | SegmentType::HeaderClef);
while (seg) {
if (seg->isChordRestType()) {
Element* p = seg->element(is.track());
Expand All @@ -3338,7 +3338,7 @@ void Score::cmdAddPitch(const EditData& ed, int note, bool addFlag, bool insert)
break;
}
}
else if (seg->isClefType()) {
else if (seg->isClefType() || seg->isHeaderClefType()) {
Element* p = seg->element( (is.track() / VOICES) * VOICES); // clef on voice 1
if (p && p->isClef()) {
Clef* clef = toClef(p);
Expand Down
22 changes: 18 additions & 4 deletions libmscore/scoreElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,33 @@ ScoreElement::~ScoreElement()
// propertyDefault
//---------------------------------------------------------

QVariant ScoreElement::propertyDefault(Pid pid, Tid tid) const
{
for (const StyledProperty& spp : *textStyle(tid)) {
if (spp.pid == pid) {
if (propertyType(pid) == P_TYPE::SP_REAL)
return score()->styleP(spp.sid);
return score()->styleV(spp.sid);
}
}
return QVariant();
}

//---------------------------------------------------------
// propertyDefault
//---------------------------------------------------------

QVariant ScoreElement::propertyDefault(Pid pid) const
{
QVariant v;
for (const StyledProperty& spp : *_elementStyle) {
if (spp.pid == pid) {
if (propertyType(pid) == P_TYPE::SP_REAL)
return score()->styleP(spp.sid);
return score()->styleV(spp.sid);
}
}
if (!v.isValid())
qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name());
return v;
qDebug("<%s>(%d) not found in <%s>", propertyQmlName(pid), int(pid), name());
return QVariant();
}

//---------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions libmscore/scoreElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ class ScoreElement {
virtual bool setProperty(Pid, const QVariant&) = 0;
virtual QVariant propertyDefault(Pid) const;
virtual void resetProperty(Pid id);
QVariant propertyDefault(Pid pid, Tid tid) const;

virtual void reset(); // reset all properties & position to default

Expand Down
12 changes: 5 additions & 7 deletions libmscore/tuplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1057,13 +1057,11 @@ QVariant Tuplet::propertyDefault(Pid id) const
case Pid::P2:
return QPointF();
default:
for (const StyledProperty& p : *textStyle(Tid::DEFAULT)) {
if (p.pid == id) {
if (propertyType(id) == P_TYPE::SP_REAL)
return score()->styleP(p.sid);
return score()->styleV(p.sid);
}
}
{
QVariant v = ScoreElement::propertyDefault(id, Tid::DEFAULT);
if (v.isValid())
return v;
}
return DurationElement::propertyDefault(id);
}
}
Expand Down

0 comments on commit 4247e09

Please sign in to comment.