change text frame width and margins from mm units to space units
This commit is contained in:
parent
a3d585daa2
commit
4b9012603a
14 changed files with 170 additions and 94 deletions
|
@ -43,6 +43,7 @@ static const int MSCVERSION = 125;
|
|||
// 1.23 measure property for actual length
|
||||
// 1.24 default image size is spatium dependent
|
||||
// 1.25 symbol numbers in TextLine() replaced by symbol names
|
||||
// TextStyle: frameWidth, paddingWidth are now in Spatium units (instead of mm)
|
||||
|
||||
|
||||
class MStyle;
|
||||
|
@ -55,6 +56,7 @@ static const qreal INCH = 25.4;
|
|||
static const qreal PPI = 72.0; // printer points per inch
|
||||
static const qreal SPATIUM20 = 5.0 / PPI; // size of Spatium for 20pt font in inch
|
||||
static const int MAX_STAVES = 4;
|
||||
#define MMSP(x) Spatium((x) * .1)
|
||||
|
||||
static const char mimeSymbolFormat[] = "application/mscore/symbol";
|
||||
static const char mimeSymbolListFormat[] = "application/mscore/symbollist";
|
||||
|
|
|
@ -478,8 +478,9 @@ void Segment::add(Element* el)
|
|||
case CHORD:
|
||||
case REST:
|
||||
if (_elist[track]) {
|
||||
qDebug("Segment::add(%s) there is already an %s at %d track %d\n",
|
||||
el->name(), _elist[track]->name(), tick(), track);
|
||||
qDebug("Segment::add(%s) there is already an %s at %s track %d",
|
||||
el->name(), _elist[track]->name(),
|
||||
score()->sigmap()->pos(tick()), track);
|
||||
// abort();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -160,6 +160,23 @@ void TimeSigMap::tickValues(int t, int* bar, int* beat, int* tick) const
|
|||
*tick = rest % ticksB;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// pos
|
||||
// Return string representation of tick position.
|
||||
// This is not reentrant and only for debugging!
|
||||
//---------------------------------------------------------
|
||||
|
||||
const char* TimeSigMap::pos(int t)
|
||||
{
|
||||
static char* s = 0;
|
||||
delete s;
|
||||
int bar, beat, tick;
|
||||
tickValues(t, &bar, &beat, &tick);
|
||||
QString ss = QString("%1:%2:%3").arg(bar).arg(beat).arg(tick);
|
||||
s = strdup(qPrintable(ss));
|
||||
return s;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// bar2tick
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -83,6 +83,7 @@ class TimeSigMap : public std::map<const int, SigEvent > {
|
|||
|
||||
void tickValues(int t, int* bar, int* beat, int* tick) const;
|
||||
int bar2tick(int bar, int beat) const;
|
||||
const char* pos(int t) const;
|
||||
|
||||
unsigned raster(unsigned tick, int raster) const;
|
||||
unsigned raster1(unsigned tick, int raster) const; // round down
|
||||
|
|
|
@ -68,8 +68,8 @@ void SimpleText::drawFrame(QPainter* painter) const
|
|||
color = Qt::gray;
|
||||
else if (selected())
|
||||
color = Qt::blue;
|
||||
if (frameWidth() != 0.0) {
|
||||
QPen pen(color, frameWidth() * MScore::DPMM);
|
||||
if (frameWidth().val() != 0.0) {
|
||||
QPen pen(color, frameWidth().val() * spatium());
|
||||
painter->setPen(pen);
|
||||
}
|
||||
else
|
||||
|
@ -184,9 +184,10 @@ void SimpleText::layoutFrame()
|
|||
frame.setWidth(frame.height());
|
||||
}
|
||||
}
|
||||
qreal w = (paddingWidth() + frameWidth() * .5) * MScore::DPMM;
|
||||
qreal _spatium = spatium();
|
||||
qreal w = (paddingWidth() + frameWidth() * .5).val() * _spatium;
|
||||
frame.adjust(-w, -w, w, w);
|
||||
w = frameWidth() * MScore::DPMM;
|
||||
w = frameWidth().val() * _spatium;
|
||||
setbbox(frame.adjusted(-w, -w, w, w));
|
||||
}
|
||||
|
||||
|
@ -221,7 +222,7 @@ qreal SimpleText::baseLine() const
|
|||
// frameWidth
|
||||
//---------------------------------------------------------
|
||||
|
||||
qreal SimpleText::frameWidth() const
|
||||
Spatium SimpleText::frameWidth() const
|
||||
{
|
||||
return textStyle().frameWidth();
|
||||
}
|
||||
|
@ -239,7 +240,7 @@ bool SimpleText::hasFrame() const
|
|||
// paddingWidth
|
||||
//---------------------------------------------------------
|
||||
|
||||
qreal SimpleText::paddingWidth() const
|
||||
Spatium SimpleText::paddingWidth() const
|
||||
{
|
||||
return textStyle().paddingWidth();
|
||||
}
|
||||
|
|
|
@ -69,10 +69,10 @@ class SimpleText : public Element {
|
|||
bool layoutToParentWidth() const { return _layoutToParentWidth; }
|
||||
void setLayoutToParentWidth(bool v) { _layoutToParentWidth = v; }
|
||||
|
||||
qreal frameWidth() const;
|
||||
Spatium frameWidth() const;
|
||||
QColor backgroundColor() const;
|
||||
bool hasFrame() const;
|
||||
qreal paddingWidth() const;
|
||||
Spatium paddingWidth() const;
|
||||
QColor frameColor() const;
|
||||
int frameRound() const;
|
||||
bool circle() const;
|
||||
|
|
|
@ -275,12 +275,12 @@ void initStyle(MStyle* s)
|
|||
AS(TextStyle(
|
||||
TR( "Tempo"), ff, 12, false, false, false,
|
||||
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -4.0), OS, QPointF(),
|
||||
true, .0, .0, 0, Qt::black, false, true));
|
||||
true, MMSP(.0), MMSP(.0), 0, Qt::black, false, true));
|
||||
#else
|
||||
AS(TextStyle(
|
||||
TR( "Tempo"), ff, 12, false, false, false,
|
||||
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -4.0), OS, QPointF(),
|
||||
true, .0, .0, 0, Qt::black, false, true));
|
||||
true, MMSP(.0), MMSP(.0), 0, Qt::black, false, true));
|
||||
#endif
|
||||
AS(TextStyle(
|
||||
TR( "Metronome"), ff, 12, true, false, false, ALIGN_LEFT));
|
||||
|
@ -300,7 +300,7 @@ void initStyle(MStyle* s)
|
|||
AS(TextStyle(
|
||||
TR( "System"), ff, 10, false, false, false,
|
||||
ALIGN_LEFT, QPointF(0, -4.0), OS, QPointF(), true,
|
||||
0.0, 0.0, 25, Qt::black, false, true));
|
||||
Spatium(0.0), Spatium(0.0), 25, Qt::black, false, true));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Staff"), ff, 10, false, false, false,
|
||||
|
@ -313,22 +313,22 @@ void initStyle(MStyle* s)
|
|||
AS(TextStyle(
|
||||
TR( "Rehearsal Mark"), ff, 14, true, false, false,
|
||||
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -3.0), OS, QPointF(), true,
|
||||
0.3, 1.0, 20, Qt::black, false, true));
|
||||
MMSP(0.3), MMSP(1.0), 20, Qt::black, false, true));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Repeat Text Left"), ff, 12, false, false, false,
|
||||
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(), true,
|
||||
0.0, 0.0, 25, Qt::black, false, true));
|
||||
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Repeat Text Right"), ff, 12, false, false, false,
|
||||
ALIGN_RIGHT | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(100, 0), true,
|
||||
0.0, 0.0, 25, Qt::black, false, true));
|
||||
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Repeat Text"), ff, 12, false, false, false, // for backward compatibility
|
||||
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -2.0), OS, QPointF(100, 0), true,
|
||||
0.0, 0.0, 25, Qt::black, false, true));
|
||||
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Volta"), ff, 11, true, false, false,
|
||||
|
@ -347,7 +347,8 @@ void initStyle(MStyle* s)
|
|||
|
||||
AS(TextStyle(
|
||||
TR( "String Number"), ff, 8, false, false, false,
|
||||
ALIGN_CENTER, QPointF(0, -5.0), OS, QPointF(100, 0), true, 0.2, -0.2, 0, Qt::black, true, false));
|
||||
ALIGN_CENTER, QPointF(0, -5.0), OS, QPointF(100, 0), true,
|
||||
MMSP(0.2), MMSP(-0.2), 0, Qt::black, true, false));
|
||||
|
||||
AS(TextStyle(
|
||||
TR( "Ottava"), ff, 12, false, true, false,
|
||||
|
@ -640,7 +641,7 @@ TextStyle::TextStyle(
|
|||
Align _align,
|
||||
const QPointF& _off, OffsetType _ot, const QPointF& _roff,
|
||||
bool sd,
|
||||
qreal fw, qreal pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
||||
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
||||
QColor fg, QColor bg)
|
||||
{
|
||||
d = new TextStyleData(_name, _family, _size,
|
||||
|
@ -655,6 +656,11 @@ TextStyle::TextStyle(const TextStyle& s)
|
|||
TextStyle::~TextStyle()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// TextStyle::operator=
|
||||
//---------------------------------------------------------
|
||||
|
||||
TextStyle& TextStyle::operator=(const TextStyle& s)
|
||||
{
|
||||
d = s.d;
|
||||
|
@ -674,8 +680,10 @@ TextStyleData::TextStyleData()
|
|||
underline = false;
|
||||
hasFrame = false;
|
||||
sizeIsSpatiumDependent = false;
|
||||
frameWidth = 0.35;
|
||||
paddingWidth = 0.0;
|
||||
frameWidth = Spatium(0);
|
||||
paddingWidth = Spatium(0);
|
||||
frameWidthMM = 0.0;
|
||||
paddingWidthMM = 0.0;
|
||||
frameRound = 25;
|
||||
frameColor = MScore::defaultColor;
|
||||
circle = false;
|
||||
|
@ -690,7 +698,7 @@ TextStyleData::TextStyleData(
|
|||
Align _align,
|
||||
const QPointF& _off, OffsetType _ot, const QPointF& _roff,
|
||||
bool sd,
|
||||
qreal fw, qreal pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
||||
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
|
||||
QColor fg, QColor bg)
|
||||
:
|
||||
ElementLayout(_align, _off, _ot, _roff),
|
||||
|
@ -700,7 +708,7 @@ TextStyleData::TextStyleData(
|
|||
frameRound(fr), frameColor(co), circle(_circle), systemFlag(_systemFlag),
|
||||
foregroundColor(fg), backgroundColor(bg)
|
||||
{
|
||||
hasFrame = (fw != 0.0) | (bg.alpha() != 0);
|
||||
hasFrame = (fw.val() != 0.0) | (bg.alpha() != 0);
|
||||
family = _family;
|
||||
}
|
||||
|
||||
|
@ -812,10 +820,10 @@ void TextStyleData::writeProperties(Xml& xml) const
|
|||
xml.tag("backgroundColor", backgroundColor);
|
||||
|
||||
if (hasFrame) {
|
||||
xml.tag("frameWidth", frameWidth);
|
||||
xml.tag("paddingWidth", paddingWidth);
|
||||
xml.tag("frameRound", frameRound);
|
||||
xml.tag("frameColor", frameColor);
|
||||
xml.tag("frameWidthS", frameWidth.val());
|
||||
xml.tag("paddingWidthS", paddingWidth.val());
|
||||
xml.tag("frameRound", frameRound);
|
||||
xml.tag("frameColor", frameColor);
|
||||
if (circle)
|
||||
xml.tag("circle", circle);
|
||||
}
|
||||
|
@ -829,7 +837,7 @@ void TextStyleData::writeProperties(Xml& xml) const
|
|||
|
||||
void TextStyleData::read(const QDomElement& de)
|
||||
{
|
||||
frameWidth = 0.0;
|
||||
frameWidth = Spatium(0.0);
|
||||
name = de.attribute("name");
|
||||
|
||||
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
|
||||
|
@ -869,13 +877,19 @@ bool TextStyleData::readProperties(const QDomElement& e)
|
|||
else if (tag == "sizeIsSpatiumDependent")
|
||||
sizeIsSpatiumDependent = val.toDouble();
|
||||
else if (tag == "frameWidth") {
|
||||
frameWidth = val.toDouble();
|
||||
hasFrame = true;
|
||||
frameWidthMM = val.toDouble();
|
||||
}
|
||||
else if (tag == "frameWidthS") {
|
||||
hasFrame = true;
|
||||
frameWidth = Spatium(val.toDouble());
|
||||
}
|
||||
else if (tag == "frame") // obsolete
|
||||
hasFrame = i;
|
||||
else if (tag == "paddingWidth")
|
||||
paddingWidth = val.toDouble();
|
||||
else if (tag == "paddingWidth") // obsolete
|
||||
paddingWidthMM = val.toDouble();
|
||||
else if (tag == "paddingWidthS")
|
||||
paddingWidth = Spatium(val.toDouble());
|
||||
else if (tag == "frameRound")
|
||||
frameRound = i;
|
||||
else if (tag == "frameColor")
|
||||
|
@ -978,6 +992,20 @@ void StyleData::load(const QDomElement& de)
|
|||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// Compatibility with old scores/styles:
|
||||
// translate old frameWidthMM and paddingWidthMM
|
||||
// into spatium units
|
||||
//
|
||||
int n = _textStyles.size();
|
||||
qreal spMM = _spatium / MScore::DPMM;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
TextStyle* s = &_textStyles[i];
|
||||
if (s->frameWidthMM() != 0.0)
|
||||
s->setFrameWidth(Spatium(s->frameWidthMM() / spMM));
|
||||
if (s->paddingWidthMM() != 0.0)
|
||||
s->setPaddingWidth(Spatium(s->paddingWidthMM() / spMM));
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -1090,6 +1118,10 @@ const TextStyle& StyleData::textStyle(int idx) const
|
|||
return _textStyles[idx];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// StyleVal
|
||||
//---------------------------------------------------------
|
||||
|
||||
StyleVal::StyleVal(StyleIdx t, Spatium val)
|
||||
{
|
||||
idx = t;
|
||||
|
@ -1178,21 +1210,37 @@ StyleVal MStyle::value(StyleIdx idx) const
|
|||
return d->_values[idx];
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// isDefault
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool MStyle::isDefault(StyleIdx idx) const
|
||||
{
|
||||
return d->isDefault(idx);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// chordDescription
|
||||
//---------------------------------------------------------
|
||||
|
||||
const ChordDescription* MStyle::chordDescription(int id) const
|
||||
{
|
||||
return d->chordDescription(id);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// chordList
|
||||
//---------------------------------------------------------
|
||||
|
||||
ChordList* MStyle::chordList() const
|
||||
{
|
||||
return d->chordList();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setChordList
|
||||
//---------------------------------------------------------
|
||||
|
||||
void MStyle::setChordList(ChordList* cl)
|
||||
{
|
||||
d->setChordList(cl);
|
||||
|
@ -1242,33 +1290,30 @@ void StyleData::setTextStyle(const TextStyle& ts)
|
|||
_textStyles.append(ts);
|
||||
}
|
||||
|
||||
QString TextStyle::name() const { return d->name; }
|
||||
QString TextStyle::family() const { return d->family; }
|
||||
qreal TextStyle::size() const { return d->size; }
|
||||
bool TextStyle::bold() const { return d->bold; }
|
||||
bool TextStyle::italic() const { return d->italic; }
|
||||
bool TextStyle::underline() const { return d->underline; }
|
||||
bool TextStyle::hasFrame() const { return d->hasFrame; }
|
||||
Align TextStyle::align() const { return d->align(); }
|
||||
|
||||
//---------------------------------------------------------
|
||||
// offset
|
||||
// TextStyle method wrappers
|
||||
//---------------------------------------------------------
|
||||
|
||||
const QPointF& TextStyle::offset() const
|
||||
{
|
||||
return d->offset();
|
||||
}
|
||||
|
||||
QPointF TextStyle::offset(qreal spatium) const
|
||||
{
|
||||
return d->offset(spatium);
|
||||
}
|
||||
|
||||
QString TextStyle::name() const { return d->name; }
|
||||
QString TextStyle::family() const { return d->family; }
|
||||
qreal TextStyle::size() const { return d->size; }
|
||||
bool TextStyle::bold() const { return d->bold; }
|
||||
bool TextStyle::italic() const { return d->italic; }
|
||||
bool TextStyle::underline() const { return d->underline; }
|
||||
bool TextStyle::hasFrame() const { return d->hasFrame; }
|
||||
Align TextStyle::align() const { return d->align(); }
|
||||
const QPointF& TextStyle::offset() const { return d->offset(); }
|
||||
QPointF TextStyle::offset(qreal spatium) const { return d->offset(spatium); }
|
||||
OffsetType TextStyle::offsetType() const { return d->offsetType(); }
|
||||
bool TextStyle::sizeIsSpatiumDependent() const { return d->sizeIsSpatiumDependent; }
|
||||
qreal TextStyle::frameWidth() const { return d->frameWidth; }
|
||||
qreal TextStyle::paddingWidth() const { return d->paddingWidth; }
|
||||
|
||||
Spatium TextStyle::frameWidth() const { return d->frameWidth; }
|
||||
Spatium TextStyle::paddingWidth() const { return d->paddingWidth; }
|
||||
qreal TextStyle::frameWidthMM() const { return d->frameWidthMM; }
|
||||
qreal TextStyle::paddingWidthMM() const { return d->paddingWidthMM; }
|
||||
void TextStyle::setFrameWidth(Spatium v) { d->frameWidth = v; }
|
||||
void TextStyle::setPaddingWidth(Spatium v) { d->paddingWidth = v; }
|
||||
|
||||
int TextStyle::frameRound() const { return d->frameRound; }
|
||||
QColor TextStyle::frameColor() const { return d->frameColor; }
|
||||
bool TextStyle::circle() const { return d->circle; }
|
||||
|
@ -1289,8 +1334,6 @@ void TextStyle::setOffsetType(OffsetType v) { d->setOffsetType(v);
|
|||
void TextStyle::setRxoff(qreal v) { d->setRxoff(v); }
|
||||
void TextStyle::setRyoff(qreal v) { d->setRyoff(v); }
|
||||
void TextStyle::setSizeIsSpatiumDependent(bool v) { d->sizeIsSpatiumDependent = v; }
|
||||
void TextStyle::setFrameWidth(qreal v) { d->frameWidth = v; }
|
||||
void TextStyle::setPaddingWidth(qreal v) { d->paddingWidth = v; }
|
||||
void TextStyle::setFrameRound(int v) { d->frameRound = v; }
|
||||
void TextStyle::setFrameColor(const QColor& v) { d->frameColor = v; }
|
||||
void TextStyle::setCircle(bool v) { d->circle = v; }
|
||||
|
@ -1304,20 +1347,11 @@ QFont TextStyle::fontPx(qreal spatium) const { return d->fontPx(spat
|
|||
QRectF TextStyle::bbox(qreal sp, const QString& s) const { return d->bbox(sp, s); }
|
||||
QFontMetricsF TextStyle::fontMetrics(qreal space) const { return d->fontMetrics(space); }
|
||||
bool TextStyle::operator!=(const TextStyle& s) const { return d->operator!=(*s.d); }
|
||||
|
||||
//---------------------------------------------------------
|
||||
// layout
|
||||
//---------------------------------------------------------
|
||||
|
||||
void TextStyle::layout(Element* e) const
|
||||
{
|
||||
d->layout(e);
|
||||
}
|
||||
|
||||
void TextStyle::writeProperties(Xml& xml) const { d->writeProperties(xml); }
|
||||
const QPointF& TextStyle::reloff() const { return d->reloff(); }
|
||||
void TextStyle::setReloff(const QPointF& p) { setRxoff(p.x()), setRyoff(p.y()); }
|
||||
bool TextStyle::readProperties(const QDomElement& v) { return d->readProperties(v); }
|
||||
void TextStyle::layout(Element* e) const { d->layout(e); }
|
||||
void TextStyle::writeProperties(Xml& xml) const { d->writeProperties(xml); }
|
||||
const QPointF& TextStyle::reloff() const { return d->reloff(); }
|
||||
void TextStyle::setReloff(const QPointF& p) { setRxoff(p.x()), setRyoff(p.y()); }
|
||||
bool TextStyle::readProperties(const QDomElement& v) { return d->readProperties(v); }
|
||||
|
||||
//---------------------------------------------------------
|
||||
// setFont
|
||||
|
|
|
@ -42,7 +42,7 @@ class TextStyle {
|
|||
const QPointF& _off = QPointF(), OffsetType _ot = OFFSET_SPATIUM,
|
||||
const QPointF& _roff = QPointF(),
|
||||
bool sd = false,
|
||||
qreal fw = 0.0, qreal pw = 0.0, int fr = 25,
|
||||
Spatium fw = Spatium(0.0), Spatium pw = Spatium(0.0), int fr = 25,
|
||||
QColor co = QColor(Qt::black), bool circle = false, bool systemFlag = false,
|
||||
QColor fg = QColor(Qt::black), QColor bg = QColor(255, 255, 255, 0));
|
||||
|
||||
|
@ -64,8 +64,14 @@ class TextStyle {
|
|||
const QPointF& reloff() const;
|
||||
void setReloff(const QPointF& p);
|
||||
bool sizeIsSpatiumDependent() const;
|
||||
qreal frameWidth() const;
|
||||
qreal paddingWidth() const;
|
||||
|
||||
Spatium frameWidth() const;
|
||||
Spatium paddingWidth() const;
|
||||
qreal frameWidthMM() const;
|
||||
qreal paddingWidthMM() const;
|
||||
void setFrameWidth(Spatium v);
|
||||
void setPaddingWidth(Spatium v);
|
||||
|
||||
int frameRound() const;
|
||||
QColor frameColor() const;
|
||||
bool circle() const;
|
||||
|
@ -86,8 +92,6 @@ class TextStyle {
|
|||
void setRxoff(qreal v);
|
||||
void setRyoff(qreal v);
|
||||
void setSizeIsSpatiumDependent(bool v);
|
||||
void setFrameWidth(qreal v);
|
||||
void setPaddingWidth(qreal v);
|
||||
void setFrameRound(int v);
|
||||
void setFrameColor(const QColor& v);
|
||||
void setCircle(bool v);
|
||||
|
|
|
@ -31,7 +31,11 @@ class ChordList;
|
|||
//---------------------------------------------------------
|
||||
|
||||
class TextStyleData : public QSharedData, public ElementLayout {
|
||||
|
||||
protected:
|
||||
qreal frameWidthMM; // for compatibility with old scores
|
||||
qreal paddingWidthMM;
|
||||
|
||||
QString name; // style name
|
||||
QString family; // font face
|
||||
qreal size;
|
||||
|
@ -42,8 +46,8 @@ class TextStyleData : public QSharedData, public ElementLayout {
|
|||
|
||||
bool sizeIsSpatiumDependent; // text point size depends on _spatium unit
|
||||
|
||||
qreal frameWidth;
|
||||
qreal paddingWidth;
|
||||
Spatium frameWidth;
|
||||
Spatium paddingWidth;
|
||||
int frameRound;
|
||||
QColor frameColor;
|
||||
bool circle;
|
||||
|
@ -57,7 +61,7 @@ class TextStyleData : public QSharedData, public ElementLayout {
|
|||
Align _align,
|
||||
const QPointF& _off, OffsetType _ot, const QPointF& _roff,
|
||||
bool sizeSpatiumDependent,
|
||||
qreal fw, qreal pw, int fr,
|
||||
Spatium fw, Spatium pw, int fr,
|
||||
QColor co, bool circle, bool systemFlag,
|
||||
QColor fg, QColor bg);
|
||||
TextStyleData();
|
||||
|
@ -118,6 +122,7 @@ class StyleData : public QSharedData {
|
|||
void setSpatium(qreal v) { _spatium = v; }
|
||||
ArticulationAnchor articulationAnchor(int id) const { return _articulationAnchor[id]; }
|
||||
void setArticulationAnchor(int id, ArticulationAnchor val) { _articulationAnchor[id] = val; }
|
||||
friend class TextStyle;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -438,6 +438,14 @@ bool Text::readProperties(const QDomElement& e)
|
|||
}
|
||||
else if (tag == "subtype") // obsolete
|
||||
;
|
||||
else if (tag == "frameWidth") { // obsolete
|
||||
qreal spMM = spatium() / MScore::DPMM;
|
||||
setFrameWidth(Spatium(val.toDouble() / spMM));
|
||||
}
|
||||
else if (tag == "paddingWidth") { // obsolete
|
||||
qreal spMM = spatium() / MScore::DPMM;
|
||||
setPaddingWidth(Spatium(val.toDouble() / spMM));
|
||||
}
|
||||
else if (_textStyle.readProperties(e))
|
||||
;
|
||||
else if (!Element::readProperties(e))
|
||||
|
@ -1066,7 +1074,7 @@ qreal Text::yoff() const
|
|||
// setFrameWidth
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Text::setFrameWidth(qreal val)
|
||||
void Text::setFrameWidth(Spatium val)
|
||||
{
|
||||
_textStyle.setFrameWidth(val);
|
||||
}
|
||||
|
@ -1075,7 +1083,7 @@ void Text::setFrameWidth(qreal val)
|
|||
// setPaddingWidth
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Text::setPaddingWidth(qreal val)
|
||||
void Text::setPaddingWidth(Spatium val)
|
||||
{
|
||||
_textStyle.setPaddingWidth(val);
|
||||
}
|
||||
|
|
|
@ -62,8 +62,8 @@ class Text : public SimpleText {
|
|||
|
||||
bool sizeIsSpatiumDependent() const;
|
||||
void setSizeIsSpatiumDependent(int v);
|
||||
void setFrameWidth(qreal val);
|
||||
void setPaddingWidth(qreal val);
|
||||
void setFrameWidth(Spatium val);
|
||||
void setPaddingWidth(Spatium val);
|
||||
void setFrameColor(const QColor& val);
|
||||
void setFrameRound(int val);
|
||||
void setCircle(bool val);
|
||||
|
|
|
@ -4221,7 +4221,7 @@ void ExportMusicXml::harmony(Harmony const* const h)
|
|||
if (rx > 0) {
|
||||
relative = QString(" relative-x=\"%1\"").arg(QString::number(rx,'f',2));
|
||||
}
|
||||
if (h->frameWidth() > 0.0)
|
||||
if (h->hasFrame())
|
||||
xml.stag(QString("harmony print-frame=\"yes\"").append(relative));
|
||||
else
|
||||
xml.stag(QString("harmony print-frame=\"no\"").append(relative));
|
||||
|
|
|
@ -178,9 +178,9 @@ void TextProp::setTextStyle(const TextStyle& s)
|
|||
|
||||
frameColor->setColor(s.frameColor());
|
||||
bgColor->setColor(s.backgroundColor());
|
||||
frameWidth->setValue(s.frameWidth());
|
||||
frameWidth->setValue(s.frameWidth().val());
|
||||
frame->setChecked(s.hasFrame());
|
||||
paddingWidth->setValue(s.paddingWidth());
|
||||
paddingWidth->setValue(s.paddingWidth().val());
|
||||
frameRound->setValue(s.frameRound());
|
||||
circleButton->setChecked(s.circle());
|
||||
boxButton->setChecked(!s.circle());
|
||||
|
@ -209,8 +209,8 @@ TextStyle TextProp::textStyle() const
|
|||
s.setRyoff(ryOffset->value());
|
||||
s.setFrameColor(frameColor->color());
|
||||
s.setBackgroundColor(bgColor->color());
|
||||
s.setFrameWidth(frameWidth->value());
|
||||
s.setPaddingWidth(paddingWidth->value());
|
||||
s.setFrameWidth(Spatium(frameWidth->value()));
|
||||
s.setPaddingWidth(Spatium(paddingWidth->value()));
|
||||
s.setCircle(circleButton->isChecked());
|
||||
s.setFrameRound(frameRound->value());
|
||||
s.setHasFrame(frame->isChecked());
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>557</width>
|
||||
<height>484</height>
|
||||
<height>494</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -501,8 +501,8 @@
|
|||
<string>text color</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<set>QFrame::Box</set>
|
||||
</property>
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -584,6 +584,9 @@
|
|||
<property name="toolTip">
|
||||
<string>horizontal offset to reference point</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000.000000000000000</double>
|
||||
</property>
|
||||
|
@ -823,7 +826,7 @@
|
|||
<string>frame line width</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>mm</string>
|
||||
<string>sp</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999.990000000000009</double>
|
||||
|
@ -855,7 +858,7 @@
|
|||
<string>frame inner margin</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string>mm</string>
|
||||
<string>sp</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999.000000000000000</double>
|
||||
|
@ -916,7 +919,7 @@
|
|||
<string>frame color</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<set>QFrame::Box</set>
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -926,8 +929,8 @@
|
|||
<string>frame color</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<set>QFrame::Box</set>
|
||||
</property>
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
|
|
Loading…
Reference in a new issue