MuseScore/libmscore/systemtext.cpp

73 lines
2.2 KiB
C++
Raw Normal View History

2017-01-20 11:05:52 +01:00
//=============================================================================
// MuseScore
// Music Composition & Notation
//
// Copyright (C) 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 "systemtext.h"
namespace Ms {
//---------------------------------------------------------
// systemStyle
//---------------------------------------------------------
2018-08-01 11:46:07 +02:00
static const ElementStyle systemStyle {
{ Sid::systemTextPlacement, Pid::PLACEMENT },
2019-05-06 20:41:21 +02:00
{ Sid::systemTextMinDistance, Pid::MIN_DISTANCE },
2018-08-01 11:46:07 +02:00
};
2017-01-20 11:05:52 +01:00
//---------------------------------------------------------
// SystemText
//---------------------------------------------------------
SystemText::SystemText(Score* s, Tid tid)
: StaffTextBase(s, tid, ElementFlag::SYSTEM | ElementFlag::MOVABLE | ElementFlag::ON_STAFF)
2017-01-23 10:54:57 +01:00
{
2018-08-01 11:46:07 +02:00
initElementStyle(&systemStyle);
2017-01-23 10:54:57 +01:00
}
2017-01-20 11:05:52 +01:00
//---------------------------------------------------------
// propertyDefault
//---------------------------------------------------------
2018-03-27 15:36:00 +02:00
QVariant SystemText::propertyDefault(Pid id) const
2017-01-20 11:05:52 +01:00
{
switch (id) {
2018-03-27 15:36:00 +02:00
case Pid::SUB_STYLE:
2018-08-01 11:46:07 +02:00
return int(Tid::SYSTEM);
2017-01-20 11:05:52 +01:00
default:
2017-12-27 11:51:00 +01:00
return TextBase::propertyDefault(id);
2017-01-20 11:05:52 +01:00
}
}
//---------------------------------------------------------
// layout
//---------------------------------------------------------
void SystemText::layout()
{
TextBase::layout();
autoplaceSegmentElement();
}
//---------------------------------------------------------
// getPropertyStyle
//---------------------------------------------------------
Sid SystemText::getPropertyStyle(Pid pid) const
{
if (pid == Pid::OFFSET)
return placeAbove() ? Sid::systemTextPosAbove : Sid::systemTextPosBelow;
return TextBase::getPropertyStyle(pid);
}
2017-01-20 11:05:52 +01:00
} // namespace Ms