]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt/GuiDocument.cpp
Re-initiate module filter after dialog re-opening (#12128)
[features.git] / src / frontends / qt / GuiDocument.cpp
index c62e955859156bb84d4171a8d7c1092a4e8ca798..515d30f592fcc36218f76bcfc7b01db9ddca285c 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Edwin Leuven
- * \author Richard Heck (modules)
+ * \author Richard Kimberly Heck (modules)
  *
  * Full author contact details are available in file CREDITS.
  */
 
 #include "GuiDocument.h"
 
+#include "BulletsModule.h"
 #include "CategorizedCombo.h"
+#include "FancyLineEdit.h"
 #include "GuiApplication.h"
 #include "GuiBranches.h"
 #include "GuiIndices.h"
 #include "GuiSelectionManager.h"
 #include "LaTeXHighlighter.h"
-#include "LengthCombo.h"
-#include "PanelStack.h"
 #include "Validator.h"
 
 #include "LayoutFile.h"
 #include "BranchList.h"
 #include "buffer_funcs.h"
 #include "Buffer.h"
-#include "BufferParams.h"
 #include "BufferView.h"
 #include "CiteEnginesList.h"
 #include "Color.h"
@@ -47,7 +46,6 @@
 #include "LayoutModuleList.h"
 #include "LyXRC.h"
 #include "ModuleList.h"
-#include "OutputParams.h"
 #include "PDFOptions.h"
 #include "qt_helpers.h"
 #include "Session.h"
@@ -57,6 +55,7 @@
 #include "VSpace.h"
 
 #include "insets/InsetListingsParams.h"
+#include "insets/InsetQuotes.h"
 
 #include "support/debug.h"
 #include "support/docstream.h"
 #include <sstream>
 #include <vector>
 
-#ifdef IN
-#undef IN
-#endif
-
 
 // a style sheet for buttons
 // this is for example used for the background color setting button
@@ -167,7 +162,9 @@ bool is_backgroundcolor;
 lyx::RGBColor set_fontcolor;
 bool is_fontcolor;
 lyx::RGBColor set_notefontcolor;
+bool is_notefontcolor;
 lyx::RGBColor set_boxbgcolor;
+bool is_boxbgcolor;
 bool forced_fontspec_activation;
 
 } // anonymous namespace
@@ -177,7 +174,6 @@ 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
@@ -290,13 +286,13 @@ public:
                        { excluded_modules_ = em.list(); }
 private:
        ///
-       virtual void updateAddPB();
+       void updateAddPB() override;
        ///
-       virtual void updateUpPB();
+       void updateUpPB() override;
        ///
-       virtual void updateDownPB();
+       void updateDownPB() override;
        ///
-       virtual void updateDelPB();
+       void updateDelPB() override;
        /// returns availableModel as a GuiIdListModel
        QStandardItemModel * getAvailableModel()
        {
@@ -358,7 +354,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);
 
@@ -495,7 +491,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
 }
 
 
@@ -855,10 +857,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,12 +887,16 @@ 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"));
@@ -914,6 +922,8 @@ 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()));
@@ -936,7 +946,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 
 
        // 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()));
@@ -1125,7 +1135,7 @@ GuiDocument::GuiDocument(GuiView & lv)
        fontModule->fontsizeCO->addItem(qt_("11"));
        fontModule->fontsizeCO->addItem(qt_("12"));
 
-       fontModule->fontencCO->addItem(qt_("Automatic"), QString("auto"));
+       fontModule->fontencCO->addItem(qt_("Automatic[[encoding]]"), QString("auto"));
        fontModule->fontencCO->addItem(qt_("Class Default"), QString("default"));
        fontModule->fontencCO->addItem(qt_("Custom"), QString("custom"));
 
@@ -1584,7 +1594,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."),
@@ -1665,7 +1675,7 @@ GuiDocument::GuiDocument(GuiView & lv)
                modulesModule->availableLV, SLOT(setFocus()));
 #else
        connect(filter_, &FancyLineEdit::downPressed,
-               modulesModule->availableLV, [=](){ focusAndHighlight(modulesModule->availableLV); });
+               modulesModule->availableLV, [this](){ focusAndHighlight(modulesModule->availableLV); });
 #endif
 
 
@@ -1687,6 +1697,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)),
@@ -1810,6 +1822,12 @@ void GuiDocument::shellescapeChanged()
        changed();
 }
 
+void GuiDocument::bookmarksopenChanged(bool state)
+{
+       pdfSupportModule->bookmarksopenlevelSB->setEnabled(state);
+       pdfSupportModule->bookmarksopenlevelLA->setEnabled(state);
+}
+
 
 void GuiDocument::slotApply()
 {
@@ -1878,6 +1896,7 @@ void GuiDocument::filterModules(QString const & str)
                        item->setData(m.name, Qt::DisplayRole);
                        item->setData(toqstr(m.id), Qt::UserRole);
                        item->setData(m.description, Qt::ToolTipRole);
+                       item->setEditable(false);
                        if (m.local)
                                item->setIcon(user_icon);
                        else
@@ -1955,13 +1974,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);
        }
 }
@@ -2011,7 +2030,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();
@@ -2061,6 +2082,30 @@ void GuiDocument::setMargins()
                marginsModule->marginCB->setChecked(!bp_.use_geometry);
                setCustomMargins(!bp_.use_geometry);
        }
+
+       // set some placeholder text that hint on defaults
+       QString const placeholder = marginsModule->marginCB->isChecked() ?
+               qt_("Class defaults") : qt_("Package defaults");
+       // set tooltip depending on gemoetry state
+       QString const tooltip = marginsModule->marginCB->isChecked() ?
+               qt_("If no value is given, the defaults as set by the class are used.")
+               : qt_("If no value is given, the defaults as set by the geometry package or a package/class overriding geometry's defaults are used.");
+       marginsModule->topLE->setPlaceholderText(placeholder);
+       marginsModule->bottomLE->setPlaceholderText(placeholder);
+       marginsModule->innerLE->setPlaceholderText(placeholder);
+       marginsModule->outerLE->setPlaceholderText(placeholder);
+       marginsModule->headheightLE->setPlaceholderText(placeholder);
+       marginsModule->headsepLE->setPlaceholderText(placeholder);
+       marginsModule->footskipLE->setPlaceholderText(placeholder);
+       marginsModule->columnsepLE->setPlaceholderText(placeholder);
+       marginsModule->topLE->setToolTip(tooltip);
+       marginsModule->bottomLE->setToolTip(tooltip);
+       marginsModule->innerLE->setToolTip(tooltip);
+       marginsModule->outerLE->setToolTip(tooltip);
+       marginsModule->headheightLE->setToolTip(tooltip);
+       marginsModule->headsepLE->setToolTip(tooltip);
+       marginsModule->footskipLE->setToolTip(tooltip);
+       marginsModule->columnsepLE->setToolTip(tooltip);
 }
 
 
@@ -2123,6 +2168,31 @@ void GuiDocument::setCustomMargins(bool custom)
        marginsModule->columnsepL->setEnabled(enableColSep);
        marginsModule->columnsepLE->setEnabled(enableColSep);
        marginsModule->columnsepUnit->setEnabled(enableColSep);
+
+       // set some placeholder text that hint on defaults
+       QString const placeholder = marginsModule->marginCB->isChecked() ?
+               qt_("Class defaults") : qt_("Package defaults");
+       // set tooltip depending on gemoetry state
+       QString const tooltip = marginsModule->marginCB->isChecked() ?
+               qt_("If no value is given, the defaults as set by the class are used.")
+               : qt_("If no value is given, the defaults as set by the geometry package or a package/class overriding geometry's defaults are used.");
+       marginsModule->topLE->setPlaceholderText(placeholder);
+       marginsModule->bottomLE->setPlaceholderText(placeholder);
+       marginsModule->innerLE->setPlaceholderText(placeholder);
+       marginsModule->outerLE->setPlaceholderText(placeholder);
+       marginsModule->headheightLE->setPlaceholderText(placeholder);
+       marginsModule->headsepLE->setPlaceholderText(placeholder);
+       marginsModule->footskipLE->setPlaceholderText(placeholder);
+       marginsModule->columnsepLE->setPlaceholderText(placeholder);
+       marginsModule->topLE->setToolTip(tooltip);
+       marginsModule->bottomLE->setToolTip(tooltip);
+       marginsModule->innerLE->setToolTip(tooltip);
+       marginsModule->outerLE->setToolTip(tooltip);
+       marginsModule->headheightLE->setToolTip(tooltip);
+       marginsModule->headsepLE->setToolTip(tooltip);
+       marginsModule->footskipLE->setToolTip(tooltip);
+       marginsModule->columnsepLE->setToolTip(tooltip);
+
 }
 
 
@@ -2197,6 +2267,7 @@ void GuiDocument::changeNoteFontColor()
                colorButtonStyleSheet(newColor));
        // save color
        set_notefontcolor = rgbFromHexName(fromqstr(newColor.name()));
+       is_notefontcolor = true;
        change_adaptor();
 }
 
@@ -2207,6 +2278,7 @@ void GuiDocument::deleteNoteFontColor()
        theApp()->getRgbColor(Color_greyedouttext, set_notefontcolor);
        colorModule->noteFontColorPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(set_notefontcolor)));
+       is_notefontcolor = false;
        change_adaptor();
 }
 
@@ -2222,6 +2294,7 @@ void GuiDocument::changeBoxBackgroundColor()
                colorButtonStyleSheet(newColor));
        // save color
        set_boxbgcolor = rgbFromHexName(fromqstr(newColor.name()));
+       is_boxbgcolor = true;
        change_adaptor();
 }
 
@@ -2232,6 +2305,7 @@ void GuiDocument::deleteBoxBackgroundColor()
        theApp()->getRgbColor(Color_shadedbg, set_boxbgcolor);
        colorModule->boxBackgroundPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(set_boxbgcolor)));
+       is_boxbgcolor = false;
        change_adaptor();
 }
 
@@ -2242,25 +2316,25 @@ void GuiDocument::updateQuoteStyles(bool const set)
                fromqstr(langModule->languageCO->itemData(
                        langModule->languageCO->currentIndex()).toString()));
 
-       InsetQuotesParams::QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle());
+       QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle());
 
        langModule->quoteStyleCO->clear();
 
        bool has_default = false;
        for (int i = 0; i < quoteparams.stylescount(); ++i) {
-               InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i);
-               if (qs == InsetQuotesParams::DynamicQuotes)
+               QuoteStyle qs = QuoteStyle(i);
+               if (qs == QuoteStyle::Dynamic)
                        continue;
                bool const langdef = (qs == def);
                if (langdef) {
                        // add the default style on top
                        langModule->quoteStyleCO->insertItem(0,
-                               toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+                               toqstr(quoteparams.getGuiLabel(qs, langdef)), static_cast<int>(qs));
                        has_default = true;
                }
                else
                        langModule->quoteStyleCO->addItem(
-                               toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+                               toqstr(quoteparams.getGuiLabel(qs, langdef)), static_cast<int>(qs));
        }
        if (set && has_default)
                // (re)set to the default style
@@ -2274,7 +2348,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())
@@ -2478,16 +2552,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(
@@ -2578,6 +2652,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();
@@ -2596,10 +2674,10 @@ void GuiDocument::updateFontlist()
 
                QFontDatabase fontdb;
                QStringList families(fontdb.families());
-               for (QStringList::Iterator it = families.begin(); it != families.end(); ++it) {
-                       fontModule->fontsRomanCO->addItem(*it, *it);
-                       fontModule->fontsSansCO->addItem(*it, *it);
-                       fontModule->fontsTypewriterCO->addItem(*it, *it);
+               for (auto const & family : families) {
+                       fontModule->fontsRomanCO->addItem(family, family);
+                       fontModule->fontsSansCO->addItem(family, family);
+                       fontModule->fontsTypewriterCO->addItem(family, family);
                }
                return;
        }
@@ -2685,9 +2763,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();
 }
@@ -2699,9 +2777,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();
 }
@@ -2727,9 +2805,9 @@ void GuiDocument::updatePagestyle(string const & items, string const & sel)
 
        int nn = 0;
 
-       for (size_t i = 0; i < pagestyles.size(); ++i)
-               if (pagestyles[i].first == sel)
-                       nn = pageLayoutModule->pagestyleCO->findText(pagestyles[i].second);
+       for (auto const & pagestyle : pagestyles)
+               if (pagestyle.first == sel)
+                       nn = pageLayoutModule->pagestyleCO->findText(pagestyle.second);
 
        if (nn > 0)
                pageLayoutModule->pagestyleCO->setCurrentIndex(nn);
@@ -2971,8 +3049,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);
 }
@@ -3287,7 +3365,7 @@ void GuiDocument::getTableStyles()
             << toqstr(system);
 
        for (int i = 0; i < dirs.size(); ++i) {
-               QString const dir = dirs.at(i);
+               QString const dir = dirs.at(i);
                QDirIterator it(dir, QDir::Files, QDirIterator::Subdirectories);
                while (it.hasNext()) {
                        QString fn = QFileInfo(it.next()).fileName();
@@ -3416,8 +3494,8 @@ void GuiDocument::applyView()
                        // this should never happen
                        bp_.inputenc = "utf8";
        }
-       bp_.quotes_style = (InsetQuotesParams::QuoteStyle) langModule->quoteStyleCO->itemData(
-               langModule->quoteStyleCO->currentIndex()).toInt();
+       bp_.quotes_style = QuoteStyle(langModule->quoteStyleCO->itemData(
+               langModule->quoteStyleCO->currentIndex()).toInt());
        bp_.dynamic_quotes = langModule->dynamicQuotesCB->isChecked();
 
        QString const langname = langModule->languageCO->itemData(
@@ -3445,7 +3523,9 @@ void GuiDocument::applyView()
        bp_.fontcolor = set_fontcolor;
        bp_.isfontcolor = is_fontcolor;
        bp_.notefontcolor = set_notefontcolor;
+       bp_.isnotefontcolor = is_notefontcolor;
        bp_.boxbgcolor = set_boxbgcolor;
+       bp_.isboxbgcolor = is_boxbgcolor;
 
        // numbering
        if (bp_.documentClass().hasTocLevels()) {
@@ -3594,25 +3674,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));
@@ -3642,8 +3721,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();
@@ -3686,6 +3773,13 @@ 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 =
@@ -3923,7 +4017,7 @@ void GuiDocument::paramsToDialog()
        updateQuoteStyles();
 
        langModule->quoteStyleCO->setCurrentIndex(
-               langModule->quoteStyleCO->findData(bp_.quotes_style));
+               langModule->quoteStyleCO->findData(static_cast<int>(bp_.quotes_style)));
        langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
 
        // LaTeX input encoding: set after the fonts (see below)
@@ -3949,6 +4043,7 @@ void GuiDocument::paramsToDialog()
        colorModule->noteFontColorPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(bp_.notefontcolor)));
        set_notefontcolor = bp_.notefontcolor;
+       is_notefontcolor = bp_.isnotefontcolor;
 
        if (bp_.isbackgroundcolor) {
                colorModule->backgroundPB->setStyleSheet(
@@ -3960,6 +4055,7 @@ void GuiDocument::paramsToDialog()
        colorModule->boxBackgroundPB->setStyleSheet(
                colorButtonStyleSheet(rgb2qcolor(bp_.boxbgcolor)));
        set_boxbgcolor = bp_.boxbgcolor;
+       is_boxbgcolor = bp_.isboxbgcolor;
 
        // numbering
        int const min_toclevel = documentClass().min_toclevel();
@@ -4088,32 +4184,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(
@@ -4172,9 +4251,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);
@@ -4196,7 +4286,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");
@@ -4329,6 +4419,8 @@ void GuiDocument::paramsToDialog()
        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
@@ -4407,6 +4499,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);
@@ -4436,6 +4530,10 @@ void GuiDocument::paramsToDialog()
        // clear changed branches cache
        changedBranches_.clear();
 
+       // re-initiate module filter
+       if (!filter_->text().isEmpty())
+               moduleFilterPressed();
+
        // reset trackers
        nonModuleChanged_ = false;
        shellescapeChanged_ = false;
@@ -4508,21 +4606,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();
@@ -4541,17 +4644,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();
 }
 
 
@@ -4711,7 +4807,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;
 }
 
@@ -4898,7 +4994,7 @@ void GuiDocument::dispatchParams()
                FileName const master_file = support::makeAbsPath(params().master,
                           support::onlyPath(buffer().absFileName()));
                if (isLyXFileName(master_file.absFileName())) {
-                       Buffer * master = checkAndLoadLyXFile(master_file);
+                       Buffer * master = checkAndLoadLyXFile(master_file, true);
                        if (master) {
                                if (master->isChild(const_cast<Buffer *>(&buffer())))
                                        const_cast<Buffer &>(buffer()).setParent(master);
@@ -4927,7 +5023,13 @@ void GuiDocument::dispatchParams()
                for (; it != end; ++it) {
                        docstring const & current_branch = it->branch();
                        Branch const * branch = branchlist.find(current_branch);
-                       string const x11hexname = X11hexname(branch->color());
+                       string const bcolor = branch->color();
+                       RGBColor rgbcol;
+                       if (bcolor.size() == 7 && bcolor[0] == '#')
+                               rgbcol = lyx::rgbFromHexName(bcolor);
+                       else
+                               guiApp->getRgbColor(lcolor.getFromLyXName(bcolor), rgbcol);
+                       string const x11hexname = X11hexname(rgbcol);
                        // display the new color
                        docstring const str = current_branch + ' ' + from_ascii(x11hexname);
                        dispatch(FuncRequest(LFUN_SET_COLOR, str));
@@ -5175,10 +5277,6 @@ void GuiDocument::setOutputSync(bool on)
 }
 
 
-
-Dialog * createGuiDocument(GuiView & lv) { return new GuiDocument(lv); }
-
-
 } // namespace frontend
 } // namespace lyx