]> 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 8611c23d7c2fff68586670e0d032d8c4f8a42ee0..adca0947041da0107f4825ac3a3c4546630c749c 100644 (file)
@@ -177,7 +177,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
@@ -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);
 
@@ -861,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(
@@ -924,6 +925,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()));
@@ -946,7 +949,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()));
@@ -1594,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."),
@@ -1697,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)),
@@ -1820,6 +1825,12 @@ void GuiDocument::shellescapeChanged()
        changed();
 }
 
+void GuiDocument::bookmarksopenChanged(bool state)
+{
+       pdfSupportModule->bookmarksopenlevelSB->setEnabled(state);
+       pdfSupportModule->bookmarksopenlevelLA->setEnabled(state);
+}
+
 
 void GuiDocument::slotApply()
 {
@@ -2021,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();
@@ -2488,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(
@@ -2588,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();
@@ -2695,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();
 }
@@ -2709,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();
 }
@@ -3604,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));
@@ -3704,6 +3720,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 =
@@ -4106,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(
@@ -4358,6 +4364,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
@@ -4436,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);
@@ -4738,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;
 }