small fixes for save/restore barlines

This commit is contained in:
Werner Schweer 2016-12-28 17:20:02 +01:00
parent c411e79809
commit 22454df70e
5 changed files with 18 additions and 22 deletions

View file

@ -349,6 +349,11 @@ void BarLine::draw(QPainter* painter) const
painter->setPen(pen); painter->setPen(pen);
switch (barLineType()) { switch (barLineType()) {
case BarLineType::UNKNOWN:
case BarLineType::NORMAL:
painter->drawLine(QLineF(lw, y1, lw, y2));
break;
case BarLineType::BROKEN: case BarLineType::BROKEN:
pen.setStyle(Qt::DashLine); pen.setStyle(Qt::DashLine);
painter->setPen(pen); painter->setPen(pen);
@ -359,10 +364,6 @@ void BarLine::draw(QPainter* painter) const
pen.setStyle(Qt::DotLine); pen.setStyle(Qt::DotLine);
painter->setPen(pen); painter->setPen(pen);
case BarLineType::NORMAL:
painter->drawLine(QLineF(lw, y1, lw, y2));
break;
case BarLineType::END: case BarLineType::END:
{ {
qreal lw2 = score()->styleP(StyleIdx::endBarWidth) * _mag; qreal lw2 = score()->styleP(StyleIdx::endBarWidth) * _mag;
@ -511,7 +512,7 @@ void BarLine::write(XmlWriter& xml) const
void BarLine::read(XmlReader& e) void BarLine::read(XmlReader& e)
{ {
resetProperty(P_ID::BARLINE_TYPE); // resetProperty(P_ID::BARLINE_TYPE);
resetProperty(P_ID::BARLINE_SPAN); resetProperty(P_ID::BARLINE_SPAN);
resetProperty(P_ID::BARLINE_SPAN_FROM); resetProperty(P_ID::BARLINE_SPAN_FROM);
resetProperty(P_ID::BARLINE_SPAN_TO); resetProperty(P_ID::BARLINE_SPAN_TO);
@ -965,9 +966,7 @@ qreal BarLine::layoutWidth(Score* score, BarLineType type, qreal mag)
case BarLineType::BROKEN: case BarLineType::BROKEN:
case BarLineType::NORMAL: case BarLineType::NORMAL:
case BarLineType::DOTTED: case BarLineType::DOTTED:
break; case BarLineType::UNKNOWN:
default:
qDebug("illegal barline type %d", int(type));
break; break;
} }
return dw; return dw;

View file

@ -62,7 +62,7 @@ class BarLine : public Element {
char _spanStaff { false }; // span barline to next staff if true char _spanStaff { false }; // span barline to next staff if true
char _spanFrom { 0 }; // line number on start and end staves char _spanFrom { 0 }; // line number on start and end staves
char _spanTo { 0 }; char _spanTo { 0 };
BarLineType _barLineType { BarLineType::NORMAL }; BarLineType _barLineType { BarLineType::UNKNOWN };
mutable qreal y1; mutable qreal y1;
mutable qreal y2; mutable qreal y2;
ElementList _el; ///< fermata or other articulations ElementList _el; ///< fermata or other articulations

View file

@ -1861,7 +1861,6 @@ void Measure::read(XmlReader& e, int staffIdx)
else if (tag == "BarLine") { else if (tag == "BarLine") {
BarLine* barLine = new BarLine(score()); BarLine* barLine = new BarLine(score());
barLine->setTrack(e.track()); barLine->setTrack(e.track());
barLine->read(e);
// //
// StartRepeatBarLine: at rtick == 0, always BarLineType::START_REPEAT // StartRepeatBarLine: at rtick == 0, always BarLineType::START_REPEAT
@ -1889,6 +1888,7 @@ void Measure::read(XmlReader& e, int staffIdx)
segment = getSegmentR(st, t); segment = getSegmentR(st, t);
segment->add(barLine); segment->add(barLine);
} }
barLine->read(e);
barLine->layout(); barLine->layout();
} }
else if (tag == "Chord") { else if (tag == "Chord") {
@ -3341,7 +3341,7 @@ qreal Measure::createEndBarLines(bool isLastMeasureInSystem)
// and its not a repeat start/end barline (forced) // and its not a repeat start/end barline (forced)
if (bl->barLineType() != t) { if (bl->barLineType() != t) {
if (bl->generated()) if (bl->generated() || bl->barLineType() == BarLineType::UNKNOWN)
bl->setBarLineType(t); bl->setBarLineType(t);
else { else {
if (force) { if (force) {

View file

@ -371,6 +371,7 @@ MS_QML_ENUM(TextStyleType, signed char,\
//--------------------------------------------------------- //---------------------------------------------------------
MS_QML_ENUM(BarLineType, int,\ MS_QML_ENUM(BarLineType, int,\
UNKNOWN = 0,
NORMAL = 1,\ NORMAL = 1,\
DOUBLE = 2,\ DOUBLE = 2,\
START_REPEAT = 4,\ START_REPEAT = 4,\

View file

@ -162,16 +162,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QSpinBox" name="span">
<property name="accessibleName">
<string>Span</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QToolButton" name="resetSpan"> <widget class="QToolButton" name="resetSpan">
<property name="toolTip"> <property name="toolTip">
@ -289,6 +279,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="span">
<property name="text">
<string>Span to next staff</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -297,7 +294,6 @@
<tabstops> <tabstops>
<tabstop>type</tabstop> <tabstop>type</tabstop>
<tabstop>resetType</tabstop> <tabstop>resetType</tabstop>
<tabstop>span</tabstop>
<tabstop>resetSpan</tabstop> <tabstop>resetSpan</tabstop>
<tabstop>spanFrom</tabstop> <tabstop>spanFrom</tabstop>
<tabstop>resetSpanFrom</tabstop> <tabstop>resetSpanFrom</tabstop>