]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt/GuiDocument.cpp
#10571 improved handling of WM's signal when switching from or to full-screen window
[features.git] / src / frontends / qt / GuiDocument.cpp
index 095c0a2ca4bf970596c3397e0a6899f7a8c0daa1..adca0947041da0107f4825ac3a3c4546630c749c 100644 (file)
@@ -162,22 +162,21 @@ enum EncodingSets {
        custom = 2
 };
 
-} // anonymous namespace
-
-namespace lyx {
-
-RGBColor set_backgroundcolor;
+lyx::RGBColor set_backgroundcolor;
 bool is_backgroundcolor;
-RGBColor set_fontcolor;
+lyx::RGBColor set_fontcolor;
 bool is_fontcolor;
-RGBColor set_notefontcolor;
-RGBColor set_boxbgcolor;
+lyx::RGBColor set_notefontcolor;
+lyx::RGBColor set_boxbgcolor;
 bool forced_fontspec_activation;
 
+} // anonymous namespace
+
+namespace lyx {
+
 namespace {
 // used when sorting the textclass list.
 class less_textclass_avail_desc
-       : public binary_function<string, string, int>
 {
 public:
        bool operator()(string const & lhs, string const & rhs) const
@@ -269,17 +268,17 @@ class ModuleSelectionManager : public GuiSelectionManager
 public:
        ///
        ModuleSelectionManager(QObject * parent,
-                              QTreeView * availableLV,
-                              QTreeView * selectedLV,
-                              QPushButton * addPB,
-                              QPushButton * delPB,
-                              QPushButton * upPB,
-                              QPushButton * downPB,
-                              QStandardItemModel * availableModel,
-                              GuiIdListModel * selectedModel,
+                                                  QTreeView * availableLVarg,
+                                                  QTreeView * selectedLVarg,
+                                                  QPushButton * addPBarg,
+                                                  QPushButton * delPBarg,
+                                                  QPushButton * upPBarg,
+                                                  QPushButton * downPBarg,
+                                                  QStandardItemModel * availableModelarg,
+                                                  GuiIdListModel * selectedModelarg,
                               GuiDocument const * container)
-               : GuiSelectionManager(parent, availableLV, selectedLV, addPB, delPB,
-                                     upPB, downPB, availableModel, selectedModel),
+               : GuiSelectionManager(parent, availableLVarg, selectedLVarg, addPBarg, delPBarg,
+                                                         upPBarg, downPBarg, availableModelarg, selectedModelarg),
                  container_(container)
                {}
        ///
@@ -358,7 +357,7 @@ void ModuleSelectionManager::updateDownPB()
                return;
        }
 
-       // determine whether immediately succeding element requires this one
+       // determine whether immediately succeeding element requires this one
        string const curmodname = getSelectedModel()->getIDString(curRow);
        string const nextmodname = getSelectedModel()->getIDString(curRow + 1);
 
@@ -477,7 +476,7 @@ void ModuleSelectionManager::updateDelPB()
 /////////////////////////////////////////////////////////////////////
 
 PreambleModule::PreambleModule(QWidget * parent)
-       : UiWidget<Ui::PreambleUi>(parent), current_id_(0)
+       : UiWidget<Ui::PreambleUi>(parent), current_id_(nullptr)
 {
        // This is not a memory leak. The object will be destroyed
        // with this.
@@ -495,7 +494,13 @@ PreambleModule::PreambleModule(QWidget * parent)
        // https://stackoverflow.com/questions/13027091/how-to-override-tab-width-in-qt
        const int tabStop = 4;
        QFontMetrics metrics(preambleTE->currentFont());
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
+       // horizontalAdvance() is available starting in 5.11.0
+       // setTabStopDistance() is available starting in 5.10.0
+       preambleTE->setTabStopDistance(tabStop * metrics.horizontalAdvance(' '));
+#else
        preambleTE->setTabStopWidth(tabStop * metrics.width(' '));
+#endif
 }
 
 
@@ -602,7 +607,7 @@ void PreambleModule::editExternal() {
 
 
 LocalLayout::LocalLayout(QWidget * parent)
-       : UiWidget<Ui::LocalLayoutUi>(parent), current_id_(0), validated_(false)
+       : UiWidget<Ui::LocalLayoutUi>(parent), current_id_(nullptr), validated_(false)
 {
        locallayoutTE->setFont(guiApp->typewriterSystemFont());
        locallayoutTE->setWordWrapMode(QTextOption::NoWrap);
@@ -855,10 +860,12 @@ GuiDocument::GuiDocument(GuiView & lv)
 
        textLayoutModule->indentCO->addItem(qt_("Default"));
        textLayoutModule->indentCO->addItem(qt_("Custom"));
-       textLayoutModule->skipCO->addItem(qt_("SmallSkip"));
-       textLayoutModule->skipCO->addItem(qt_("MedSkip"));
-       textLayoutModule->skipCO->addItem(qt_("BigSkip"));
-       textLayoutModule->skipCO->addItem(qt_("Custom"));
+       textLayoutModule->skipCO->addItem(qt_("Half line height"), VSpace::HALFLINE);
+       textLayoutModule->skipCO->addItem(qt_("Line height"), VSpace::FULLLINE);
+       textLayoutModule->skipCO->addItem(qt_("SmallSkip"), VSpace::SMALLSKIP);
+       textLayoutModule->skipCO->addItem(qt_("MedSkip"), VSpace::MEDSKIP);
+       textLayoutModule->skipCO->addItem(qt_("BigSkip"), VSpace::BIGSKIP);
+       textLayoutModule->skipCO->addItem(qt_("Custom"), VSpace::LENGTH);
        textLayoutModule->lspacingCO->insertItem(
                Spacing::Single, qt_("Single"));
        textLayoutModule->lspacingCO->insertItem(
@@ -883,19 +890,27 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(masterChildModule->includeonlyRB, SIGNAL(toggled(bool)),
                masterChildModule->childrenTW, SLOT(setEnabled(bool)));
        connect(masterChildModule->includeonlyRB, SIGNAL(toggled(bool)),
-               masterChildModule->maintainAuxCB, SLOT(setEnabled(bool)));
+               masterChildModule->maintainGB, SLOT(setEnabled(bool)));
        connect(masterChildModule->includeallRB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
        connect(masterChildModule->includeonlyRB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
-       connect(masterChildModule->maintainAuxCB, SIGNAL(clicked()),
+       connect(masterChildModule->maintainCRNoneRB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
+       connect(masterChildModule->maintainCRMostlyRB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
+       connect(masterChildModule->maintainCRStrictRB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
        masterChildModule->childrenTW->setColumnCount(2);
        masterChildModule->childrenTW->headerItem()->setText(0, qt_("Child Document"));
        masterChildModule->childrenTW->headerItem()->setText(1, qt_("Include to Output"));
-       masterChildModule->childrenTW->resizeColumnToContents(1);
-       masterChildModule->childrenTW->resizeColumnToContents(2);
-
+#if (QT_VERSION > 0x050000)
+        masterChildModule->childrenTW->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
+        masterChildModule->childrenTW->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents);
+#else
+        masterChildModule->childrenTW->header()->setResizeMode(0, QHeaderView::ResizeToContents);
+        masterChildModule->childrenTW->header()->setResizeMode(1, QHeaderView::ResizeToContents);
+#endif
 
        // Formats
        outputModule = new UiWidget<Ui::OutputUi>(this);
@@ -910,11 +925,13 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(outputModule->mathoutCB, SIGNAL(currentIndexChanged(int)),
                this, SLOT(change_adaptor()));
+       connect(outputModule->tableoutCB, SIGNAL(currentIndexChanged(int)),
+               this, SLOT(change_adaptor()));
 
        connect(outputModule->shellescapeCB, SIGNAL(stateChanged(int)),
                this, SLOT(shellescapeChanged()));
-       connect(outputModule->outputsyncCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
+       connect(outputModule->outputsyncCB, SIGNAL(toggled(bool)),
+               this, SLOT(setOutputSync(bool)));
        connect(outputModule->synccustomCB, SIGNAL(editTextChanged(QString)),
                this, SLOT(change_adaptor()));
        outputModule->synccustomCB->addItem("");
@@ -926,11 +943,13 @@ GuiDocument::GuiDocument(GuiView & lv)
                outputModule->synccustomCB));
 
        connect(outputModule->saveTransientPropertiesCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
+               this, SLOT(change_adaptor()));
+       connect(outputModule->postponeFragileCB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
 
 
        // language & quote
-       // this must preceed font, since fonts depend on this
+       // this must precede font, since fonts depend on this
        langModule = new UiWidget<Ui::LanguageUi>(this);
        connect(langModule->languageCO, SIGNAL(activated(int)),
                this, SLOT(change_adaptor()));
@@ -1309,8 +1328,8 @@ GuiDocument::GuiDocument(GuiView & lv)
        changesModule = new UiWidget<Ui::ChangeTrackingUi>(this);
        connect(changesModule->trackChangesCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
-       connect(changesModule->outputChangesCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
+       connect(changesModule->outputChangesCB, SIGNAL(toggled(bool)),
+               this, SLOT(outputChangesToggled(bool)));
        connect(changesModule->changeBarsCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
 
@@ -1578,7 +1597,7 @@ GuiDocument::GuiDocument(GuiView & lv)
                // tooltip sensu "KOMA-Script Article [Class 'scrartcl']"
                QString tooltip = toqstr(bformat(_("%1$s [Class '%2$s']"), guiname, from_utf8(tc.latexname())));
                if (!available) {
-                       docstring const output_type = (tc.outputType() == lyx::DOCBOOK) ? _("DocBook") : _("LaTeX");
+                       docstring const output_type = _("LaTeX");
                        tooltip += '\n' + toqstr(bformat(_("Class not found by LyX. "
                                                           "Please check if you have the matching %1$s class "
                                                           "and all required packages (%2$s) installed."),
@@ -1681,6 +1700,8 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(pdfSupportModule->bookmarksopenGB, SIGNAL(toggled(bool)),
                this, SLOT(change_adaptor()));
+       connect(pdfSupportModule->bookmarksopenGB, SIGNAL(toggled(bool)),
+               this, SLOT(bookmarksopenChanged(bool)));
        connect(pdfSupportModule->bookmarksopenlevelSB, SIGNAL(valueChanged(int)),
                this, SLOT(change_adaptor()));
        connect(pdfSupportModule->breaklinksCB, SIGNAL(toggled(bool)),
@@ -1804,6 +1825,12 @@ void GuiDocument::shellescapeChanged()
        changed();
 }
 
+void GuiDocument::bookmarksopenChanged(bool state)
+{
+       pdfSupportModule->bookmarksopenlevelSB->setEnabled(state);
+       pdfSupportModule->bookmarksopenlevelLA->setEnabled(state);
+}
+
 
 void GuiDocument::slotApply()
 {
@@ -1909,7 +1936,7 @@ void GuiDocument::resetModuleFilter()
 
 void GuiDocument::includeonlyClicked(QTreeWidgetItem * item, int)
 {
-       if (item == 0)
+       if (item == nullptr)
                return;
 
        string child = fromqstr(item->text(0));
@@ -1949,13 +1976,13 @@ void GuiDocument::setListingsMessage()
                if (isOK)
                        return;
                isOK = true;
-               // listingsTB->setTextColor("black");
+               // listingsModule->listingsTB->setTextColor("black");
                listingsModule->listingsTB->setPlainText(
                        qt_("Input listings parameters below. "
                            "Enter ? for a list of parameters."));
        } else {
                isOK = false;
-               // listingsTB->setTextColor("red");
+               // listingsModule->listingsTB->setTextColor("red");
                listingsModule->listingsTB->setPlainText(msg);
        }
 }
@@ -2005,7 +2032,9 @@ void GuiDocument::enableIndent(bool indent)
 
 void GuiDocument::setSkip(int item)
 {
-       bool const enable = (item == 3);
+       VSpace::VSpaceKind kind =
+               VSpace::VSpaceKind(textLayoutModule->skipCO->itemData(item).toInt());
+       bool const enable = (kind == VSpace::LENGTH);
        textLayoutModule->skipLE->setEnabled(enable);
        textLayoutModule->skipLengthCO->setEnabled(enable);
        isValid();
@@ -2268,7 +2297,7 @@ void GuiDocument::languageChanged(int i)
        Language const * lang = lyx::languages.getLanguage(
                fromqstr(langModule->languageCO->itemData(i).toString()));
        if (lang->babel().empty() && !lang->polyglossia().empty()
-               && lang->requires() != "CJK" && lang->requires() != "japanese") {
+               && lang->required() != "CJK" && lang->required() != "japanese") {
                        // If we force to switch fontspec on, store
                        // current state (#8717)
                        if (fontModule->osFontsCB->isEnabled())
@@ -2472,16 +2501,16 @@ void GuiDocument::updateFontOptions()
        if (tex_fonts)
                font = fontModule->fontsSansCO->itemData(
                                fontModule->fontsSansCO->currentIndex()).toString();
-       bool scaleable = providesScale(font);
-       fontModule->scaleSansSB->setEnabled(scaleable);
-       fontModule->scaleSansLA->setEnabled(scaleable);
+       bool scalable = providesScale(font);
+       fontModule->scaleSansSB->setEnabled(scalable);
+       fontModule->scaleSansLA->setEnabled(scalable);
        fontModule->fontSansOsfCB->setEnabled(providesOSF(font));
        if (tex_fonts)
                font = fontModule->fontsTypewriterCO->itemData(
                                fontModule->fontsTypewriterCO->currentIndex()).toString();
-       scaleable = providesScale(font);
-       fontModule->scaleTypewriterSB->setEnabled(scaleable);
-       fontModule->scaleTypewriterLA->setEnabled(scaleable);
+       scalable = providesScale(font);
+       fontModule->scaleTypewriterSB->setEnabled(scalable);
+       fontModule->scaleTypewriterLA->setEnabled(scalable);
        fontModule->fontTypewriterOsfCB->setEnabled(providesOSF(font));
        if (tex_fonts)
                font = fontModule->fontsRomanCO->itemData(
@@ -2572,6 +2601,10 @@ void GuiDocument::updateTexFonts()
 
 void GuiDocument::updateFontlist()
 {
+       // reset the filters of the CategorizedCombos
+       fontModule->fontsRomanCO->resetFilter();
+       fontModule->fontsSansCO->resetFilter();
+       fontModule->fontsTypewriterCO->resetFilter();
        fontModule->fontsRomanCO->clear();
        fontModule->fontsSansCO->clear();
        fontModule->fontsTypewriterCO->clear();
@@ -2679,9 +2712,9 @@ void GuiDocument::sansChanged(int item)
                return;
        QString const font =
                fontModule->fontsSansCO->itemData(item).toString();
-       bool const scaleable = providesScale(font);
-       fontModule->scaleSansSB->setEnabled(scaleable);
-       fontModule->scaleSansLA->setEnabled(scaleable);
+       bool const scalable = providesScale(font);
+       fontModule->scaleSansSB->setEnabled(scalable);
+       fontModule->scaleSansLA->setEnabled(scalable);
        fontModule->fontSansOsfCB->setEnabled(providesOSF(font));
        updateExtraOpts();
 }
@@ -2693,9 +2726,9 @@ void GuiDocument::ttChanged(int item)
                return;
        QString const font =
                fontModule->fontsTypewriterCO->itemData(item).toString();
-       bool scaleable = providesScale(font);
-       fontModule->scaleTypewriterSB->setEnabled(scaleable);
-       fontModule->scaleTypewriterLA->setEnabled(scaleable);
+       bool scalable = providesScale(font);
+       fontModule->scaleTypewriterSB->setEnabled(scalable);
+       fontModule->scaleTypewriterLA->setEnabled(scalable);
        fontModule->fontTypewriterOsfCB->setEnabled(providesOSF(font));
        updateExtraOpts();
 }
@@ -2965,8 +2998,8 @@ void GuiDocument::updateEngineDependends()
                                biblioModule->citeEngineCO->currentIndex()).toString();
        LyXCiteEngine const * ce = theCiteEnginesList[fromqstr(engine)];
 
-       bool const citepack = ce->requires("biblatex.sty") || ce->requires("jurabib.sty")
-                       || ce->requires("natbib.sty");
+       bool const citepack = ce->required("biblatex.sty") || ce->required("jurabib.sty")
+                       || ce->required("natbib.sty");
        biblioModule->citePackageOptionsLE->setEnabled(citepack);
        biblioModule->citePackageOptionsL->setEnabled(citepack);
 }
@@ -3241,7 +3274,7 @@ void GuiDocument::updateNumbering()
        int const toc = numberingModule->tocSL->value();
        QString const no = qt_("No");
        QString const yes = qt_("Yes");
-       QTreeWidgetItem * item = 0;
+       QTreeWidgetItem * item = nullptr;
 
        DocumentClass::const_iterator lit = tclass.begin();
        DocumentClass::const_iterator len = tclass.end();
@@ -3588,25 +3621,24 @@ void GuiDocument::applyView()
        } else {
                // if paragraphs are separated by a skip
                bp_.paragraph_separation = BufferParams::ParagraphSkipSeparation;
-               switch (textLayoutModule->skipCO->currentIndex()) {
-               case 0:
-                       bp_.setDefSkip(VSpace(VSpace::SMALLSKIP));
-                       break;
-               case 1:
-                       bp_.setDefSkip(VSpace(VSpace::MEDSKIP));
-                       break;
-               case 2:
-                       bp_.setDefSkip(VSpace(VSpace::BIGSKIP));
+               VSpace::VSpaceKind spacekind =
+                       VSpace::VSpaceKind(textLayoutModule->skipCO->itemData(textLayoutModule->skipCO->currentIndex()).toInt());
+               switch (spacekind) {
+               case VSpace::SMALLSKIP:
+               case VSpace::MEDSKIP:
+               case VSpace::BIGSKIP:
+               case VSpace::HALFLINE:
+               case VSpace::FULLLINE:
+                       bp_.setDefSkip(VSpace(spacekind));
                        break;
-               case 3:
-                       {
+               case VSpace::LENGTH: {
                        VSpace vs = VSpace(
                                widgetsToLength(textLayoutModule->skipLE,
                                textLayoutModule->skipLengthCO)
                                );
                        bp_.setDefSkip(vs);
                        break;
-                       }
+               }
                default:
                        // this should never happen
                        bp_.setDefSkip(VSpace(VSpace::MEDSKIP));
@@ -3636,8 +3668,16 @@ void GuiDocument::applyView()
                        bp_.addIncludedChildren(*it);
                }
        }
-       bp_.maintain_unincluded_children =
-               masterChildModule->maintainAuxCB->isChecked();
+       if (masterChildModule->maintainCRNoneRB->isChecked())
+               bp_.maintain_unincluded_children =
+                       BufferParams::CM_None;
+       else if (masterChildModule->maintainCRMostlyRB->isChecked())
+               bp_.maintain_unincluded_children =
+                       BufferParams::CM_Mostly;
+       else
+               bp_.maintain_unincluded_children =
+                       BufferParams::CM_Strict;
+       updateIncludeonlyDisplay();
 
        // Float Settings
        bp_.float_placement = floatModule->getPlacement();
@@ -3680,8 +3720,17 @@ void GuiDocument::applyView()
        bp_.html_math_img_scale = outputModule->mathimgSB->value();
        bp_.display_pixel_ratio = theGuiApp()->pixelRatio();
 
+       int tablefmt = outputModule->tableoutCB->currentIndex();
+       if (tablefmt == -1)
+               tablefmt = 0;
+       BufferParams::TableOutput const to =
+                       static_cast<BufferParams::TableOutput>(tablefmt);
+       bp_.docbook_table_output = to;
+
        bp_.save_transient_properties =
                outputModule->saveTransientPropertiesCB->isChecked();
+       bp_.postpone_fragile_content =
+               outputModule->postponeFragileCB->isChecked();
 
        // fonts
        bp_.fonts_roman[nontexfonts] =
@@ -4080,32 +4129,15 @@ void GuiDocument::paramsToDialog()
                setIndent(indent);
        } else {
                textLayoutModule->skipRB->setChecked(true);
-               int skip = 0;
-               switch (bp_.getDefSkip().kind()) {
-               case VSpace::SMALLSKIP:
-                       skip = 0;
-                       break;
-               case VSpace::MEDSKIP:
-                       skip = 1;
-                       break;
-               case VSpace::BIGSKIP:
-                       skip = 2;
-                       break;
-               case VSpace::LENGTH:
-                       {
-                       skip = 3;
+               VSpace::VSpaceKind skip = bp_.getDefSkip().kind();
+               textLayoutModule->skipCO->setCurrentIndex(textLayoutModule->skipCO->findData(skip));
+               if (skip == VSpace::LENGTH) {
                        string const length = bp_.getDefSkip().asLyXCommand();
                        lengthToWidgets(textLayoutModule->skipLE,
                                textLayoutModule->skipLengthCO,
                                length, default_unit);
-                       break;
-                       }
-               default:
-                       skip = 0;
-                       break;
                }
-               textLayoutModule->skipCO->setCurrentIndex(skip);
-               setSkip(skip);
+               setSkip(textLayoutModule->skipCO->currentIndex());
        }
 
        textLayoutModule->twoColumnCB->setChecked(
@@ -4164,9 +4196,20 @@ void GuiDocument::paramsToDialog()
                masterChildModule->setEnabled(true);
                includeonlys_ = bp_.getIncludedChildren();
                updateIncludeonlys();
+               updateIncludeonlyDisplay();
+       }
+       switch (bp_.maintain_unincluded_children) {
+       case BufferParams::CM_None:
+               masterChildModule->maintainCRNoneRB->setChecked(true);
+               break;
+       case BufferParams::CM_Mostly:
+               masterChildModule->maintainCRMostlyRB->setChecked(true);
+               break;
+       case BufferParams::CM_Strict:
+       default:
+               masterChildModule->maintainCRStrictRB->setChecked(true);
+               break;
        }
-       masterChildModule->maintainAuxCB->setChecked(
-               bp_.maintain_unincluded_children);
 
        // Float Settings
        floatModule->setPlacement(bp_.float_placement);
@@ -4188,7 +4231,7 @@ void GuiDocument::paramsToDialog()
                        langModule->languageCO->currentIndex()).toString()));
        bool const need_fontspec =
                lang->babel().empty() && !lang->polyglossia().empty()
-               && lang->requires() != "CJK" && lang->requires() != "japanese";
+               && lang->required() != "CJK" && lang->required() != "japanese";
        bool const os_fonts_available =
                bp_.baseClass()->outputType() == lyx::LATEX
                && LaTeXFeatures::isAvailable("fontspec");
@@ -4313,14 +4356,20 @@ void GuiDocument::paramsToDialog()
        outputModule->shellescapeCB->setChecked(bp_.shell_escape);
        outputModule->outputsyncCB->setChecked(bp_.output_sync);
        outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro));
+       outputModule->synccustomCB->setEnabled(bp_.output_sync);
+       outputModule->synccustomLA->setEnabled(bp_.output_sync);
 
        outputModule->mathimgSB->setValue(bp_.html_math_img_scale);
        outputModule->mathoutCB->setCurrentIndex(bp_.html_math_output);
        outputModule->strictCB->setChecked(bp_.html_be_strict);
        outputModule->cssCB->setChecked(bp_.html_css_as_file);
 
+       outputModule->tableoutCB->setCurrentIndex(bp_.docbook_table_output);
+
        outputModule->saveTransientPropertiesCB
                ->setChecked(bp_.save_transient_properties);
+       outputModule->postponeFragileCB
+               ->setChecked(bp_.postpone_fragile_content);
 
        // paper
        bool const extern_geometry =
@@ -4395,6 +4444,8 @@ void GuiDocument::paramsToDialog()
        pdfSupportModule->bookmarksopenGB->setChecked(pdf.bookmarksopen);
 
        pdfSupportModule->bookmarksopenlevelSB->setValue(pdf.bookmarksopenlevel);
+       pdfSupportModule->bookmarksopenlevelSB->setEnabled(pdf.bookmarksopen);
+       pdfSupportModule->bookmarksopenlevelLA->setEnabled(pdf.bookmarksopen);
 
        pdfSupportModule->breaklinksCB->setChecked(pdf.breaklinks);
        pdfSupportModule->pdfborderCB->setChecked(pdf.pdfborder);
@@ -4415,6 +4466,7 @@ void GuiDocument::paramsToDialog()
        changesModule->trackChangesCB->setChecked(bp_.track_changes);
        changesModule->outputChangesCB->setChecked(bp_.output_changes);
        changesModule->changeBarsCB->setChecked(bp_.change_bars);
+       changesModule->changeBarsCB->setEnabled(bp_.output_changes);
 
        // Make sure that the bc is in the INITIAL state
        if (bc().policy().buttonStatus(ButtonPolicy::RESTORE))
@@ -4454,12 +4506,13 @@ void GuiDocument::updateAvailableModules()
        unavbrush.setColor(Qt::gray);
        for (modInfoStruct const & m : modInfoList) {
                QStandardItem * item = new QStandardItem();
-               QStandardItem * catItem = new QStandardItem();
+               QStandardItem * catItem;
                QString const catname = m.category;
                QList<QStandardItem *> fcats = modules_av_model_.findItems(catname, Qt::MatchExactly);
                if (!fcats.empty())
                        catItem = fcats.first();
                else {
+                       catItem = new QStandardItem();
                        catItem->setText(catname);
                        catItem->setFont(catfont);
                        modules_av_model_.insertRow(i, catItem);
@@ -4494,21 +4547,26 @@ void GuiDocument::updateSelectedModules()
 }
 
 
-void GuiDocument::updateIncludeonlys()
+void GuiDocument::updateIncludeonlyDisplay()
 {
-       masterChildModule->childrenTW->clear();
-       QString const no = qt_("No");
-       QString const yes = qt_("Yes");
-
        if (includeonlys_.empty()) {
                masterChildModule->includeallRB->setChecked(true);
                masterChildModule->childrenTW->setEnabled(false);
-               masterChildModule->maintainAuxCB->setEnabled(false);
+               masterChildModule->maintainGB->setEnabled(false);
        } else {
                masterChildModule->includeonlyRB->setChecked(true);
                masterChildModule->childrenTW->setEnabled(true);
-               masterChildModule->maintainAuxCB->setEnabled(true);
+               masterChildModule->maintainGB->setEnabled(true);
        }
+}
+
+
+void GuiDocument::updateIncludeonlys()
+{
+       masterChildModule->childrenTW->clear();
+       QString const no = qt_("No");
+       QString const yes = qt_("Yes");
+
        ListOfBuffers children = buffer().getChildren();
        ListOfBuffers::const_iterator it  = children.begin();
        ListOfBuffers::const_iterator end = children.end();
@@ -4527,17 +4585,10 @@ void GuiDocument::updateIncludeonlys()
                else
                        all_unincluded = false;
        }
-       // Both if all childs are included and if none is included
+       // Both if all children are included and if none is included
        // is equal to "include all" (i.e., omit \includeonly).
-       // Thus, reset the GUI.
-       if (!has_unincluded || all_unincluded) {
-               masterChildModule->includeallRB->setChecked(true);
-               masterChildModule->childrenTW->setEnabled(false);
+       if (!has_unincluded || all_unincluded)
                includeonlys_.clear();
-       }
-       // If all are included, we need to update again.
-       if (!has_unincluded)
-               updateIncludeonlys();
 }
 
 
@@ -4697,7 +4748,7 @@ void GuiDocument::matchBiblatexStyles()
 
 void GuiDocument::updateContents()
 {
-       // Nothing to do here as the document settings is not cursor dependant.
+       // Nothing to do here as the document settings is not cursor dependent.
        return;
 }
 
@@ -4806,7 +4857,7 @@ void GuiDocument::clearParams()
 BufferId GuiDocument::id() const
 {
        BufferView const * const view = bufferview();
-       return view? &view->buffer() : 0;
+       return view? &view->buffer() : nullptr;
 }
 
 
@@ -5147,6 +5198,20 @@ void GuiDocument::linenoToggled(bool on)
 }
 
 
+void GuiDocument::outputChangesToggled(bool on)
+{
+       changesModule->changeBarsCB->setEnabled(on);
+       change_adaptor();
+}
+
+void GuiDocument::setOutputSync(bool on)
+{
+       outputModule->synccustomCB->setEnabled(on);
+       outputModule->synccustomLA->setEnabled(on);
+       change_adaptor();
+}
+
+
 
 Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }