MuseScore/libmscore/fingering.cpp

74 lines
1.9 KiB
C++
Raw Normal View History

2012-05-26 14:26:10 +02:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 2010-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 "fingering.h"
#include "score.h"
#include "undo.h"
//---------------------------------------------------------
// Fingering
//---------------------------------------------------------
Fingering::Fingering(Score* s)
: Text(s)
{
2012-10-25 16:21:07 +02:00
setTextStyleType(TEXT_STYLE_FINGERING);
2012-05-26 14:26:10 +02:00
setFlag(ELEMENT_HAS_TAG, true);
}
//---------------------------------------------------------
// layout
//---------------------------------------------------------
void Fingering::layout()
{
Text::layout();
2012-09-22 21:23:37 +02:00
setPos(QPointF());
2012-05-26 14:26:10 +02:00
}
//---------------------------------------------------------
// write
//---------------------------------------------------------
void Fingering::write(Xml& xml) const
{
xml.stag(name());
Text::writeProperties(xml);
xml.etag();
}
//---------------------------------------------------------
// read
//---------------------------------------------------------
2013-01-11 18:10:18 +01:00
void Fingering::read(XmlReader& e)
2012-05-26 14:26:10 +02:00
{
2013-01-11 18:10:18 +01:00
while (e.readNextStartElement()) {
2012-05-26 14:26:10 +02:00
if (!Text::readProperties(e))
2013-01-11 18:10:18 +01:00
e.unknown();
2012-05-26 14:26:10 +02:00
}
}
//---------------------------------------------------------
2012-11-19 10:08:15 +01:00
// reset
2012-05-26 14:26:10 +02:00
//---------------------------------------------------------
2012-11-19 10:08:15 +01:00
void Fingering::reset()
2012-05-26 14:26:10 +02:00
{
QPointF o(userOff());
score()->layoutFingering(this);
QPointF no(userOff());
setUserOff(o);
2012-08-23 17:40:04 +02:00
score()->undoChangeProperty(this, P_USER_OFF, no);
2012-05-26 14:26:10 +02:00
}
2012-09-22 21:23:37 +02:00