diff --git a/libmscore/glissando.cpp b/libmscore/glissando.cpp index 5d6bf2b70d..e12eb60f8a 100644 --- a/libmscore/glissando.cpp +++ b/libmscore/glissando.cpp @@ -195,7 +195,7 @@ QVariant GlissandoSegment::propertyDefault(Pid id) const // propertyFlags //--------------------------------------------------------- -PropertyFlags& GlissandoSegment::propertyFlags(Pid id) +PropertyFlags GlissandoSegment::propertyFlags(Pid id) const { switch (id) { case Pid::FONT_FACE: diff --git a/libmscore/glissando.h b/libmscore/glissando.h index 193b8dbf23..17307686c6 100644 --- a/libmscore/glissando.h +++ b/libmscore/glissando.h @@ -42,7 +42,7 @@ class GlissandoSegment final : public LineSegment { virtual QVariant getProperty(Pid id) const override; virtual bool setProperty(Pid propertyId, const QVariant&) override; virtual QVariant propertyDefault(Pid id) const override; - virtual PropertyFlags& propertyFlags(Pid) override; + virtual PropertyFlags propertyFlags(Pid) const override; virtual void setPropertyFlags(Pid id, PropertyFlags f) override; virtual Sid getPropertyStyle(Pid) const override; }; diff --git a/libmscore/ottava.cpp b/libmscore/ottava.cpp index 35e05de715..27ded9ba5d 100644 --- a/libmscore/ottava.cpp +++ b/libmscore/ottava.cpp @@ -21,6 +21,7 @@ #include "staff.h" #include "segment.h" #include "sym.h" +#include "musescoreCore.h" namespace Ms { @@ -29,22 +30,19 @@ namespace Ms { //--------------------------------------------------------- struct OttavaDefault { - SymId id; - SymId numbersOnlyId; - qreal hookDirection; - Placement place; + OttavaType type; int shift; const char* name; }; // order is important, should be the same as OttavaType static const OttavaDefault ottavaDefault[] = { - { SymId::ottavaAlta, SymId::ottava, 1.0, Placement::ABOVE, 12, "8va" }, - { SymId::ottavaBassaBa, SymId::ottava, -1.0, Placement::BELOW, -12, "8vb" }, - { SymId::quindicesimaAlta, SymId::quindicesima, 1.0, Placement::ABOVE, 24, "15ma" }, - { SymId::quindicesimaBassa, SymId::quindicesima, -1.0, Placement::BELOW, -24, "15mb" }, - { SymId::ventiduesimaAlta, SymId::ventiduesima, 1.0, Placement::ABOVE, 36, "22ma" }, - { SymId::ventiduesimaBassa, SymId::ventiduesima, -1.0, Placement::BELOW, -36, "22mb" } + { OttavaType::OTTAVA_8VA, 12, "8va" }, + { OttavaType::OTTAVA_8VB, -12, "8vb" }, + { OttavaType::OTTAVA_15MA, 24, "15ma" }, + { OttavaType::OTTAVA_15MB, -24, "15mb" }, + { OttavaType::OTTAVA_22MA, 36, "22ma" }, + { OttavaType::OTTAVA_22MB, -36, "22mb" } }; //--------------------------------------------------------- @@ -53,14 +51,19 @@ static const OttavaDefault ottavaDefault[] = { void OttavaSegment::layout() { - if (autoplace()) - setUserOff(QPointF()); - TextLineBaseSegment::layout(); if (parent()) { - qreal yo = score()->styleP(ottava()->placeBelow() ? Sid::ottavaPosBelow : Sid::ottavaPosAbove) * mag(); - rypos() += yo; + qreal y; + if (placeAbove()) { + y = score()->styleP(Sid::ottavaPosAbove); + } + else { + qreal sh = ottava()->staff() ? ottava()->staff()->height() : 0; + y = score()->styleP(Sid::ottavaPosBelow) + sh; + } + rypos() = y; if (autoplace()) { + setUserOff(QPointF()); qreal minDistance = spatium() * .7; Shape s1 = shape().translated(pos()); if (ottava()->placeAbove()) { @@ -89,6 +92,7 @@ QVariant OttavaSegment::getProperty(Pid id) const } switch (id) { case Pid::OTTAVA_TYPE: + case Pid::NUMBERS_ONLY: return spanner()->getProperty(id); default: return TextLineBaseSegment::getProperty(id); @@ -107,6 +111,7 @@ bool OttavaSegment::setProperty(Pid id, const QVariant& v) } switch (id) { case Pid::OTTAVA_TYPE: + case Pid::NUMBERS_ONLY: return spanner()->setProperty(id, v); default: return TextLineBaseSegment::setProperty(id, v); @@ -125,12 +130,110 @@ QVariant OttavaSegment::propertyDefault(Pid id) const } switch (id) { case Pid::OTTAVA_TYPE: + case Pid::NUMBERS_ONLY: return spanner()->propertyDefault(id); default: return TextLineBaseSegment::propertyDefault(id); } } +//--------------------------------------------------------- +// updateStyledProperties +// some properties change styling +//--------------------------------------------------------- + +void Ottava::updateStyledProperties() + { + Q_ASSERT(int(OttavaType::OTTAVA_22MB) - int(OttavaType::OTTAVA_8VA) == 5); + + static const Sid ss[24] = { + Sid::ottava8VAPlacement, + Sid::ottava8VAnoText, + Sid::ottava8VBPlacement, + Sid::ottava8VBnoText, + Sid::ottava15MAPlacement, + Sid::ottava15MAnoText, + Sid::ottava15MBPlacement, + Sid::ottava15MBnoText, + Sid::ottava22MAPlacement, + Sid::ottava22MAnoText, + Sid::ottava22MBPlacement, + Sid::ottava22MBnoText, + + Sid::ottava8VAPlacement, + Sid::ottava8VAText, + Sid::ottava8VBPlacement, + Sid::ottava8VBText, + Sid::ottava15MAPlacement, + Sid::ottava15MAText, + Sid::ottava15MBPlacement, + Sid::ottava15MBText, + Sid::ottava22MAPlacement, + Sid::ottava22MAText, + Sid::ottava22MBPlacement, + Sid::ottava22MBText, + }; + + // switch right substyles depending on _ottavaType and _numbersOnly + + StyledProperty* spl = _styledProperties.data(); + int idx = int(_ottavaType) * 2 + (_numbersOnly ? 0 : 12); + spl[0].sid = ss[idx]; // PLACEMENT + spl[2].sid = ss[idx+1]; // BEGIN_TEXT + spl[3].sid = ss[idx+1]; // CONTINUE_TEXT + if (isStyled(Pid::PLACEMENT)) + spl[4].sid = score()->styleI(ss[idx]) == int(Placement::ABOVE) ? Sid::ottavaHookAbove : Sid::ottavaHookBelow; + else + spl[4].sid = placeAbove() ? Sid::ottavaHookAbove : Sid::ottavaHookBelow; + styleChanged(); // this changes all styled properties with flag STYLED + MuseScoreCore::mscoreCore->updateInspector(); + } + +//--------------------------------------------------------- +// setOttavaType +//--------------------------------------------------------- + +void Ottava::setOttavaType(OttavaType val) + { + _ottavaType = val; + updateStyledProperties(); + } + +//--------------------------------------------------------- +// setNumbersOnly +//--------------------------------------------------------- + +void Ottava::setNumbersOnly(bool val) + { + _numbersOnly = val; + updateStyledProperties(); + } + +//--------------------------------------------------------- +// setPlacement +//--------------------------------------------------------- + +void Ottava::setPlacement(Placement p) + { + TextLineBase::setPlacement(p); + updateStyledProperties(); + } + +//--------------------------------------------------------- +// undoChangeProperty +//--------------------------------------------------------- + +void OttavaSegment::undoChangeProperty(Pid id, const QVariant& v, PropertyFlags ps) + { + if (id == Pid::OTTAVA_TYPE || id == Pid::NUMBERS_ONLY || id == Pid::PLACEMENT) { + ScoreElement::undoChangeProperty(id, v, ps); + ottava()->updateStyledProperties(); + } + else { + ScoreElement::undoChangeProperty(id, v, ps); + } + } + //--------------------------------------------------------- // Ottava //--------------------------------------------------------- @@ -139,37 +242,31 @@ Ottava::Ottava(Score* s) : TextLineBase(s, ElementFlag::ON_STAFF | ElementFlag::MOVABLE) { _ottavaType = OttavaType::OTTAVA_8VA; + _styledProperties = ottavaStyle; // make copy + setBeginTextPlace(PlaceText::LEFT); setContinueTextPlace(PlaceText::LEFT); + setEndHookType(HookType::HOOK_90); setLineVisible(true); + initSubStyle(SubStyleId::OTTAVA); } Ottava::Ottava(const Ottava& o) : TextLineBase(o) { + _styledProperties = o._styledProperties; setOttavaType(o._ottavaType); _numbersOnly = o._numbersOnly; - _pitchShift = o._pitchShift; } //--------------------------------------------------------- -// setOttavaType +// pitchShift //--------------------------------------------------------- -void Ottava::setOttavaType(OttavaType val) +int Ottava::pitchShift() const { - _ottavaType = val; - - const OttavaDefault* def = &ottavaDefault[int(_ottavaType)]; - setBeginText(propertyDefault(Pid::BEGIN_TEXT).toString()); - setContinueText(propertyDefault(Pid::CONTINUE_TEXT).toString()); - - setEndHookType(HookType::HOOK_90); - setEndHookHeight(score()->styleS(Sid::ottavaHook) * def->hookDirection); - - setPlacement(def->place); - _pitchShift = def->shift; + return ottavaDefault[int(_ottavaType)].shift; } //--------------------------------------------------------- @@ -190,7 +287,6 @@ void Ottava::write(XmlWriter& xml) const if (!xml.canWrite(this)) return; xml.stag(QString("%1 id=\"%2\"").arg(name()).arg(xml.spannerId(this))); -// writeProperty(xml, Pid::NUMBERS_ONLY); xml.tag("subtype", ottavaDefault[int(ottavaType())].name); for (const StyledProperty* spp = styledProperties(); spp->sid != Sid::NOSTYLE; ++spp) @@ -211,6 +307,7 @@ void Ottava::read(XmlReader& e) e.addSpanner(e.intAttribute("id", -1), this); while (e.readNextStartElement()) readProperties(e); + updateStyledProperties(); } //--------------------------------------------------------- @@ -225,10 +322,10 @@ bool Ottava::readProperties(XmlReader& e) bool ok; int idx = s.toInt(&ok); if (!ok) { - idx = int(OttavaType::OTTAVA_8VA); + _ottavaType = OttavaType::OTTAVA_8VA; for (unsigned i = 0; i < sizeof(ottavaDefault)/sizeof(*ottavaDefault); ++i) { if (s == ottavaDefault[i].name) { - idx = i; + _ottavaType = ottavaDefault[i].type; break; } } @@ -239,9 +336,11 @@ bool Ottava::readProperties(XmlReader& e) idx = 2; else if (idx == 2) idx = 1; + _ottavaType = OttavaType(idx); } - setOttavaType(OttavaType(idx)); } + else if (readStyledProperty(e, tag)) + return true; else if (!TextLineBase::readProperties(e)) { e.unknown(); return false; @@ -249,15 +348,6 @@ bool Ottava::readProperties(XmlReader& e) return true; } -//--------------------------------------------------------- -// undoSetOttavaType -//--------------------------------------------------------- - -void Ottava::undoSetOttavaType(OttavaType val) - { - undoChangeProperty(Pid::OTTAVA_TYPE, int(val)); - } - //--------------------------------------------------------- // setYoff // used in musicxml import @@ -277,8 +367,10 @@ QVariant Ottava::getProperty(Pid propertyId) const switch (propertyId) { case Pid::OTTAVA_TYPE: return int(ottavaType()); + case Pid::NUMBERS_ONLY: return _numbersOnly; + default: break; } @@ -296,18 +388,8 @@ bool Ottava::setProperty(Pid propertyId, const QVariant& val) setOttavaType(OttavaType(val.toInt())); break; - case Pid::PLACEMENT: - if (val != getProperty(propertyId)) { - // reverse hooks - // setBeginHookHeight(-beginHookHeight()); - setEndHookHeight(-endHookHeight()); - } - setPlacement(Placement(val.toInt())); - break; - case Pid::NUMBERS_ONLY: - setNumbersOnly(val.toBool()); - setOttavaType(_ottavaType); + _numbersOnly = val.toBool(); break; case Pid::SPANNER_TICKS: @@ -340,24 +422,14 @@ QVariant Ottava::propertyDefault(Pid propertyId) const return QVariant(); case Pid::END_HOOK_TYPE: return int(HookType::HOOK_90); - case Pid::PLACEMENT: - return int(ottavaDefault[int(_ottavaType)].place); - case Pid::END_HOOK_HEIGHT: - return score()->styleS(Sid::ottavaHook) * ottavaDefault[int(_ottavaType)].hookDirection; - case Pid::BEGIN_TEXT: - case Pid::CONTINUE_TEXT: { - const OttavaDefault* def = &ottavaDefault[int(_ottavaType)]; - SymId id = _numbersOnly ? def->numbersOnlyId : def->id; - return QString("%1").arg(Sym::id2name(id)); - } case Pid::LINE_VISIBLE: return true; - default: QVariant v = ScoreElement::styledPropertyDefault(propertyId); if (v.isValid()) return v; return getProperty(propertyId); + } } diff --git a/libmscore/ottava.h b/libmscore/ottava.h index 68bd67c548..838e608524 100644 --- a/libmscore/ottava.h +++ b/libmscore/ottava.h @@ -48,6 +48,8 @@ class Ottava; //--------------------------------------------------------- class OttavaSegment final : public TextLineBaseSegment { + virtual void undoChangeProperty(Pid id, const QVariant&, PropertyFlags ps) override; + public: OttavaSegment(Score* s) : TextLineBaseSegment(s, ElementFlag::MOVABLE) { } virtual ElementType type() const override { return ElementType::OTTAVA_SEGMENT; } @@ -65,10 +67,11 @@ class OttavaSegment final : public TextLineBaseSegment { //--------------------------------------------------------- class Ottava final : public TextLineBase { + std::vector _styledProperties; OttavaType _ottavaType; bool _numbersOnly; - int _pitchShift; + void updateStyledProperties(); protected: friend class OttavaSegment; @@ -79,15 +82,19 @@ class Ottava final : public TextLineBase { virtual Ottava* clone() const override { return new Ottava(*this); } virtual ElementType type() const override { return ElementType::OTTAVA; } + virtual const StyledProperty* styledProperties() const override { return _styledProperties.data(); } + StyledProperty* styledProperties() { return _styledProperties.data(); } + void setOttavaType(OttavaType val); OttavaType ottavaType() const { return _ottavaType; } - void undoSetOttavaType(OttavaType val); bool numbersOnly() const { return _numbersOnly; } - void setNumbersOnly(bool val) { _numbersOnly = val; } + void setNumbersOnly(bool val); + + void setPlacement(Placement); virtual LineSegment* createLineSegment() override; - int pitchShift() const { return _pitchShift; } + int pitchShift() const; virtual void write(XmlWriter& xml) const override; virtual void read(XmlReader& de) override; diff --git a/libmscore/read206.cpp b/libmscore/read206.cpp index 57a14ad408..91a5bba2fa 100644 --- a/libmscore/read206.cpp +++ b/libmscore/read206.cpp @@ -226,7 +226,8 @@ struct StyleVal2 { { Sid::voltaLineWidth, QVariant(.1) }, { Sid::voltaLineStyle, QVariant(int(Qt::SolidLine)) }, { Sid::ottavaPosAbove, QVariant(-3.0) }, - { Sid::ottavaHook, QVariant(1.9) }, + { Sid::ottavaHookAbove, QVariant(1.9) }, + { Sid::ottavaHookBelow, QVariant(-1.9) }, { Sid::ottavaLineWidth, QVariant(.1) }, { Sid::ottavaLineStyle, QVariant(int(Qt::DashLine)) }, { Sid::ottavaNumbersOnly, true }, diff --git a/libmscore/score.h b/libmscore/score.h index 2c4aeeb966..82f5f0dfd6 100644 --- a/libmscore/score.h +++ b/libmscore/score.h @@ -819,8 +819,9 @@ class Score : public QObject, public ScoreElement { qreal styleD(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"double")); return style().value(idx).toDouble(); } int styleI(Sid idx) const { Q_ASSERT(!strcmp(MStyle::valueType(idx),"int")); return style().value(idx).toInt(); } + void setStyleValue(Sid sid, QVariant value) { style().set(sid, value); } qreal spatium() const { return styleD(Sid::spatium); } - void setSpatium(qreal v) { style().set(Sid::spatium, v); } + void setSpatium(qreal v) { setStyleValue(Sid::spatium, v); } bool genCourtesyTimesig() const { return styleB(Sid::genCourtesyTimesig); } bool genCourtesyClef() const { return styleB(Sid::genCourtesyClef); } diff --git a/libmscore/scoreElement.cpp b/libmscore/scoreElement.cpp index 10e91e6048..77c506044d 100644 --- a/libmscore/scoreElement.cpp +++ b/libmscore/scoreElement.cpp @@ -16,6 +16,7 @@ #include "xml.h" #include "bracket.h" #include "bracketItem.h" +#include "spanner.h" namespace Ms { @@ -230,14 +231,14 @@ void ScoreElement::initSubStyle(SubStyleId ssid) // resetProperty //--------------------------------------------------------- -void ScoreElement::resetProperty(Pid id) +void ScoreElement::resetProperty(Pid pid) { - QVariant v = propertyDefault(id); + QVariant v = propertyDefault(pid); if (v.isValid()) { - setProperty(id, v); - PropertyFlags& p = propertyFlags(id); + setProperty(pid, v); + PropertyFlags p = propertyFlags(pid); if (p != PropertyFlags::NOSTYLE) - p = PropertyFlags::STYLED; + setPropertyFlags(pid, PropertyFlags::STYLED); } } @@ -254,6 +255,34 @@ void ScoreElement::undoResetProperty(Pid id) undoChangeProperty(id, propertyDefault(id), f); } +//--------------------------------------------------------- +// isStyled +//--------------------------------------------------------- + +bool ScoreElement::isStyled(Pid pid) const + { + PropertyFlags f = propertyFlags(pid); + return f == PropertyFlags::STYLED; + } + +//--------------------------------------------------------- +// changeProperty +//--------------------------------------------------------- + +static void changeProperty(ScoreElement* e, Pid t, const QVariant& st, PropertyFlags ps) + { + if (e->isSpannerSegment()) + e = toSpannerSegment(e)->spanner(); + if (e->getProperty(t) != st || e->propertyFlags(t) != ps) { + if (e->isBracketItem()) { + BracketItem* bi = toBracketItem(e); + e->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps)); + } + else + e->score()->undo(new ChangeProperty(e, t, st, ps)); + } + } + //--------------------------------------------------------- // changeProperties //--------------------------------------------------------- @@ -261,27 +290,11 @@ void ScoreElement::undoResetProperty(Pid id) static void changeProperties(ScoreElement* e, Pid t, const QVariant& st, PropertyFlags ps) { if (propertyLink(t)) { - for (ScoreElement* ee : e->linkList()) { - if (ee->getProperty(t) != st || ee->propertyFlags(t) != ps) { - if (ee->isBracketItem()) { - BracketItem* bi = toBracketItem(ee); - ee->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps)); - } - else - ee->score()->undo(new ChangeProperty(ee, t, st, ps)); - } - } - } - else { - if (e->getProperty(t) != st || e->propertyFlags(t) != ps) { - if (e->isBracketItem()) { - BracketItem* bi = toBracketItem(e); - e->score()->undo(new ChangeBracketProperty(bi->staff(), bi->column(), t, st, ps)); - } - else - e->score()->undo(new ChangeProperty(e, t, st, ps)); - } + for (ScoreElement* ee : e->linkList()) + changeProperty(ee, t, st, ps); } + else + changeProperty(e, t, st, ps); } //--------------------------------------------------------- @@ -550,7 +563,7 @@ MasterScore* ScoreElement::masterScore() const // propertyFlags //--------------------------------------------------------- -PropertyFlags& ScoreElement::propertyFlags(Pid id) +PropertyFlags ScoreElement::propertyFlags(Pid id) const { static PropertyFlags f = PropertyFlags::NOSTYLE; @@ -571,9 +584,16 @@ PropertyFlags& ScoreElement::propertyFlags(Pid id) void ScoreElement::setPropertyFlags(Pid id, PropertyFlags f) { - PropertyFlags& p = propertyFlags(id); - if (p != PropertyFlags::NOSTYLE) - p = f; + const StyledProperty* spl = styledProperties(); + for (int i = 0;;++i) { + const StyledProperty& k = spl[i]; + if (k.sid == Sid::NOSTYLE) + break; + if (k.pid == id) { + propertyFlagsList()[i] = f; + break; + } + } } //--------------------------------------------------------- @@ -600,15 +620,14 @@ Sid ScoreElement::getPropertyStyle(Pid id) const void ScoreElement::styleChanged() { for (const StyledProperty* spp = styledProperties(); spp->sid != Sid::NOSTYLE; ++spp) { - PropertyFlags& f = propertyFlags(spp->pid); + PropertyFlags f = propertyFlags(spp->pid); if (f == PropertyFlags::STYLED) { if (propertyType(spp->pid) == P_TYPE::SP_REAL) { qreal val = score()->styleP(spp->sid); setProperty(spp->pid, val); } - else { + else setProperty(spp->pid, score()->styleV(spp->sid)); - } } } } diff --git a/libmscore/scoreElement.h b/libmscore/scoreElement.h index 3b2e5afa69..d5de699210 100644 --- a/libmscore/scoreElement.h +++ b/libmscore/scoreElement.h @@ -202,8 +202,9 @@ class ScoreElement { void setSubStyleId(SubStyleId); void initSubStyle(SubStyleId); virtual const StyledProperty* styledProperties() const { return subStyle(_subStyleId).data(); } - virtual PropertyFlags* propertyFlagsList() { return _propertyFlagsList; } - virtual PropertyFlags& propertyFlags(Pid); + virtual PropertyFlags* propertyFlagsList() const { return _propertyFlagsList; } + virtual PropertyFlags propertyFlags(Pid) const; + bool isStyled(Pid pid) const; virtual void setPropertyFlags(Pid, PropertyFlags); diff --git a/libmscore/spanner.cpp b/libmscore/spanner.cpp index 6aa07fc85d..7d11996ac7 100644 --- a/libmscore/spanner.cpp +++ b/libmscore/spanner.cpp @@ -132,7 +132,7 @@ Sid SpannerSegment::getPropertyStyle(Pid id) const // propertyFlags //--------------------------------------------------------- -PropertyFlags& SpannerSegment::propertyFlags(Pid id) +PropertyFlags SpannerSegment::propertyFlags(Pid id) const { return spanner()->propertyFlags(id); } diff --git a/libmscore/spanner.h b/libmscore/spanner.h index e124d989d1..edf6018630 100644 --- a/libmscore/spanner.h +++ b/libmscore/spanner.h @@ -93,7 +93,7 @@ class SpannerSegment : public Element { virtual bool setProperty(Pid id, const QVariant& v) override; virtual QVariant propertyDefault(Pid id) const override; virtual Sid getPropertyStyle(Pid id) const override; - virtual PropertyFlags& propertyFlags(Pid id) override; + virtual PropertyFlags propertyFlags(Pid id) const override; virtual void resetProperty(Pid id) override; virtual void styleChanged() override; void reset() override; diff --git a/libmscore/style.cpp b/libmscore/style.cpp index 758d1ee74b..3c9cb0f65b 100644 --- a/libmscore/style.cpp +++ b/libmscore/style.cpp @@ -323,10 +323,31 @@ static const StyleType styleTypes[] { { Sid::voltaAlign, "voltaAlign", QVariant::fromValue(Align::LEFT | Align::BASELINE) }, { Sid::voltaOffset, "voltaOffset", QPointF(0.5, 1.9) }, - { Sid::ottavaPlacement, "ottavaPlacement", int(Placement::ABOVE) }, + { Sid::ottava8VAPlacement, "ottava8VAPlacement", int(Placement::ABOVE) }, + { Sid::ottava8VBPlacement, "ottava8VBPlacement", int(Placement::BELOW) }, + { Sid::ottava15MAPlacement, "ottava15MAPlacement", int(Placement::ABOVE) }, + { Sid::ottava15MBPlacement, "ottava15MBPlacement", int(Placement::BELOW) }, + { Sid::ottava22MAPlacement, "ottava22MAPlacement", int(Placement::ABOVE) }, + { Sid::ottava22MBPlacement, "ottava22MBPlacement", int(Placement::BELOW) }, + + { Sid::ottava8VAText, "ottava8VAText", QString("ottavaAlta") }, + { Sid::ottava8VBText, "ottava8VBText", QString("ottavaBassaBa") }, + { Sid::ottava15MAText, "ottava15MAText", QString("quindicesimaAlta") }, + { Sid::ottava15MBText, "ottava15MBText", QString("quindicesimaBassa") }, + { Sid::ottava22MAText, "ottava22MAText", QString("ventiduesimaAlta") }, + { Sid::ottava22MBText, "ottava22MBText", QString("ventiduesimaBassa") }, + + { Sid::ottava8VAnoText, "ottava8VAnoText", QString("ottava") }, + { Sid::ottava8VBnoText, "ottava8VBnoText", QString("ottava") }, + { Sid::ottava15MAnoText, "ottava15MAnoText", QString("quindicesima") }, + { Sid::ottava15MBnoText, "ottava15MBnoText", QString("quindicesima") }, + { Sid::ottava22MAnoText, "ottava22MAnoText", QString("ventiduesima") }, + { Sid::ottava22MBnoText, "ottava22MBnoText", QString("ventiduesima") }, + { Sid::ottavaPosAbove, "ottavaPosAbove", Spatium(-3.0) }, { Sid::ottavaPosBelow, "ottavaPosBelow", Spatium(3.0) }, - { Sid::ottavaHook, "ottavaHook", Spatium(1.9) }, + { Sid::ottavaHookAbove, "ottavaHookAbove", Spatium(1.9) }, + { Sid::ottavaHookBelow, "ottavaHookBelow", Spatium(-1.9) }, { Sid::ottavaLineWidth, "ottavaLineWidth", Spatium(.1) }, { Sid::ottavaLineStyle, "ottavaLineStyle", QVariant(int(Qt::DashLine)) }, { Sid::ottavaNumbersOnly, "ottavaNumbersOnly", true }, @@ -878,7 +899,6 @@ const std::vector lyricistStyle { { Sid::lyricistAlign, Pid::ALIGN }, { Sid::lyricistOffset, Pid::OFFSET }, { Sid::lyricistOffsetType, Pid::OFFSET_TYPE }, -// { Sid::lyricistPlacement, Pid::PLACEMENT }, { Sid::NOSTYLE, Pid::END } // end of list marker }; @@ -892,18 +912,6 @@ const std::vector lyricsStyle { { Sid::lyricsPlacement, Pid::PLACEMENT }, { Sid::NOSTYLE, Pid::END } // end of list marker }; -#if 0 -const std::vector lyricsEvenStyle { - { Sid::lyricsEvenFontFace, Pid::FONT_FACE }, - { Sid::lyricsEvenFontSize, Pid::FONT_SIZE }, - { Sid::lyricsEvenFontBold, Pid::FONT_BOLD }, - { Sid::lyricsEvenFontItalic, Pid::FONT_ITALIC }, - { Sid::lyricsEvenFontUnderline, Pid::FONT_UNDERLINE }, - { Sid::lyricsEvenAlign, Pid::ALIGN }, - { Sid::lyricsPlacement, Pid::PLACEMENT }, - { Sid::NOSTYLE, Pid::END } // end of list marker - }; -#endif const std::vector fingeringStyle { { Sid::fingeringFontFace, Pid::FONT_FACE }, @@ -1202,7 +1210,11 @@ const std::vector glissandoStyle { }; const std::vector ottavaStyle { + { Sid::ottava8VAPlacement, Pid::PLACEMENT }, { Sid::ottavaNumbersOnly, Pid::NUMBERS_ONLY }, + { Sid::ottava8VAText, Pid::BEGIN_TEXT }, + { Sid::ottava8VAText, Pid::CONTINUE_TEXT }, + { Sid::ottavaHookAbove, Pid::END_HOOK_HEIGHT }, { Sid::ottavaFontFace, Pid::BEGIN_FONT_FACE }, { Sid::ottavaFontFace, Pid::CONTINUE_FONT_FACE }, { Sid::ottavaFontFace, Pid::END_FONT_FACE }, @@ -1223,7 +1235,6 @@ const std::vector ottavaStyle { { Sid::ottavaTextAlign, Pid::END_TEXT_ALIGN }, { Sid::ottavaLineWidth, Pid::LINE_WIDTH }, { Sid::ottavaLineStyle, Pid::LINE_STYLE }, - { Sid::ottavaPlacement, Pid::PLACEMENT }, { Sid::NOSTYLE, Pid::END } // end of list marker }; diff --git a/libmscore/style.h b/libmscore/style.h index 78edd93238..56b3f434e7 100644 --- a/libmscore/style.h +++ b/libmscore/style.h @@ -300,10 +300,31 @@ enum class Sid { voltaAlign, voltaOffset, - ottavaPlacement, + ottava8VAPlacement, + ottava8VBPlacement, + ottava15MAPlacement, + ottava15MBPlacement, + ottava22MAPlacement, + ottava22MBPlacement, + + ottava8VAText, + ottava8VBText, + ottava15MAText, + ottava15MBText, + ottava22MAText, + ottava22MBText, + + ottava8VAnoText, + ottava8VBnoText, + ottava15MAnoText, + ottava15MBnoText, + ottava22MAnoText, + ottava22MBnoText, + ottavaPosAbove, ottavaPosBelow, - ottavaHook, + ottavaHookAbove, + ottavaHookBelow, ottavaLineWidth, ottavaLineStyle, ottavaNumbersOnly, @@ -887,6 +908,7 @@ extern const SubStyle emptyStyle; extern const SubStyle defaultStyle; extern const SubStyle fingeringStyle; extern const SubStyle lyricsStyle; +extern const SubStyle ottavaStyle; const SubStyle& subStyle(SubStyleId); const SubStyle& subStyle(const char*); diff --git a/libmscore/textline.cpp b/libmscore/textline.cpp index e9a12c4721..4f61c15152 100644 --- a/libmscore/textline.cpp +++ b/libmscore/textline.cpp @@ -129,23 +129,7 @@ QVariant TextLine::getProperty(Pid propertyId) const bool TextLine::setProperty(Pid propertyId, const QVariant& val) { - switch (propertyId) { - case Pid::PLACEMENT: - if (val != getProperty(propertyId)) { - // reverse hooks - setBeginHookHeight(-beginHookHeight()); - setEndHookHeight(-endHookHeight()); - } - TextLineBase::setProperty(propertyId, val); - break; - - default: - if (!TextLineBase::setProperty(propertyId, val)) - return false; - break; - } - score()->setLayoutAll(); - return true; + return TextLineBase::setProperty(propertyId, val); } //--------------------------------------------------------- diff --git a/mscore/editstyle.cpp b/mscore/editstyle.cpp index 6a3a89dc7e..bef8052cb4 100644 --- a/mscore/editstyle.cpp +++ b/mscore/editstyle.cpp @@ -229,7 +229,8 @@ EditStyle::EditStyle(Score* s, QWidget* parent) { Sid::ottavaPosAbove, false, ottavaPosAbove, resetOttavaPosAbove }, { Sid::ottavaPosBelow, false, ottavaPosBelow, resetOttavaPosBelow }, - { Sid::ottavaHook, false, ottavaHook, resetOttavaHook }, + { Sid::ottavaHookAbove, false, ottavaHookAbove, resetOttavaHookAbove }, + { Sid::ottavaHookBelow, false, ottavaHookBelow, resetOttavaHookBelow }, { Sid::ottavaLineWidth, false, ottavaLineWidth, resetOttavaLineWidth }, { Sid::pedalPlacement, false, pedalLinePlacement, resetPedalLinePlacement }, diff --git a/mscore/editstyle.ui b/mscore/editstyle.ui index 663ba2cf39..c33ad943ca 100644 --- a/mscore/editstyle.ui +++ b/mscore/editstyle.ui @@ -191,7 +191,7 @@ - 4 + 15 @@ -6224,7 +6224,7 @@ - + Line thickness: @@ -6247,7 +6247,7 @@ - + sp @@ -6257,14 +6257,14 @@ - Hook height: + Hook height Above: - ottavaHook + ottavaHookAbove - + @@ -6294,7 +6294,7 @@ - + sp @@ -6310,7 +6310,7 @@ - + Qt::Vertical @@ -6323,7 +6323,7 @@ - + Line style: @@ -6334,7 +6334,7 @@ - + 0 @@ -6356,7 +6356,7 @@ - + @@ -6379,7 +6379,7 @@ - + @@ -6494,6 +6494,46 @@ + + + + Hook height Below: + + + ottavaHookAbove + + + + + + + sp + + + + + + + + 0 + 0 + + + + Reset to default + + + Reset 'Hook height' value + + + + + + + :/data/icons/edit-reset.svg:/data/icons/edit-reset.svg + + + diff --git a/mscore/inspector/inspectorOttava.cpp b/mscore/inspector/inspectorOttava.cpp index 421fa8588f..20322a972b 100644 --- a/mscore/inspector/inspectorOttava.cpp +++ b/mscore/inspector/inspectorOttava.cpp @@ -71,7 +71,7 @@ InspectorOttava::InspectorOttava(QWidget* parent) { Pid::END_HOOK_TYPE, 0, tl.endHookType, tl.resetEndHookType }, { Pid::END_HOOK_HEIGHT, 0, tl.endHookHeight, tl.resetEndHookHeight }, - { Pid::OTTAVA_TYPE, 0, o.ottavaType, o.resetOttavaType }, + { Pid::OTTAVA_TYPE, 0, o.ottavaType, 0 }, { Pid::PLACEMENT, 0, o.placement, o.resetPlacement }, { Pid::NUMBERS_ONLY, 0, o.numbersOnly, o.resetNumbersOnly } }; diff --git a/mscore/inspector/inspector_ottava.ui b/mscore/inspector/inspector_ottava.ui index 642da67c42..6cef74e727 100644 --- a/mscore/inspector/inspector_ottava.ui +++ b/mscore/inspector/inspector_ottava.ui @@ -6,8 +6,8 @@ 0 0 - 150 - 113 + 183 + 129 @@ -86,23 +86,6 @@ - - - - Reset to default - - - Reset 'Type' value - - - - - - - :/data/icons/edit-reset.svg:/data/icons/edit-reset.svg - - - @@ -222,7 +205,6 @@ title ottavaType - resetOttavaType placement resetPlacement numbersOnly