diff --git a/libmscore/ottava.cpp b/libmscore/ottava.cpp index 1cdc3b180b..adf0bf8a8d 100644 --- a/libmscore/ottava.cpp +++ b/libmscore/ottava.cpp @@ -30,8 +30,12 @@ namespace Ms { void OttavaSegment::layout() { TextLineSegment::layout1(); - if (parent()) // for palette - rypos() += score()->styleS(ST_ottavaY).val() * spatium(); + if (parent()) { // for palette + Spatium yo(score()->styleS(ST_ottavaY)); + if (ottava()->placement() == BELOW) + yo = -yo + Spatium(4); // TODO: does only work for 5 line staves + rypos() += yo.val() * spatium(); + } adjustReadPos(); } @@ -75,6 +79,7 @@ QVariant OttavaSegment::propertyDefault(P_ID id) const case P_LINE_WIDTH: case P_LINE_STYLE: case P_OTTAVA_TYPE: + case P_PLACEMENT: return ottava()->propertyDefault(id); default: return TextLineSegment::propertyDefault(id); @@ -137,6 +142,7 @@ Ottava::Ottava(Score* s) lineWidthStyle = PropertyStyle::STYLED; setLineStyle(Qt::PenStyle(score()->styleI(ST_ottavaLineStyle))); lineStyleStyle = PropertyStyle::STYLED; + setPlacement(ABOVE); } //--------------------------------------------------------- @@ -320,6 +326,9 @@ QVariant Ottava::propertyDefault(P_ID propertyId) const case P_LINE_STYLE: return int(score()->styleI(ST_ottavaLineStyle)); + case P_PLACEMENT: + return ABOVE; + default: return TextLine::propertyDefault(propertyId); } @@ -340,7 +349,10 @@ void Ottava::undoSetOttavaType(OttavaType val) void Ottava::setYoff(qreal val) { - rUserYoffset() += (val - score()->styleS(ST_ottavaY).val()) * spatium(); + Spatium yo(score()->styleS(ST_ottavaY)); + if (placement() == BELOW) + yo = -yo + Spatium(4); // TODO: does only work for 5 line staves + rUserYoffset() += (val - yo.val()) * spatium(); } //--------------------------------------------------------- diff --git a/mscore/inspector/inspectorOttava.cpp b/mscore/inspector/inspectorOttava.cpp index 139884894a..39cf2185ff 100644 --- a/mscore/inspector/inspectorOttava.cpp +++ b/mscore/inspector/inspectorOttava.cpp @@ -41,7 +41,8 @@ InspectorOttava::InspectorOttava(QWidget* parent) { P_LINE_WIDTH, 0, 0, l.lineWidth, l.resetLineWidth }, { P_LINE_STYLE, 0, 0, l.lineStyle, l.resetLineStyle }, // tl missing - { P_OTTAVA_TYPE, 0, 0, o.ottavaType, o.resetOttavaType } + { P_OTTAVA_TYPE, 0, 0, o.ottavaType, o.resetOttavaType }, + { P_PLACEMENT, 0, 0, o.placement, o.resetPlacement } }; mapSignals(); diff --git a/mscore/inspector/inspector_ottava.ui b/mscore/inspector/inspector_ottava.ui index 258e1ecd4a..02e6bd0395 100644 --- a/mscore/inspector/inspector_ottava.ui +++ b/mscore/inspector/inspector_ottava.ui @@ -6,8 +6,8 @@ 0 0 - 287 - 68 + 244 + 85 @@ -63,30 +63,6 @@ 0 - - - - - 8va - - - - - 15ma - - - - - 8vb - - - - - 15mb - - - - @@ -114,6 +90,71 @@ + + + + Placement + + + + + + + + 8va + + + + + 15ma + + + + + 8vb + + + + + 15mb + + + + + + + + + above + + + + + below + + + + + + + + reset value + + + ... + + + + :/data/icons/resetproperty.png:/data/icons/resetproperty.png + + + + 14 + 14 + + + + diff --git a/mscore/menus.cpp b/mscore/menus.cpp index 04848a68e8..cf0d91a89d 100644 --- a/mscore/menus.cpp +++ b/mscore/menus.cpp @@ -756,11 +756,13 @@ Palette* MuseScore::newLinesPalette() ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::OTTAVA_8VB); ottava->setLen(w); + ottava->setPlacement(Element::BELOW); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "8vb")); ottava = new Ottava(gscore); ottava->setOttavaType(Ottava::OTTAVA_15MB); ottava->setLen(w); + ottava->setPlacement(Element::BELOW); sp->append(ottava, QT_TRANSLATE_NOOP("Palette", "15mb")); Pedal* pedal = new Pedal(gscore);