Merge pull request #295 from softins/harmony-text

Harmony text
This commit is contained in:
Werner Schweer 2013-04-17 01:38:43 -07:00
commit 8d59be4247
4 changed files with 9 additions and 2 deletions

View file

@ -104,6 +104,7 @@ Harmony::Harmony(Score* s)
: Text(s)
{
setTextStyleType(TEXT_STYLE_HARMONY);
setUnstyled();
_rootTpc = INVALID_TPC;
_baseTpc = INVALID_TPC;
_id = -1;
@ -370,6 +371,8 @@ void Harmony::startEdit(MuseScoreView* view, const QPointF& p)
bool Harmony::edit(MuseScoreView* view, int grip, int key, Qt::KeyboardModifiers mod, const QString& s)
{
if (key == Qt::Key_Return)
return true; // Harmony only single line
bool rv = Text::edit(view, grip, key, mod, s);
QString str = text();
int root, base;

View file

@ -266,9 +266,8 @@ void Text::layout1()
else if (align() & ALIGN_HCENTER)
o.rx() -= (size.width() * .5);
bbox().setRect(0.0, 0.0, size.width(), size.height());
bbox().setRect(o.x(), o.y(), size.width(), size.height());
_doc->setModified(false);
setPos(o);
}
if (parent()) {
Element* e = parent();
@ -358,7 +357,9 @@ void Text::draw(QPainter* painter) const
return;
c.palette.setColor(QPalette::Text, textColor());
painter->translate(bbox().topLeft());
_doc->documentLayout()->draw(painter, c);
painter->translate(-bbox().topLeft());
}
//---------------------------------------------------------

View file

@ -585,6 +585,7 @@ void Debugger::updateElement(Element* el)
case Element::JUMP:
case Element::TEXT:
case Element::STAFF_TEXT:
case Element::HARMONY:
ew = new TextView;
break;
case Element::TRILL_SEGMENT:

View file

@ -1717,6 +1717,8 @@ void ScoreView::paint(const QRect& r, QPainter& p)
e = e->parent();
Text* text = static_cast<Text*>(editObject);
QRectF r = text->pageRectangle().translated(e->pos()); // abbox();
qreal w = 2.0 / matrix().m11(); // give the frame some padding, like in 1.3
r.adjust(-w,-w,w,w);
p.setPen(QPen(QBrush(Qt::lightGray), 2.0 / matrix().m11())); // 2 pixel pen size
p.setBrush(QBrush(Qt::NoBrush));
p.drawRect(r);