}
-void GuiDocument::setCustomMargins(bool custom)
+void GuiDocument::setCustomMargins(bool cb_checked)
{
- if (custom) {
- // Cache current settings
- tmp_leftmargin_ = widgetsToLength(marginsModule->innerLE,
- marginsModule->innerUnit);
- tmp_topmargin_ = widgetsToLength(marginsModule->topLE,
- marginsModule->topUnit);
- tmp_rightmargin_ = widgetsToLength(marginsModule->outerLE,
- marginsModule->outerUnit);
- tmp_bottommargin_ = widgetsToLength(marginsModule->bottomLE,
- marginsModule->bottomUnit);
- tmp_headheight_ = widgetsToLength(marginsModule->headheightLE,
- marginsModule->headheightUnit);
- tmp_headsep_ = widgetsToLength(marginsModule->headsepLE,
- marginsModule->headsepUnit);
- tmp_footskip_ = widgetsToLength(marginsModule->footskipLE,
- marginsModule->footskipUnit);
- tmp_columnsep_ = widgetsToLength(marginsModule->columnsepLE,
- marginsModule->columnsepUnit);
- // clear widgets
- marginsModule->topLE->clear();
- marginsModule->bottomLE->clear();
- marginsModule->innerLE->clear();
- marginsModule->outerLE->clear();
- marginsModule->headheightLE->clear();
- marginsModule->headsepLE->clear();
- marginsModule->footskipLE->clear();
- marginsModule->columnsepLE->clear();
- } else {
+ bool const custom_margins = !cb_checked;
+ if (custom_margins) {
Length::UNIT const default_unit = Length::defaultUnit();
- // re-fill chached values
+ // fill with chached values
lengthToWidgets(marginsModule->topLE,
marginsModule->topUnit,
tmp_topmargin_, default_unit);
lengthToWidgets(marginsModule->columnsepLE,
marginsModule->columnsepUnit,
tmp_columnsep_, default_unit);
+ } else { // default margins
+ // Cache current values
+ tmp_leftmargin_ = widgetsToLength(marginsModule->innerLE,
+ marginsModule->innerUnit);
+ tmp_topmargin_ = widgetsToLength(marginsModule->topLE,
+ marginsModule->topUnit);
+ tmp_rightmargin_ = widgetsToLength(marginsModule->outerLE,
+ marginsModule->outerUnit);
+ tmp_bottommargin_ = widgetsToLength(marginsModule->bottomLE,
+ marginsModule->bottomUnit);
+ tmp_headheight_ = widgetsToLength(marginsModule->headheightLE,
+ marginsModule->headheightUnit);
+ tmp_headsep_ = widgetsToLength(marginsModule->headsepLE,
+ marginsModule->headsepUnit);
+ tmp_footskip_ = widgetsToLength(marginsModule->footskipLE,
+ marginsModule->footskipUnit);
+ tmp_columnsep_ = widgetsToLength(marginsModule->columnsepLE,
+ marginsModule->columnsepUnit);
+ // clear widgets
+ marginsModule->topLE->clear();
+ marginsModule->bottomLE->clear();
+ marginsModule->innerLE->clear();
+ marginsModule->outerLE->clear();
+ marginsModule->headheightLE->clear();
+ marginsModule->headsepLE->clear();
+ marginsModule->footskipLE->clear();
+ marginsModule->columnsepLE->clear();
}
- marginsModule->topL->setEnabled(!custom);
- marginsModule->topLE->setEnabled(!custom);
- marginsModule->topUnit->setEnabled(!custom);
- marginsModule->bottomL->setEnabled(!custom);
- marginsModule->bottomLE->setEnabled(!custom);
- marginsModule->bottomUnit->setEnabled(!custom);
+ marginsModule->topL->setEnabled(custom_margins);
+ marginsModule->topLE->setEnabled(custom_margins);
+ marginsModule->topUnit->setEnabled(custom_margins);
+
+ marginsModule->bottomL->setEnabled(custom_margins);
+ marginsModule->bottomLE->setEnabled(custom_margins);
+ marginsModule->bottomUnit->setEnabled(custom_margins);
- marginsModule->innerL->setEnabled(!custom);
- marginsModule->innerLE->setEnabled(!custom);
- marginsModule->innerUnit->setEnabled(!custom);
+ marginsModule->innerL->setEnabled(custom_margins);
+ marginsModule->innerLE->setEnabled(custom_margins);
+ marginsModule->innerUnit->setEnabled(custom_margins);
- marginsModule->outerL->setEnabled(!custom);
- marginsModule->outerLE->setEnabled(!custom);
- marginsModule->outerUnit->setEnabled(!custom);
+ marginsModule->outerL->setEnabled(custom_margins);
+ marginsModule->outerLE->setEnabled(custom_margins);
+ marginsModule->outerUnit->setEnabled(custom_margins);
- marginsModule->headheightL->setEnabled(!custom);
- marginsModule->headheightLE->setEnabled(!custom);
- marginsModule->headheightUnit->setEnabled(!custom);
+ marginsModule->headheightL->setEnabled(custom_margins);
+ marginsModule->headheightLE->setEnabled(custom_margins);
+ marginsModule->headheightUnit->setEnabled(custom_margins);
- marginsModule->headsepL->setEnabled(!custom);
- marginsModule->headsepLE->setEnabled(!custom);
- marginsModule->headsepUnit->setEnabled(!custom);
+ marginsModule->headsepL->setEnabled(custom_margins);
+ marginsModule->headsepLE->setEnabled(custom_margins);
+ marginsModule->headsepUnit->setEnabled(custom_margins);
- marginsModule->footskipL->setEnabled(!custom);
- marginsModule->footskipLE->setEnabled(!custom);
- marginsModule->footskipUnit->setEnabled(!custom);
+ marginsModule->footskipL->setEnabled(custom_margins);
+ marginsModule->footskipLE->setEnabled(custom_margins);
+ marginsModule->footskipUnit->setEnabled(custom_margins);
- bool const enableColSep = !custom &&
- textLayoutModule->twoColumnCB->checkState() == Qt::Checked;
+ bool const enableColSep = custom_margins &&
+ textLayoutModule->twoColumnCB->isChecked();
marginsModule->columnsepL->setEnabled(enableColSep);
marginsModule->columnsepLE->setEnabled(enableColSep);
marginsModule->columnsepUnit->setEnabled(enableColSep);