Skip to content

Commit

Permalink
add simple system bracket
Browse files Browse the repository at this point in the history
  • Loading branch information
lasconic committed May 15, 2013
1 parent e965f09 commit 61ae46d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
23 changes: 23 additions & 0 deletions libmscore/bracket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ void Bracket::layout()
qreal h = (-y + h2) * 2;
bbox().setRect(x, y, w, h);
}
else if (bracketType() == BRACKET_SIMPLE) {
qreal _spatium = spatium();
qreal w = score()->styleS(ST_bracketWidth).val() * _spatium * .5;
qreal x = -w;
w += 1 * spatium();
qreal h = h2 * 2;
bbox().setRect(x, 0.0, w, h);
}
}

//---------------------------------------------------------
Expand Down Expand Up @@ -143,6 +151,16 @@ void Bracket::draw(QPainter* painter) const
symbols[idx][brackettipsRightUp].draw(painter, mags, QPointF(x, y1));
symbols[idx][brackettipsRightDown].draw(painter, mags, QPointF(x, y2));
}
else if (bracketType() == BRACKET_SIMPLE) {
qreal h = 2 * h2;
qreal _spatium = spatium();
qreal w = score()->styleS(ST_staffLineWidth).val() * _spatium;
QPen pen(curColor(), w, Qt::SolidLine, Qt::SquareCap);
painter->setPen(pen);
painter->drawLine(QLineF(0.0, 0.0, 0.0, h));
painter->drawLine(QLineF(0.0, 0.0, w + spatium() , 0.0));
painter->drawLine(QLineF(0.0, h , w + spatium(), h));
}
}

//---------------------------------------------------------
Expand All @@ -158,6 +176,9 @@ void Bracket::write(Xml& xml) const
case BRACKET_NORMAL:
xml.stag("Bracket");
break;
case BRACKET_SIMPLE:
xml.stag("Bracket type=\"Simple\"");
break;
case NO_BRACKET:
break;
}
Expand All @@ -179,6 +200,8 @@ void Bracket::read(XmlReader& e)
setBracketType(BRACKET_NORMAL);
else if (t == "Akkolade")
setBracketType(BRACKET_AKKOLADE);
else if (t == "Simple")
setBracketType(BRACKET_SIMPLE);
else
qDebug("unknown brace type <%s>", qPrintable(t));

Expand Down
2 changes: 1 addition & 1 deletion libmscore/mscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ enum ArticulationType {
//---------------------------------------------------------

enum BracketType {
BRACKET_NORMAL, BRACKET_AKKOLADE, NO_BRACKET = -1
BRACKET_NORMAL, BRACKET_AKKOLADE, BRACKET_SIMPLE, NO_BRACKET = -1
};

//---------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions mscore/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,12 @@ Palette* MuseScore::newBracketsPalette()
b1->setBracketType(BRACKET_NORMAL);
Bracket* b2 = new Bracket(gscore);
b2->setBracketType(BRACKET_AKKOLADE);
Bracket* b3 = new Bracket(gscore);
b3->setBracketType(BRACKET_SIMPLE);

sp->append(b1, tr("Square bracket"));
sp->append(b2, tr("Curly bracket"));
sp->append(b3, tr("Simple bracket"));

return sp;
}
Expand Down

0 comments on commit 61ae46d

Please sign in to comment.