Skip to content

Commit

Permalink
Merge pull request #73 from lasconic/18128-add-straight-arpeggio
Browse files Browse the repository at this point in the history
fix #18128: add straight arpeggio line up and down
  • Loading branch information
lasconic committed Sep 12, 2012
2 parents 4b0d55a + 89897f8 commit 92e7737
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions libmscore/arpeggio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void Arpeggio::layout()
default:
setbbox(QRectF(0.0, y1, symbols[score()->symIdx()][arpeggioSym].width(magS()), y2-y1));
return;
case ARP_UP_STRAIGHT:
case ARP_DOWN_STRAIGHT:
setbbox(QRectF(0.0, y1, symbols[score()->symIdx()][close11arrowHeadSym].width(magS()), y2-y1));
return;
case ARP_BRACKET:
{
qreal lw = score()->styleS(ST_ArpeggioLineWidth).val() * _spatium;
Expand All @@ -119,6 +123,7 @@ void Arpeggio::draw(QPainter* p) const
p->setPen(curColor());
qreal y1 = _spatium - _userLen1.val() * _spatium;
qreal y2 = _height + (_userLen2.val() + .5) * _spatium;
qreal x1;
switch (subtype()) {
case ARP_NORMAL:
for (qreal y = y1; y < y2; y += _spatium)
Expand All @@ -137,6 +142,29 @@ void Arpeggio::draw(QPainter* p) const
symbols[score()->symIdx()][arpeggioarrowdownSym].draw(p, 1.0, QPointF(0.0, y));
}
break;
case ARP_UP_STRAIGHT:
y1-= _spatium * .5;
x1 = _spatium * .5;
symbols[score()->symIdx()][close11arrowHeadSym].draw(p, 1.0, QPointF(x1, y1 - (_spatium * .5)));
p->save();
p->setPen(QPen(curColor(),
score()->styleS(ST_ArpeggioLineWidth).val() * _spatium,
Qt::SolidLine, Qt::RoundCap));
p->drawLine(QLineF(x1, y1, x1, y2));
p->restore();
break;
case ARP_DOWN_STRAIGHT:
y1-= _spatium;
y2-= _spatium * .5;
x1 = _spatium * .5;
symbols[score()->symIdx()][close1M1arrowHeadSym].draw(p, 1.0, QPointF(x1, y2 + (_spatium * .5)));
p->save();
p->setPen(QPen(curColor(),
score()->styleS(ST_ArpeggioLineWidth).val() * _spatium,
Qt::SolidLine, Qt::RoundCap));
p->drawLine(QLineF(x1, y1, x1, y2));
p->restore();
break;
case ARP_BRACKET:
{
y1 = - _userLen1.val() * _spatium;
Expand Down
2 changes: 1 addition & 1 deletion libmscore/arpeggio.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Chord;
class QPainter;

enum ArpeggioType {
ARP_NORMAL, ARP_UP, ARP_DOWN, ARP_BRACKET
ARP_NORMAL, ARP_UP, ARP_DOWN, ARP_BRACKET, ARP_UP_STRAIGHT, ARP_DOWN_STRAIGHT
};

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion mscore/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ Palette* MuseScore::newArpeggioPalette()
sp->setGrid(27, 60);
sp->setDrawGrid(true);

for (int i = 0; i < 4; ++i) {
for (int i = 0; i < 6; ++i) {
Arpeggio* a = new Arpeggio(gscore);
a->setSubtype(ArpeggioType(i));
sp->append(a, tr("Arpeggio"));
Expand Down

0 comments on commit 92e7737

Please sign in to comment.