Skip to content

Commit

Permalink
Merge pull request #759 from Jojo-Schmitz/24491-header-footer-even-od…
Browse files Browse the repository at this point in the history
…d-setting

fixes for header/footer even/odd setting
  • Loading branch information
wschweer committed Mar 12, 2014
2 parents fe8e675 + 0a8cf7f commit 6a2e41a
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libmscore/page.cpp
Expand Up @@ -223,7 +223,7 @@ void Page::draw(QPainter* painter) const
TextStyle ts = score()->textStyle(TEXT_STYLE_HEADER);
QPointF o(ts.offset(spatium()));

bool odd = (n & 1) && _score->styleB(ST_headerOddEven);
bool odd = (n & 1) || !_score->styleB(ST_headerOddEven);
if (odd) {
o.setX(-o.x());
s1 = _score->styleSt(ST_oddHeaderL);
Expand Down Expand Up @@ -272,8 +272,7 @@ void Page::draw(QPainter* painter) const

QPointF o(ts.offset(spatium()));

bool odd = (n & 1) && _score->styleB(ST_footerOddEven);

bool odd = (n & 1) || !_score->styleB(ST_footerOddEven);
if (odd) {
o.setX(-o.x());
s1 = _score->styleSt(ST_oddFooterL);
Expand Down
45 changes: 45 additions & 0 deletions mscore/editstyle.cpp
Expand Up @@ -151,6 +151,8 @@ EditStyle::EditStyle(Score* s, QWidget* parent)
showHeader->setToolTip(toolTipHeaderFooter);
showFooter->setToolTip(toolTipHeaderFooter);
connect(buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(buttonClicked(QAbstractButton*)));
connect(headerOddEven, SIGNAL(toggled(bool)), SLOT(toggleHeaderOddEven(bool)));
connect(footerOddEven, SIGNAL(toggled(bool)), SLOT(toggleFooterOddEven(bool)));
connect(chordDescriptionFileButton, SIGNAL(clicked()), SLOT(selectChordDescriptionFile()));
connect(chordsStandard, SIGNAL(toggled(bool)), SLOT(setChordStyle(bool)));
connect(chordsJazz, SIGNAL(toggled(bool)), SLOT(setChordStyle(bool)));
Expand Down Expand Up @@ -661,6 +663,7 @@ void EditStyle::setValues()
headerStyled->setChecked(lstyle.value(ST_headerStyled).toBool());
showHeaderFirstPage->setChecked(lstyle.value(ST_headerFirstPage).toBool());
headerOddEven->setChecked(lstyle.value(ST_headerOddEven).toBool());
toggleHeaderOddEven(lstyle.value(ST_headerOddEven).toBool());
if (headerStyled->isChecked()) {
evenHeaderL->setPlainText(lstyle.value(ST_evenHeaderL).toString());
evenHeaderC->setPlainText(lstyle.value(ST_evenHeaderC).toString());
Expand All @@ -682,6 +685,7 @@ void EditStyle::setValues()
footerStyled->setChecked(lstyle.value(ST_footerStyled).toBool());
showFooterFirstPage->setChecked(lstyle.value(ST_footerFirstPage).toBool());
footerOddEven->setChecked(lstyle.value(ST_footerOddEven).toBool());
toggleFooterOddEven(lstyle.value(ST_footerOddEven).toBool());
if (footerStyled->isChecked()) {
evenFooterL->setPlainText(lstyle.value(ST_evenFooterL).toString());
evenFooterC->setPlainText(lstyle.value(ST_evenFooterC).toString());
Expand Down Expand Up @@ -782,6 +786,47 @@ void EditStyle::setChordStyle(bool checked)
}
}

//---------------------------------------------------------
// toggleHeaderOddEven
//---------------------------------------------------------

void EditStyle::toggleHeaderOddEven(bool checked)
{
label_67->setEnabled(checked); // "Even"
if (checked)
label_66->setText(tr("Odd"));
else
label_66->setText(tr("Even/Odd"));
evenHeaderL->setEnabled(checked);
editEvenHeaderL->setEnabled(checked);
evenHeaderC->setEnabled(checked);
editEvenHeaderC->setEnabled(checked);
evenHeaderR->setEnabled(checked);
editEvenHeaderR->setEnabled(checked);
return;
}

//---------------------------------------------------------
// toggleFooterOddEven
//---------------------------------------------------------

void EditStyle::toggleFooterOddEven(bool checked)
{
label_80->setEnabled(checked); // "Even"
if (checked)
label_65->setText(tr("Odd"));
else
label_65->setText(tr("Even/Odd"));

evenFooterL->setEnabled(checked);
editEvenFooterL->setEnabled(checked);
evenFooterC->setEnabled(checked);
editEvenFooterC->setEnabled(checked);
evenFooterR->setEnabled(checked);
editEvenFooterR->setEnabled(checked);
return;
}

//---------------------------------------------------------
// editTextClicked
//---------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions mscore/editstyle.h
Expand Up @@ -49,6 +49,8 @@ class EditStyle : public QDialog, private Ui::EditStyleBase {
private slots:
void selectChordDescriptionFile();
void setChordStyle(bool);
void toggleHeaderOddEven(bool);
void toggleFooterOddEven(bool);
void buttonClicked(QAbstractButton*);
void editTextClicked(int id);
void resetStyleValue(int i);
Expand Down

0 comments on commit 6a2e41a

Please sign in to comment.