Skip to content

Commit

Permalink
another fix for #25896
Browse files Browse the repository at this point in the history
  • Loading branch information
wschweer committed Aug 6, 2014
1 parent 0c0ac79 commit aa7957b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libmscore/textline.cpp
Expand Up @@ -644,6 +644,8 @@ void TextLine::writeProperties(Xml& xml) const
if (_beginText) {
bool textDiff = _beginText->text() != propertyDefault(P_ID::BEGIN_TEXT).toString();
bool styleDiff = _beginText->textStyle() != propertyDefault(P_ID::BEGIN_TEXT_STYLE).value<TextStyle>();
if (styleDiff)
textDiff = true;
if (textDiff || styleDiff) {
xml.stag("beginText");
_beginText->writeProperties(xml, textDiff, styleDiff);
Expand All @@ -653,6 +655,8 @@ void TextLine::writeProperties(Xml& xml) const
if (_continueText) {
bool textDiff = _continueText->text() != propertyDefault(P_ID::CONTINUE_TEXT).toString();
bool styleDiff = _continueText->textStyle() != propertyDefault(P_ID::CONTINUE_TEXT_STYLE).value<TextStyle>();
if (styleDiff)
textDiff = true;
if (textDiff || styleDiff) {
xml.stag("continueText");
_continueText->writeProperties(xml, textDiff, styleDiff);
Expand All @@ -662,6 +666,8 @@ void TextLine::writeProperties(Xml& xml) const
if (_endText) {
bool textDiff = _endText->text() != propertyDefault(P_ID::END_TEXT).toString();
bool styleDiff = _endText->textStyle() != propertyDefault(P_ID::END_TEXT_STYLE).value<TextStyle>();
if (styleDiff)
textDiff = true;
if (textDiff || styleDiff) {
xml.stag("endText");
_endText->writeProperties(xml, textDiff, styleDiff);
Expand Down
14 changes: 14 additions & 0 deletions mscore/textprop.cpp
Expand Up @@ -65,6 +65,7 @@ TextProp::TextProp(QWidget* parent)
connect(resetToStyle, SIGNAL(clicked()), SIGNAL(resetToStyleClicked()));
connect(boxButton, SIGNAL(toggled(bool)), this, SLOT(boxButtonToggled(bool)));
connect(frame, SIGNAL(toggled(bool)), this, SLOT(boxButtonToggled(bool)));
connect(styles, SIGNAL(currentIndexChanged(int)), SLOT(styleIndexChanged(int)));
}

//---------------------------------------------------------
Expand All @@ -79,13 +80,15 @@ void TextProp::setScore(bool onlyStyle, Score* score)
styleLabel->setVisible(!onlyStyle);
styles->clear();

styles->blockSignals(true);
const QList<TextStyle>& scoreStyles = score->style()->textStyles();
int n = scoreStyles.size();
for (int i = 0; i < n; ++i) {
// if style not hidden in this context, add to combo with index in score style list as userData
if ( !(scoreStyles.at(i).hidden() & TextStyleHidden::IN_LISTS) )
styles->addItem(scoreStyles.at(i).name(), i);
}
styles->blockSignals(false);
}

//---------------------------------------------------------
Expand Down Expand Up @@ -246,5 +249,16 @@ void TextProp::boxButtonToggled(bool state)
frameRound->setEnabled(frame->isChecked() && state);
}

//---------------------------------------------------------
// styleIndexChanged
//---------------------------------------------------------

void TextProp::styleIndexChanged(int i)
{
int idx = styles->itemData(i).toInt();
setTextStyle(_score->textStyle(TextStyleType(idx)));
printf("style index changed %d\n", idx);
}

}

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

signals:
void resetToStyleClicked();
Expand Down

0 comments on commit aa7957b

Please sign in to comment.