page properties: enable even margin and link them with odd margins when two sided

This commit is contained in:
lasconic 2013-08-07 10:56:06 +02:00
parent cc10cd0372
commit 63a2554c06
2 changed files with 53 additions and 3 deletions

View file

@ -65,6 +65,8 @@ PageSettings::PageSettings(QWidget* parent)
connect(oddPageRightMargin, SIGNAL(valueChanged(double)), SLOT(ormChanged(double)));
connect(evenPageTopMargin, SIGNAL(valueChanged(double)), SLOT(etmChanged(double)));
connect(evenPageBottomMargin, SIGNAL(valueChanged(double)), SLOT(ebmChanged(double)));
connect(evenPageRightMargin, SIGNAL(valueChanged(double)), SLOT(ermChanged(double)));
connect(evenPageLeftMargin, SIGNAL(valueChanged(double)), SLOT(elmChanged(double)));
connect(pageGroup, SIGNAL(activated(int)), SLOT(pageFormatSelected(int)));
connect(spatiumEntry, SIGNAL(valueChanged(double)), SLOT(spatiumChanged(double)));
connect(pageOffsetEntry, SIGNAL(valueChanged(int)), SLOT(pageOffsetChanged(int)));
@ -204,8 +206,8 @@ void PageSettings::updateValues()
evenPageTopMargin->setEnabled(pf->twosided());
evenPageBottomMargin->setEnabled(pf->twosided());
evenPageLeftMargin->setEnabled(false);
evenPageRightMargin->setEnabled(false);
evenPageLeftMargin->setEnabled(pf->twosided());
evenPageRightMargin->setEnabled(pf->twosided());
if (twosided->isChecked()) {
evenPageRightMargin->setValue(oddPageLeftMargin->value());
@ -440,6 +442,52 @@ void PageSettings::etmChanged(double val)
updatePreview(1);
}
//---------------------------------------------------------
// elmChanged
//---------------------------------------------------------
void PageSettings::elmChanged(double val)
{
if (mmUnit)
val /= INCH;
if(twosided->isChecked()) {
oddPageRightMargin->blockSignals(true);
oddPageRightMargin->setValue(val * (mmUnit ? INCH : 1.0));
oddPageRightMargin->blockSignals(false);
}
PageFormat pf;
pf.copy(*preview->score()->pageFormat());
pf.setPrintableWidth(pf.size().width() - pf.evenRightMargin() - val);
pf.setEvenLeftMargin(val);
preview->score()->setPageFormat(pf);
updatePreview(0);
}
//---------------------------------------------------------
// ermChanged
//---------------------------------------------------------
void PageSettings::ermChanged(double val)
{
if (mmUnit)
val /= INCH;
if (twosided->isChecked()) {
oddPageLeftMargin->blockSignals(true);
oddPageLeftMargin->setValue(val * (mmUnit ? INCH : 1.0));
oddPageLeftMargin->blockSignals(false);
}
PageFormat pf;
pf.copy(*preview->score()->pageFormat());
pf.setPrintableWidth(pf.size().width() - pf.evenLeftMargin() - val);
pf.setOddLeftMargin(val);
preview->score()->setPageFormat(pf);
updatePreview(0);
}
//---------------------------------------------------------
// ebmChanged
//---------------------------------------------------------

View file

@ -59,10 +59,12 @@ class PageSettings : public QDialog, private Ui::PageSettingsBase {
void ormChanged(double val);
void etmChanged(double val);
void ebmChanged(double val);
void elmChanged(double val);
void ermChanged(double val);
void spatiumChanged(double val);
void pageHeightChanged(double);
void pageWidthChanged(double);
void pageOffsetChanged(int val);
void pageOffsetChanged(int val);
public:
PageSettings(QWidget* parent = 0);