fix Spatium/QVariant conversions
This commit is contained in:
parent
a96c0abf5b
commit
9db0540ad2
14 changed files with 77 additions and 46 deletions
|
@ -28,7 +28,7 @@ static const NoteHead::Group NOTEHEADGROUP_DEFAULT = NoteHead::Group::HEAD_NORM
|
||||||
static const NoteHead::Type NOTEHEADTYPE_DEFAULT = NoteHead::Type::HEAD_AUTO;
|
static const NoteHead::Type NOTEHEADTYPE_DEFAULT = NoteHead::Type::HEAD_AUTO;
|
||||||
static const MScore::DirectionH DIR_DEFAULT = MScore::DirectionH::AUTO;
|
static const MScore::DirectionH DIR_DEFAULT = MScore::DirectionH::AUTO;
|
||||||
static const bool HASLINE_DEFAULT = true;
|
static const bool HASLINE_DEFAULT = true;
|
||||||
static const qreal LINEWIDTH_DEFAULT = 0.12;
|
static const Spatium LINEWIDTH_DEFAULT(0.12);
|
||||||
#if 0 // yet(?) unused
|
#if 0 // yet(?) unused
|
||||||
static const qreal LEDGEROFFSET_DEFAULT = 0.25;
|
static const qreal LEDGEROFFSET_DEFAULT = 0.25;
|
||||||
#endif
|
#endif
|
||||||
|
@ -206,7 +206,7 @@ void Ambitus::read(XmlReader& e)
|
||||||
else if (tag == "hasLine")
|
else if (tag == "hasLine")
|
||||||
setHasLine(e.readInt());
|
setHasLine(e.readInt());
|
||||||
else if (tag == "lineWidth")
|
else if (tag == "lineWidth")
|
||||||
setProperty(P_ID::LINE_WIDTH, Ms::getProperty(P_ID::LINE_WIDTH, e).toReal());
|
setProperty(P_ID::LINE_WIDTH, Ms::getProperty(P_ID::LINE_WIDTH, e));
|
||||||
else if (tag == "topPitch")
|
else if (tag == "topPitch")
|
||||||
_topPitch = e.readInt();
|
_topPitch = e.readInt();
|
||||||
else if (tag == "bottomPitch")
|
else if (tag == "bottomPitch")
|
||||||
|
@ -406,7 +406,7 @@ void Ambitus::layout()
|
||||||
void Ambitus::draw(QPainter* p) const
|
void Ambitus::draw(QPainter* p) const
|
||||||
{
|
{
|
||||||
qreal _spatium = spatium();
|
qreal _spatium = spatium();
|
||||||
qreal lw = lineWidth() * _spatium;
|
qreal lw = lineWidth().val() * _spatium;
|
||||||
p->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
|
p->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
|
||||||
drawSymbol(noteHead(), p, _topPos);
|
drawSymbol(noteHead(), p, _topPos);
|
||||||
drawSymbol(noteHead(), p, _bottomPos);
|
drawSymbol(noteHead(), p, _bottomPos);
|
||||||
|
@ -635,7 +635,7 @@ bool Ambitus::setProperty(P_ID propertyId, const QVariant& v)
|
||||||
setHasLine(v.toBool());
|
setHasLine(v.toBool());
|
||||||
break;
|
break;
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
setLineWidth(v.toReal());
|
setLineWidth(v.value<Spatium>());
|
||||||
break;
|
break;
|
||||||
case P_ID::TPC1:
|
case P_ID::TPC1:
|
||||||
setTopTpc(v.toInt());
|
setTopTpc(v.toInt());
|
||||||
|
@ -675,7 +675,7 @@ QVariant Ambitus::propertyDefault(P_ID id) const
|
||||||
case P_ID::HEAD_TYPE: return int(NOTEHEADTYPE_DEFAULT);
|
case P_ID::HEAD_TYPE: return int(NOTEHEADTYPE_DEFAULT);
|
||||||
case P_ID::MIRROR_HEAD: return int(DIR_DEFAULT);
|
case P_ID::MIRROR_HEAD: return int(DIR_DEFAULT);
|
||||||
case P_ID::GHOST: return HASLINE_DEFAULT;
|
case P_ID::GHOST: return HASLINE_DEFAULT;
|
||||||
case P_ID::LINE_WIDTH: return LINEWIDTH_DEFAULT;
|
case P_ID::LINE_WIDTH: return Spatium(LINEWIDTH_DEFAULT);
|
||||||
case P_ID::TPC1: // no defaults for pitches, tpc's and octaves
|
case P_ID::TPC1: // no defaults for pitches, tpc's and octaves
|
||||||
case P_ID::FBPARENTHESIS1:
|
case P_ID::FBPARENTHESIS1:
|
||||||
case P_ID::PITCH:
|
case P_ID::PITCH:
|
||||||
|
|
|
@ -32,7 +32,7 @@ class Ambitus : public Element {
|
||||||
NoteHead::Type _noteHeadType;
|
NoteHead::Type _noteHeadType;
|
||||||
MScore::DirectionH _dir;
|
MScore::DirectionH _dir;
|
||||||
bool _hasLine;
|
bool _hasLine;
|
||||||
qreal _lineWidth; // in spatium
|
Spatium _lineWidth;
|
||||||
Accidental _topAccid, _bottomAccid;
|
Accidental _topAccid, _bottomAccid;
|
||||||
int _topPitch, _bottomPitch;
|
int _topPitch, _bottomPitch;
|
||||||
int _topTpc, _bottomTpc;
|
int _topTpc, _bottomTpc;
|
||||||
|
@ -55,7 +55,7 @@ class Ambitus : public Element {
|
||||||
NoteHead::Type noteHeadType() const { return _noteHeadType; }
|
NoteHead::Type noteHeadType() const { return _noteHeadType; }
|
||||||
MScore::DirectionH direction() const { return _dir; }
|
MScore::DirectionH direction() const { return _dir; }
|
||||||
bool hasLine() const { return _hasLine; }
|
bool hasLine() const { return _hasLine; }
|
||||||
qreal lineWidth() const { return _lineWidth; }
|
Spatium lineWidth() const { return _lineWidth; }
|
||||||
int topOctave() const { return _topPitch / 12;}
|
int topOctave() const { return _topPitch / 12;}
|
||||||
int bottomOctave() const { return _bottomPitch / 12;}
|
int bottomOctave() const { return _bottomPitch / 12;}
|
||||||
int topPitch() const { return _topPitch; }
|
int topPitch() const { return _topPitch; }
|
||||||
|
@ -67,7 +67,7 @@ class Ambitus : public Element {
|
||||||
void setNoteHeadType (NoteHead::Type val) { _noteHeadType = val; }
|
void setNoteHeadType (NoteHead::Type val) { _noteHeadType = val; }
|
||||||
void setDirection (MScore::DirectionH val) { _dir = val; }
|
void setDirection (MScore::DirectionH val) { _dir = val; }
|
||||||
void setHasLine (bool val) { _hasLine = val; }
|
void setHasLine (bool val) { _hasLine = val; }
|
||||||
void setLineWidth (qreal val) { _lineWidth = val; }
|
void setLineWidth (Spatium val) { _lineWidth = val; }
|
||||||
void setTopPitch (int val);
|
void setTopPitch (int val);
|
||||||
void setBottomPitch (int val);
|
void setBottomPitch (int val);
|
||||||
void setTopTpc (int val);
|
void setTopTpc (int val);
|
||||||
|
|
|
@ -327,9 +327,9 @@ QVariant Box::getProperty(P_ID propertyId) const
|
||||||
{
|
{
|
||||||
switch(propertyId) {
|
switch(propertyId) {
|
||||||
case P_ID::BOX_HEIGHT:
|
case P_ID::BOX_HEIGHT:
|
||||||
return _boxHeight.val();
|
return _boxHeight;
|
||||||
case P_ID::BOX_WIDTH:
|
case P_ID::BOX_WIDTH:
|
||||||
return _boxWidth.val();
|
return _boxWidth;
|
||||||
case P_ID::TOP_GAP:
|
case P_ID::TOP_GAP:
|
||||||
return _topGap;
|
return _topGap;
|
||||||
case P_ID::BOTTOM_GAP:
|
case P_ID::BOTTOM_GAP:
|
||||||
|
@ -356,10 +356,10 @@ bool Box::setProperty(P_ID propertyId, const QVariant& v)
|
||||||
score()->addRefresh(canvasBoundingRect());
|
score()->addRefresh(canvasBoundingRect());
|
||||||
switch(propertyId) {
|
switch(propertyId) {
|
||||||
case P_ID::BOX_HEIGHT:
|
case P_ID::BOX_HEIGHT:
|
||||||
_boxHeight = Spatium(v.toDouble());
|
_boxHeight = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::BOX_WIDTH:
|
case P_ID::BOX_WIDTH:
|
||||||
_boxWidth = Spatium(v.toDouble());
|
_boxWidth = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::TOP_GAP:
|
case P_ID::TOP_GAP:
|
||||||
_topGap = v.toDouble();
|
_topGap = v.toDouble();
|
||||||
|
@ -395,6 +395,8 @@ QVariant Box::propertyDefault(P_ID id) const
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case P_ID::BOX_HEIGHT:
|
case P_ID::BOX_HEIGHT:
|
||||||
case P_ID::BOX_WIDTH:
|
case P_ID::BOX_WIDTH:
|
||||||
|
return Spatium(0.0);
|
||||||
|
|
||||||
case P_ID::TOP_GAP:
|
case P_ID::TOP_GAP:
|
||||||
case P_ID::BOTTOM_GAP:
|
case P_ID::BOTTOM_GAP:
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
|
|
@ -465,9 +465,9 @@ QVariant Hairpin::getProperty(P_ID id) const
|
||||||
case P_ID::DYNAMIC_RANGE:
|
case P_ID::DYNAMIC_RANGE:
|
||||||
return int(_dynRange);
|
return int(_dynRange);
|
||||||
case P_ID::HAIRPIN_HEIGHT:
|
case P_ID::HAIRPIN_HEIGHT:
|
||||||
return _hairpinHeight.val();
|
return _hairpinHeight;
|
||||||
case P_ID::HAIRPIN_CONT_HEIGHT:
|
case P_ID::HAIRPIN_CONT_HEIGHT:
|
||||||
return _hairpinContHeight.val();
|
return _hairpinContHeight;
|
||||||
default:
|
default:
|
||||||
return TextLine::getProperty(id);
|
return TextLine::getProperty(id);
|
||||||
}
|
}
|
||||||
|
@ -502,11 +502,11 @@ bool Hairpin::setProperty(P_ID id, const QVariant& v)
|
||||||
break;
|
break;
|
||||||
case P_ID::HAIRPIN_HEIGHT:
|
case P_ID::HAIRPIN_HEIGHT:
|
||||||
hairpinHeightStyle = PropertyStyle::UNSTYLED;
|
hairpinHeightStyle = PropertyStyle::UNSTYLED;
|
||||||
_hairpinHeight = Spatium(v.toDouble());
|
_hairpinHeight = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::HAIRPIN_CONT_HEIGHT:
|
case P_ID::HAIRPIN_CONT_HEIGHT:
|
||||||
hairpinContHeightStyle = PropertyStyle::UNSTYLED;
|
hairpinContHeightStyle = PropertyStyle::UNSTYLED;
|
||||||
_hairpinContHeight = Spatium(v.toDouble());
|
_hairpinContHeight = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return TextLine::setProperty(id, v);
|
return TextLine::setProperty(id, v);
|
||||||
|
@ -528,9 +528,9 @@ QVariant Hairpin::propertyDefault(P_ID id) const
|
||||||
case P_ID::HAIRPIN_TYPE: return int(Type::CRESCENDO);
|
case P_ID::HAIRPIN_TYPE: return int(Type::CRESCENDO);
|
||||||
case P_ID::VELO_CHANGE: return 0;
|
case P_ID::VELO_CHANGE: return 0;
|
||||||
case P_ID::DYNAMIC_RANGE: return int(Dynamic::Range::PART);
|
case P_ID::DYNAMIC_RANGE: return int(Dynamic::Range::PART);
|
||||||
case P_ID::LINE_WIDTH: return score()->styleS(StyleIdx::hairpinLineWidth).val();
|
case P_ID::LINE_WIDTH: return score()->style(StyleIdx::hairpinLineWidth);
|
||||||
case P_ID::HAIRPIN_HEIGHT: return score()->styleS(StyleIdx::hairpinHeight).val();
|
case P_ID::HAIRPIN_HEIGHT: return score()->style(StyleIdx::hairpinHeight);
|
||||||
case P_ID::HAIRPIN_CONT_HEIGHT: return score()->styleS(StyleIdx::hairpinContHeight).val();
|
case P_ID::HAIRPIN_CONT_HEIGHT: return score()->style(StyleIdx::hairpinContHeight);
|
||||||
case P_ID::LINE_STYLE: return _useTextLine ? int(Qt::CustomDashLine) : int(Qt::SolidLine);
|
case P_ID::LINE_STYLE: return _useTextLine ? int(Qt::CustomDashLine) : int(Qt::SolidLine);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -561,17 +561,17 @@ void Hairpin::resetProperty(P_ID id)
|
||||||
{
|
{
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
setLineWidth(score()->styleS(StyleIdx::hairpinLineWidth));
|
setProperty(id, propertyDefault(id));
|
||||||
lineWidthStyle = PropertyStyle::STYLED;
|
lineWidthStyle = PropertyStyle::STYLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_ID::HAIRPIN_HEIGHT:
|
case P_ID::HAIRPIN_HEIGHT:
|
||||||
setHairpinHeight(score()->styleS(StyleIdx::hairpinHeight));
|
setProperty(id, propertyDefault(id));
|
||||||
hairpinHeightStyle = PropertyStyle::STYLED;
|
hairpinHeightStyle = PropertyStyle::STYLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case P_ID::HAIRPIN_CONT_HEIGHT:
|
case P_ID::HAIRPIN_CONT_HEIGHT:
|
||||||
setHairpinContHeight(score()->styleS(StyleIdx::hairpinContHeight));
|
setLineWidth(score()->styleS(StyleIdx::hairpinLineWidth));
|
||||||
hairpinContHeightStyle = PropertyStyle::STYLED;
|
hairpinContHeightStyle = PropertyStyle::STYLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -658,7 +658,7 @@ void Hairpin::startEdit(MuseScoreView* view, const QPointF& p)
|
||||||
void Hairpin::endEdit()
|
void Hairpin::endEdit()
|
||||||
{
|
{
|
||||||
if (editHairpinHeight != _hairpinHeight)
|
if (editHairpinHeight != _hairpinHeight)
|
||||||
score()->undoPropertyChanged(this, P_ID::HAIRPIN_HEIGHT, editHairpinHeight.val());
|
score()->undoPropertyChanged(this, P_ID::HAIRPIN_HEIGHT, editHairpinHeight);
|
||||||
TextLine::endEdit();
|
TextLine::endEdit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1084,7 +1084,7 @@ QVariant SLine::getProperty(P_ID id) const
|
||||||
case P_ID::LINE_COLOR:
|
case P_ID::LINE_COLOR:
|
||||||
return _lineColor;
|
return _lineColor;
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
return _lineWidth.val();
|
return _lineWidth;
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
return QVariant(int(_lineStyle));
|
return QVariant(int(_lineStyle));
|
||||||
default:
|
default:
|
||||||
|
@ -1106,7 +1106,7 @@ bool SLine::setProperty(P_ID id, const QVariant& v)
|
||||||
_lineColor = v.value<QColor>();
|
_lineColor = v.value<QColor>();
|
||||||
break;
|
break;
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
_lineWidth = Spatium(v.toDouble());
|
_lineWidth = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
_lineStyle = Qt::PenStyle(v.toInt());
|
_lineStyle = Qt::PenStyle(v.toInt());
|
||||||
|
@ -1129,7 +1129,7 @@ QVariant SLine::propertyDefault(P_ID id) const
|
||||||
case P_ID::LINE_COLOR:
|
case P_ID::LINE_COLOR:
|
||||||
return MScore::defaultColor;
|
return MScore::defaultColor;
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
return 0.15;
|
return Spatium(0.15);
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
return int(Qt::SolidLine);
|
return int(Qt::SolidLine);
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include "stemslash.h"
|
#include "stemslash.h"
|
||||||
#include "fraction.h"
|
#include "fraction.h"
|
||||||
#include "excerpt.h"
|
#include "excerpt.h"
|
||||||
|
#include "spatium.h"
|
||||||
|
|
||||||
namespace Ms {
|
namespace Ms {
|
||||||
|
|
||||||
|
@ -152,12 +153,20 @@ void Direction::fillComboBox(QComboBox* cb)
|
||||||
cb->addItem(qApp->translate("Direction", "down"), int(DOWN));
|
cb->addItem(qApp->translate("Direction", "down"), int(DOWN));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Spatium doubleToSpatium(double d) { return Spatium(d); }
|
||||||
|
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// init
|
// init
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
|
|
||||||
void MScore::init()
|
void MScore::init()
|
||||||
{
|
{
|
||||||
|
if (!QMetaType::registerConverter<Spatium, double>(&Spatium::toDouble))
|
||||||
|
qFatal("registerConverter Spatium::toDouble failed");
|
||||||
|
if (!QMetaType::registerConverter<double, Spatium>(&doubleToSpatium))
|
||||||
|
qFatal("registerConverter douobleToSpatium failed");
|
||||||
|
|
||||||
|
|
||||||
#ifdef SCRIPT_INTERFACE
|
#ifdef SCRIPT_INTERFACE
|
||||||
qRegisterMetaType<Element::Type> ("ElementType");
|
qRegisterMetaType<Element::Type> ("ElementType");
|
||||||
qRegisterMetaType<Note::ValueType> ("ValueType");
|
qRegisterMetaType<Note::ValueType> ("ValueType");
|
||||||
|
|
|
@ -393,7 +393,7 @@ QVariant Ottava::propertyDefault(P_ID propertyId) const
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
return score()->styleS(StyleIdx::ottavaLineWidth).val();
|
return score()->style(StyleIdx::ottavaLineWidth);
|
||||||
|
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
return int(score()->styleI(StyleIdx::ottavaLineStyle));
|
return int(score()->styleI(StyleIdx::ottavaLineStyle));
|
||||||
|
@ -402,7 +402,7 @@ QVariant Ottava::propertyDefault(P_ID propertyId) const
|
||||||
return int(ottavaDefault[int(_ottavaType)].place);
|
return int(ottavaDefault[int(_ottavaType)].place);
|
||||||
|
|
||||||
case P_ID::END_HOOK_HEIGHT:
|
case P_ID::END_HOOK_HEIGHT:
|
||||||
return score()->styleS(StyleIdx::ottavaHook).val() * ottavaDefault[int(_ottavaType)].hookDirection;
|
return score()->style(StyleIdx::ottavaHook).value<Spatium>() * ottavaDefault[int(_ottavaType)].hookDirection;
|
||||||
|
|
||||||
case P_ID::NUMBERS_ONLY:
|
case P_ID::NUMBERS_ONLY:
|
||||||
return score()->styleB(StyleIdx::ottavaNumbersOnly);
|
return score()->styleB(StyleIdx::ottavaNumbersOnly);
|
||||||
|
@ -488,7 +488,7 @@ void Ottava::resetProperty(P_ID id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
setLineWidth(score()->styleS(StyleIdx::ottavaLineWidth));
|
setLineWidth(score()->style(StyleIdx::ottavaLineWidth).value<Spatium>());
|
||||||
lineWidthStyle = PropertyStyle::STYLED;
|
lineWidthStyle = PropertyStyle::STYLED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ QVariant Pedal::propertyDefault(P_ID propertyId) const
|
||||||
{
|
{
|
||||||
switch (propertyId) {
|
switch (propertyId) {
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
return score()->styleS(StyleIdx::pedalLineWidth).val();
|
return score()->style(StyleIdx::pedalLineWidth);
|
||||||
|
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
return int(score()->styleI(StyleIdx::pedalLineStyle));
|
return int(score()->styleI(StyleIdx::pedalLineStyle));
|
||||||
|
|
|
@ -856,7 +856,8 @@ void Segment::read(XmlReader& e)
|
||||||
QVariant Segment::getProperty(P_ID propertyId) const
|
QVariant Segment::getProperty(P_ID propertyId) const
|
||||||
{
|
{
|
||||||
switch(propertyId) {
|
switch(propertyId) {
|
||||||
case P_ID::LEADING_SPACE: return extraLeadingSpace().val();
|
case P_ID::LEADING_SPACE:
|
||||||
|
return extraLeadingSpace();
|
||||||
default:
|
default:
|
||||||
return Element::getProperty(propertyId);
|
return Element::getProperty(propertyId);
|
||||||
}
|
}
|
||||||
|
@ -869,7 +870,7 @@ QVariant Segment::getProperty(P_ID propertyId) const
|
||||||
QVariant Segment::propertyDefault(P_ID propertyId) const
|
QVariant Segment::propertyDefault(P_ID propertyId) const
|
||||||
{
|
{
|
||||||
switch(propertyId) {
|
switch(propertyId) {
|
||||||
case P_ID::LEADING_SPACE: return 0.0;
|
case P_ID::LEADING_SPACE: return Spatium(0.0);
|
||||||
default:
|
default:
|
||||||
return Element::getProperty(propertyId);
|
return Element::getProperty(propertyId);
|
||||||
}
|
}
|
||||||
|
@ -882,7 +883,10 @@ QVariant Segment::propertyDefault(P_ID propertyId) const
|
||||||
bool Segment::setProperty(P_ID propertyId, const QVariant& v)
|
bool Segment::setProperty(P_ID propertyId, const QVariant& v)
|
||||||
{
|
{
|
||||||
switch (propertyId) {
|
switch (propertyId) {
|
||||||
case P_ID::LEADING_SPACE: setExtraLeadingSpace(Spatium(v.toDouble())); break;
|
case P_ID::LEADING_SPACE:
|
||||||
|
setExtraLeadingSpace(v.value<Spatium>());
|
||||||
|
score()->setLayout(tick());
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return Element::setProperty(propertyId, v);
|
return Element::setProperty(propertyId, v);
|
||||||
}
|
}
|
||||||
|
@ -1406,8 +1410,12 @@ qreal Segment::minHorizontalDistance(Segment* ns) const
|
||||||
w += spatium() * 1.5;
|
w += spatium() * 1.5;
|
||||||
if (w < 0.0)
|
if (w < 0.0)
|
||||||
w = 0.0;
|
w = 0.0;
|
||||||
if (ns)
|
if (ns) {
|
||||||
|
qreal ls = ns->extraLeadingSpace().val() * spatium();
|
||||||
|
if (ls != 0.0)
|
||||||
|
printf("extra space %f\n", ls);
|
||||||
w += ns->extraLeadingSpace().val() * spatium();
|
w += ns->extraLeadingSpace().val() * spatium();
|
||||||
|
}
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ class Spatium {
|
||||||
Spatium() { _val = 0.0; }
|
Spatium() { _val = 0.0; }
|
||||||
explicit Spatium(qreal v) { _val = v; }
|
explicit Spatium(qreal v) { _val = v; }
|
||||||
qreal val() const { return _val; }
|
qreal val() const { return _val; }
|
||||||
|
|
||||||
bool operator>(const Spatium& a) const { return _val > a._val; }
|
bool operator>(const Spatium& a) const { return _val > a._val; }
|
||||||
bool operator<(const Spatium& a) const { return _val < a._val; }
|
bool operator<(const Spatium& a) const { return _val < a._val; }
|
||||||
bool operator==(const Spatium& a) const { return _val == a._val; }
|
bool operator==(const Spatium& a) const { return _val == a._val; }
|
||||||
|
@ -60,6 +61,8 @@ class Spatium {
|
||||||
}
|
}
|
||||||
Spatium operator-() const { return Spatium(-_val); }
|
Spatium operator-() const { return Spatium(-_val); }
|
||||||
operator QVariant() const { return QVariant::fromValue(*this); }
|
operator QVariant() const { return QVariant::fromValue(*this); }
|
||||||
|
|
||||||
|
static double toDouble(const Spatium& v) { return v._val; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Spatium operator+(const Spatium& a, const Spatium& b)
|
inline Spatium operator+(const Spatium& a, const Spatium& b)
|
||||||
|
|
|
@ -714,7 +714,7 @@ void MStyle::load(XmlReader& e)
|
||||||
if (t.name() == tag) {
|
if (t.name() == tag) {
|
||||||
const char* type = t.valueType();
|
const char* type = t.valueType();
|
||||||
if (!strcmp("Ms::Spatium", type))
|
if (!strcmp("Ms::Spatium", type))
|
||||||
set(idx, QVariant(Spatium(val.toDouble())));
|
set(idx, Spatium(val.toDouble()));
|
||||||
else if (!strcmp("double", type))
|
else if (!strcmp("double", type))
|
||||||
set(idx, QVariant(val.toDouble()));
|
set(idx, QVariant(val.toDouble()));
|
||||||
else if (!strcmp("bool", type))
|
else if (!strcmp("bool", type))
|
||||||
|
|
|
@ -863,9 +863,9 @@ QVariant TextLine::getProperty(P_ID id) const
|
||||||
case P_ID::END_HOOK:
|
case P_ID::END_HOOK:
|
||||||
return _endHook;
|
return _endHook;
|
||||||
case P_ID::BEGIN_HOOK_HEIGHT:
|
case P_ID::BEGIN_HOOK_HEIGHT:
|
||||||
return _beginHookHeight.val();
|
return _beginHookHeight;
|
||||||
case P_ID::END_HOOK_HEIGHT:
|
case P_ID::END_HOOK_HEIGHT:
|
||||||
return _endHookHeight.val();
|
return _endHookHeight;
|
||||||
case P_ID::BEGIN_HOOK_TYPE:
|
case P_ID::BEGIN_HOOK_TYPE:
|
||||||
return int(_beginHookType);
|
return int(_beginHookType);
|
||||||
case P_ID::END_HOOK_TYPE:
|
case P_ID::END_HOOK_TYPE:
|
||||||
|
@ -906,10 +906,10 @@ bool TextLine::setProperty(P_ID id, const QVariant& v)
|
||||||
_endHook = v.toBool();
|
_endHook = v.toBool();
|
||||||
break;
|
break;
|
||||||
case P_ID::BEGIN_HOOK_HEIGHT:
|
case P_ID::BEGIN_HOOK_HEIGHT:
|
||||||
_beginHookHeight = Spatium(v.toDouble());
|
_beginHookHeight = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::END_HOOK_HEIGHT:
|
case P_ID::END_HOOK_HEIGHT:
|
||||||
_endHookHeight = Spatium(v.toDouble());
|
_endHookHeight = v.value<Spatium>();
|
||||||
break;
|
break;
|
||||||
case P_ID::BEGIN_HOOK_TYPE:
|
case P_ID::BEGIN_HOOK_TYPE:
|
||||||
_beginHookType = HookType(v.toInt());
|
_beginHookType = HookType(v.toInt());
|
||||||
|
@ -951,7 +951,7 @@ QVariant TextLine::propertyDefault(P_ID id) const
|
||||||
return false;
|
return false;
|
||||||
case P_ID::BEGIN_HOOK_HEIGHT:
|
case P_ID::BEGIN_HOOK_HEIGHT:
|
||||||
case P_ID::END_HOOK_HEIGHT:
|
case P_ID::END_HOOK_HEIGHT:
|
||||||
return 1.5;
|
return Spatium(1.5);
|
||||||
case P_ID::BEGIN_HOOK_TYPE:
|
case P_ID::BEGIN_HOOK_TYPE:
|
||||||
case P_ID::END_HOOK_TYPE:
|
case P_ID::END_HOOK_TYPE:
|
||||||
return int(HookType::HOOK_90);
|
return int(HookType::HOOK_90);
|
||||||
|
|
|
@ -312,7 +312,7 @@ bool Volta::setProperty(P_ID propertyId, const QVariant& val)
|
||||||
break;
|
break;
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
lineWidthStyle = PropertyStyle::UNSTYLED;
|
lineWidthStyle = PropertyStyle::UNSTYLED;
|
||||||
setLineWidth(Spatium(val.toDouble()));
|
setLineWidth(val.value<Spatium>());
|
||||||
break;
|
break;
|
||||||
case P_ID::LINE_STYLE:
|
case P_ID::LINE_STYLE:
|
||||||
lineStyleStyle = PropertyStyle::UNSTYLED;
|
lineStyleStyle = PropertyStyle::UNSTYLED;
|
||||||
|
@ -346,7 +346,7 @@ QVariant Volta::propertyDefault(P_ID propertyId) const
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case P_ID::LINE_WIDTH:
|
case P_ID::LINE_WIDTH:
|
||||||
return score()->styleS(StyleIdx::voltaLineWidth).val();
|
return score()->style(StyleIdx::voltaLineWidth);
|
||||||
|
|
||||||
case P_ID::BEGIN_TEXT_PLACE:
|
case P_ID::BEGIN_TEXT_PLACE:
|
||||||
case P_ID::CONTINUE_TEXT_PLACE:
|
case P_ID::CONTINUE_TEXT_PLACE:
|
||||||
|
@ -360,7 +360,7 @@ QVariant Volta::propertyDefault(P_ID propertyId) const
|
||||||
|
|
||||||
case P_ID::BEGIN_HOOK_HEIGHT:
|
case P_ID::BEGIN_HOOK_HEIGHT:
|
||||||
case P_ID::END_HOOK_HEIGHT:
|
case P_ID::END_HOOK_HEIGHT:
|
||||||
return score()->styleS(StyleIdx::voltaHook).val();
|
return score()->style(StyleIdx::voltaHook);
|
||||||
|
|
||||||
case P_ID::TEXT_STYLE_TYPE:
|
case P_ID::TEXT_STYLE_TYPE:
|
||||||
return int(TextStyleType::VOLTA);
|
return int(TextStyleType::VOLTA);
|
||||||
|
|
|
@ -564,9 +564,18 @@ void Xml::tag(const QString& name, QVariant data)
|
||||||
*this << QString("<%1 w=\"%2\" h=\"%3\"/>\n").arg(name).arg(p.width()).arg(p.height());
|
*this << QString("<%1 w=\"%2\" h=\"%3\"/>\n").arg(name).arg(p.width()).arg(p.height());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default: {
|
||||||
qDebug("Xml::tag: unsupported type %d", data.type());
|
const char* type = data.typeName();
|
||||||
// abort();
|
if (strcmp(type, "Ms::Spatium") == 0) {
|
||||||
|
*this << "<" << name << ">";
|
||||||
|
*this << data.value<Spatium>().val();
|
||||||
|
*this << "</" << ename << ">\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug("Xml::tag: unsupported type %d %s", data.type(), type);
|
||||||
|
// abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue