MuseScore/libmscore/notedot.cpp

74 lines
2.1 KiB
C++
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2002-2011 Werner Schweer
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2
// as published by the Free Software Foundation and appearing in
// the file LICENCE.GPL
//=============================================================================
#include "notedot.h"
#include "score.h"
#include "staff.h"
//---------------------------------------------------------
// NoteDot
//---------------------------------------------------------
NoteDot::NoteDot(Score* s)
: Element(s)
{
setFlag(ELEMENT_MOVABLE, false);
}
//---------------------------------------------------------
// layout
// height() and width() should return sensible
// values when calling this method
//---------------------------------------------------------
void NoteDot::layout()
{
setbbox(symbols[score()->symIdx()][dotSym].bbox(magS()));
}
//---------------------------------------------------------
// NoteDot::draw
//---------------------------------------------------------
void NoteDot::draw(QPainter* p) const
{
if (!staff()->isTabStaff() || ((StaffTypeTablature*)staff()->staffType())->stemThrough()) {
2012-05-26 14:26:10 +02:00
p->setPen(curColor());
symbols[score()->symIdx()][dotSym].draw(p, magS());
}
}
//---------------------------------------------------------
// write
//---------------------------------------------------------
void NoteDot::write(Xml& xml) const
{
xml.stag(name());
Element::writeProperties(xml);
xml.etag();
}
//---------------------------------------------------------
// read
//---------------------------------------------------------
2013-01-11 18:10:18 +01:00
void NoteDot::read(XmlReader& e)
2012-05-26 14:26:10 +02:00
{
2013-01-11 18:10:18 +01:00
while (e.readNextStartElement()) {
if (e.name() == "name") // obsolete
e.readElementText();
2012-05-26 14:26:10 +02:00
else if (!Element::readProperties(e))
2013-01-11 18:10:18 +01:00
e.unknown();
2012-05-26 14:26:10 +02:00
}
}