implement placement above/below for ottava

This commit is contained in:
ws 2013-08-09 14:44:15 +02:00
parent 302b2927a7
commit 42695f0b9b
4 changed files with 86 additions and 30 deletions

View file

@ -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();
}
//---------------------------------------------------------

View file

@ -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();

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>287</width>
<height>68</height>
<width>244</width>
<height>85</height>
</rect>
</property>
<property name="windowTitle">
@ -63,30 +63,6 @@
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="ottavaType">
<item>
<property name="text">
<string>8va</string>
</property>
</item>
<item>
<property name="text">
<string>15ma</string>
</property>
</item>
<item>
<property name="text">
<string>8vb</string>
</property>
</item>
<item>
<property name="text">
<string>15mb</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -114,6 +90,71 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Placement</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="ottavaType">
<item>
<property name="text">
<string>8va</string>
</property>
</item>
<item>
<property name="text">
<string>15ma</string>
</property>
</item>
<item>
<property name="text">
<string>8vb</string>
</property>
</item>
<item>
<property name="text">
<string>15mb</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="placement">
<item>
<property name="text">
<string>above</string>
</property>
</item>
<item>
<property name="text">
<string>below</string>
</property>
</item>
</widget>
</item>
<item row="1" column="3">
<widget class="QToolButton" name="resetPlacement">
<property name="toolTip">
<string>reset value</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../musescore.qrc">
<normaloff>:/data/icons/resetproperty.png</normaloff>:/data/icons/resetproperty.png</iconset>
</property>
<property name="iconSize">
<size>
<width>14</width>
<height>14</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View file

@ -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);