Skip to content

Commit

Permalink
fix default frame width and margin in text style/properties, rework t…
Browse files Browse the repository at this point in the history
…ext properties dialog
  • Loading branch information
lasconic committed Apr 25, 2014
1 parent 967978c commit 170d710
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 116 deletions.
34 changes: 17 additions & 17 deletions libmscore/style.cpp
Expand Up @@ -247,7 +247,7 @@ void initStyle(MStyle* s)
// this is an empty style, no offsets are allowed
// never show this style
AS("", ff, 10, false, false, false, ALIGN_LEFT | ALIGN_BASELINE, QPointF(), OS, false,
Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, false, QColor(Qt::black),
false, Spatium(.2), Spatium(.5), 25, QColor(Qt::black), false, false, QColor(Qt::black),
QColor(255, 255, 255, 0), TextStyle::HIDE_ALWAYS);

AS("Title", ff, 24, false, false, false, ALIGN_HCENTER | ALIGN_TOP, QPointF(), OA);
Expand All @@ -265,7 +265,7 @@ void initStyle(MStyle* s)
AS("Technique", ff, 12, false, true, false,ALIGN_LEFT | ALIGN_BASELINE, QPointF(0.0, -2.0), OS);

AS("Tempo", ff, 12, false, false, false,ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -4.0), OS,
true, MMSP(.0), MMSP(.0), 0, Qt::black, false, true);
true, false, Spatium(.2), Spatium(.5), 0, Qt::black, false, true);

AS("Metronome", ff, 12, true, false, false, ALIGN_LEFT);
AS("Measure Number", ff, 8, false, false, false,ALIGN_HCENTER | ALIGN_BOTTOM, QPointF(.0, -2.0), OS, true);
Expand All @@ -274,26 +274,26 @@ void initStyle(MStyle* s)

AS("System", ff, 10, false, false, false,
ALIGN_LEFT, QPointF(0, -4.0), OS, true,
Spatium(0.0), Spatium(0.0), 25, Qt::black, false, true);
false, Spatium(.2), Spatium(.5), 25, Qt::black, false, true);

AS("Staff", ff, 10, false, false, false, ALIGN_LEFT, QPointF(0, -4.0), OS, true);
AS("Chord Symbol", ff, 12, false, false, false, ALIGN_LEFT | ALIGN_BASELINE, QPointF(), OS, true);

AS("Rehearsal Mark", ff, 14, true, false, false,
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -3.0), OS, true,
Spatium(0.2), Spatium(.5), 20, Qt::black, false, true);
true, Spatium(.2), Spatium(.5), 20, Qt::black, false, true);

AS("Repeat Text Left", ff, 20, false, false, false,
ALIGN_LEFT | ALIGN_BASELINE, QPointF(0, -2.0), OS, true,
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true);
false, Spatium(.2), Spatium(.5), 25, Qt::black, false, true);

AS("Repeat Text Right", ff, 12, false, false, false,
ALIGN_RIGHT | ALIGN_BASELINE, QPointF(0, -2.0), OS, true,
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true);
false, Spatium(0.2), Spatium(0.5), 25, Qt::black, false, true);

AS("Repeat Text", ff, 12, false, false, false, // for backward compatibility
ALIGN_HCENTER | ALIGN_BASELINE, QPointF(0, -2.0), OS, true,
MMSP(0.0), MMSP(0.0), 25, Qt::black, false, true);
false, Spatium(0.2), Spatium(0.5), 25, Qt::black, false, true);

// y offset may depend on voltaHook style element
AS("Volta", ff, 11, true, false, false, ALIGN_LEFT | ALIGN_BASELINE, QPointF(0.5, 1.9), OS, true);
Expand All @@ -303,7 +303,7 @@ void initStyle(MStyle* s)

AS("String Number", ff, 8, false, false, false,
ALIGN_CENTER, QPointF(0, -5.0), OS, true,
Spatium(0.1), Spatium(0.2), 0, Qt::black, true, false);
true, Spatium(.1), Spatium(.2), 0, Qt::black, true, false);

AS("Ottava", ff, 12, false, true, false, ALIGN_LEFT | ALIGN_VCENTER, QPointF(), OS, true);
AS("Bend", ff, 8, false, false, false, ALIGN_CENTER | ALIGN_BOTTOM, QPointF(), OS, true);
Expand All @@ -314,9 +314,9 @@ void initStyle(MStyle* s)

AS("Figured Bass", "MScoreBC", 8, false, false, false,
ALIGN_LEFT | ALIGN_TOP, QPointF(0, 6), OS, true,
Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, // default params
false, QColor(Qt::black), QColor(255, 255, 255, 0), // default params
TextStyle::HIDE_IN_EDITOR); // don't show in Style Editor
false, Spatium(0.0), Spatium(0.0), 25, QColor(Qt::black), false, // default params
false, QColor(Qt::black), QColor(255, 255, 255, 0), // default params
TextStyle::HIDE_IN_EDITOR); // don't show in Style Editor

#undef MM
#undef OA
Expand Down Expand Up @@ -587,12 +587,12 @@ TextStyle::TextStyle(QString _name, QString _family, qreal _size,
Align _align,
const QPointF& _off, OffsetType _ot,
bool sd,
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
bool hasFrame, Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
QColor fg, QColor bg, Hidden hidden)
{
d = new TextStyleData(_name, _family, _size,
_bold, _italic, _underline, _align, _off, _ot,
sd, fw, pw, fr, co, _circle, _systemFlag, fg, bg);
sd, hasFrame, fw, pw, fr, co, _circle, _systemFlag, fg, bg);
_hidden = hidden;
}

Expand Down Expand Up @@ -647,17 +647,17 @@ TextStyleData::TextStyleData(
Align _align,
const QPointF& _off, OffsetType _ot,
bool sd,
Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
bool _hasFrame, Spatium fw, Spatium pw, int fr, QColor co, bool _circle, bool _systemFlag,
QColor fg, QColor bg)
:
ElementLayout(_align, _off, _ot),
name(_name), size(_size), bold(_bold),
italic(_italic), underline(_underline),
sizeIsSpatiumDependent(sd), frameWidth(fw), paddingWidth(pw),
sizeIsSpatiumDependent(sd), hasFrame(_hasFrame), frameWidth(fw), paddingWidth(pw),
frameRound(fr), frameColor(co), circle(_circle), systemFlag(_systemFlag),
foregroundColor(fg), backgroundColor(bg)
{
hasFrame = (fw.val() != 0.0) || (bg.alpha() != 0);
//hasFrame = (fw.val() != 0.0) || (bg.alpha() != 0);
family = _family;
frameWidthMM = 0.0;
paddingWidthMM = 0.0;
Expand Down Expand Up @@ -907,7 +907,7 @@ bool TextStyleData::readProperties(XmlReader& e)
;
else if (tag == "sizeIsSpatiumDependent" || tag == "spatiumSizeDependent")
sizeIsSpatiumDependent = e.readInt();
else if (tag == "frameWidth") {
else if (tag == "frameWidth") { // obsolete
hasFrame = true;
frameWidthMM = e.readDouble();
}
Expand Down
2 changes: 1 addition & 1 deletion libmscore/style.h
Expand Up @@ -52,7 +52,7 @@ class TextStyle {
Align _align,
const QPointF& _off = QPointF(), OffsetType _ot = OFFSET_SPATIUM,
bool sd = false,
Spatium fw = Spatium(0.0), Spatium pw = Spatium(0.0), int fr = 25,
bool hasFrame = false, Spatium fw = Spatium(0.2), Spatium pw = Spatium(0.5), 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), Hidden hidden = HIDE_NEVER);

Expand Down
4 changes: 2 additions & 2 deletions libmscore/style_p.h
Expand Up @@ -43,10 +43,10 @@ class TextStyleData : public QSharedData, public ElementLayout {
bool bold;
bool italic;
bool underline;
bool hasFrame;

bool sizeIsSpatiumDependent; // text point size depends on _spatium unit

bool hasFrame;
Spatium frameWidth;
Spatium paddingWidth;
int frameRound;
Expand All @@ -62,7 +62,7 @@ class TextStyleData : public QSharedData, public ElementLayout {
Align _align,
const QPointF& _off, OffsetType _ot,
bool sizeSpatiumDependent,
Spatium fw, Spatium pw, int fr,
bool hasFrame, Spatium fw, Spatium pw, int fr,
QColor co, bool circle, bool systemFlag,
QColor fg, QColor bg);
TextStyleData();
Expand Down
11 changes: 11 additions & 0 deletions mscore/textprop.cpp
Expand Up @@ -63,6 +63,8 @@ TextProp::TextProp(QWidget* parent)
connect(mmUnit, SIGNAL(toggled(bool)), SLOT(mmToggled(bool)));
connect(resetToStyle, SIGNAL(clicked()), SLOT(doResetToTextStyle()));
connect(resetToStyle, SIGNAL(clicked()), SIGNAL(resetToStyleClicked()));
connect(boxButton, SIGNAL(toggled(bool)), this, SLOT(boxButtonToggled(bool)));
connect(frame, SIGNAL(toggled(bool)), this, SLOT(boxButtonToggled(bool)));
}

//---------------------------------------------------------
Expand Down Expand Up @@ -235,5 +237,14 @@ void TextProp::doResetToTextStyle()
setTextStyle(_score->textStyle(textStyleType()));
}

//---------------------------------------------------------
// boxButtonToggled
//---------------------------------------------------------

void TextProp::boxButtonToggled(bool state)
{
frameRound->setEnabled(frame->isChecked() && state);
}

}

1 change: 1 addition & 0 deletions mscore/textprop.h
Expand Up @@ -43,6 +43,7 @@ class TextProp : public QWidget, public Ui::TextProperties {
private slots:
void mmToggled(bool);
void doResetToTextStyle();
void boxButtonToggled(bool);

signals:
void resetToStyleClicked();
Expand Down
4 changes: 0 additions & 4 deletions mscore/textproperties.cpp
Expand Up @@ -57,11 +57,7 @@ TextProperties::TextProperties(Text* t, QWidget* parent)
tp->setScore(false, t->score());

layout->addWidget(tp, 0, 1);
QLabel* l = new QLabel;
l->setPixmap(QPixmap(":/data/bg1.jpg"));
l->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);

layout->addWidget(l, 0, 0, 2, 1);
QHBoxLayout* hb = new QHBoxLayout;
QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
hb->addWidget(bb);
Expand Down

0 comments on commit 170d710

Please sign in to comment.