]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
Fix the enabling/disabling of the custom latex font encoding lineedit.
[lyx.git] / src / frontends / qt4 / GuiDocument.cpp
index 8426b492823a1fa3545f6935ac16e389f917851d..8c71cf93c2d58b5ce23c1eeedddd0846a90b55d9 100644 (file)
@@ -662,6 +662,14 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(outputModule->mathoutCB, SIGNAL(currentIndexChanged(int)),
                this, SLOT(change_adaptor()));
 
+       connect(outputModule->outputsyncCB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
+       connect(outputModule->synccustomCB, SIGNAL(editTextChanged(QString)),
+               this, SLOT(change_adaptor()));
+       outputModule->synccustomCB->addItem("");
+       outputModule->synccustomCB->addItem("\\synctex=1");
+       outputModule->synccustomCB->addItem("\\synctex=-1");
+       outputModule->synccustomCB->addItem("\\usepackage[active]{srcltx}");
 
        // fonts
        fontModule = new UiWidget<Ui::FontUi>;
@@ -721,7 +729,7 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
                this, SLOT(papersizeChanged(int)));
        connect(pageLayoutModule->portraitRB, SIGNAL(clicked()),
-               this, SLOT(portraitChanged()));
+               this, SLOT(change_adaptor()));
        connect(pageLayoutModule->papersizeCO, SIGNAL(activated(int)),
                this, SLOT(change_adaptor()));
        connect(pageLayoutModule->paperheightLE, SIGNAL(textChanged(const QString &)),
@@ -1297,13 +1305,7 @@ void GuiDocument::enableSkip(bool skip)
 }
 
 
-void GuiDocument::portraitChanged()
-{
-       setMargins(pageLayoutModule->papersizeCO->currentIndex());
-}
-
-
-void GuiDocument::setMargins(bool custom)
+void GuiDocument::setMargins()
 {
        bool const extern_geometry =
                documentClass().provides("geometry");
@@ -1311,10 +1313,10 @@ void GuiDocument::setMargins(bool custom)
        if (extern_geometry) {
                marginsModule->marginCB->setChecked(false);
                setCustomMargins(true);
-               return;
+       } else {
+               marginsModule->marginCB->setChecked(!bp_.use_geometry);
+               setCustomMargins(!bp_.use_geometry);
        }
-       marginsModule->marginCB->setChecked(custom);
-       setCustomMargins(custom);
 }
 
 
@@ -1523,7 +1525,10 @@ void GuiDocument::xetexChanged(bool xetex)
        
        fontModule->fontencLA->setEnabled(!xetex);
        fontModule->fontencCO->setEnabled(!xetex);
-       fontModule->fontencLE->setEnabled(!xetex);
+       if (xetex)
+               fontModule->fontencLE->setEnabled(false);
+       else
+               fontencChanged(fontModule->fontencCO->currentIndex());
 }
 
 
@@ -2280,6 +2285,9 @@ void GuiDocument::applyView()
        bool const xetex = outputModule->xetexCB->isChecked();
        bp_.useXetex = xetex;
 
+       bp_.output_sync = outputModule->outputsyncCB->isChecked();
+       bp_.output_sync_macro = fromqstr(outputModule->synccustomCB->currentText());
+
        int mathfmt = outputModule->mathoutCB->currentIndex();
        if (mathfmt == -1)
                mathfmt = 0;
@@ -2353,12 +2361,6 @@ void GuiDocument::applyView()
        bp_.papersize = PAPER_SIZE(
                pageLayoutModule->papersizeCO->currentIndex());
 
-       // only custom, A4, B4, B5 and the US sizes don't need the LaTeX-
-       // package gegeometry
-       int psize = pageLayoutModule->papersizeCO->currentIndex();
-       bool geom_papersize = (psize != 1 && psize != 2 && psize != 3
-               && psize != 4 && psize != 9 && psize != 10 && psize != 17);
-
        bp_.paperwidth = widgetsToLength(pageLayoutModule->paperwidthLE,
                pageLayoutModule->paperwidthUnitCO);
 
@@ -2376,8 +2378,7 @@ void GuiDocument::applyView()
                bp_.orientation = ORIENTATION_PORTRAIT;
 
        // margins
-       bp_.use_geometry = !marginsModule->marginCB->isChecked()
-               || geom_papersize;
+       bp_.use_geometry = !marginsModule->marginCB->isChecked();
 
        Ui::MarginsUi const * m = marginsModule;
 
@@ -2717,6 +2718,9 @@ void GuiDocument::paramsToDialog()
        outputModule->xetexCB->setChecked(
                bp_.baseClass()->outputType() == lyx::LATEX && bp_.useXetex);
 
+       outputModule->outputsyncCB->setChecked(bp_.output_sync);
+       outputModule->synccustomCB->setEditText(toqstr(bp_.output_sync_macro));
+
        outputModule->mathimgSB->setValue(bp_.html_math_img_scale);
        outputModule->mathoutCB->setCurrentIndex(bp_.html_math_output);
        outputModule->strictCB->setChecked(bp_.html_be_strict);
@@ -2787,11 +2791,13 @@ void GuiDocument::paramsToDialog()
        if (nn >= 0)
                fontModule->fontsDefaultCO->setCurrentIndex(nn);
 
-       if (bp_.fontenc == "global")
+       if (bp_.fontenc == "global") {
                fontModule->fontencCO->setCurrentIndex(0);
-       else if (bp_.fontenc == "default")
+               fontModule->fontencLE->setEnabled(false);
+       } else if (bp_.fontenc == "default") {
                fontModule->fontencCO->setCurrentIndex(2);
-       else {
+               fontModule->fontencLE->setEnabled(false);
+       } else {
                fontModule->fontencCO->setCurrentIndex(1);
                fontModule->fontencLE->setText(toqstr(bp_.fontenc));
        }
@@ -2822,7 +2828,7 @@ void GuiDocument::paramsToDialog()
        // margins
        Ui::MarginsUi * m = marginsModule;
 
-       setMargins(!bp_.use_geometry);
+       setMargins();
 
        lengthToWidgets(m->topLE, m->topUnit,
                bp_.topmargin, defaultUnit);