]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
The Cursor argument here was not being used, so there is no need
[lyx.git] / src / frontends / qt4 / GuiDocument.cpp
index 98b5bf88dc512427b3d760f4e885112004025f68..7a1a4c9096b2e1752ed00fbf2c5adea0b15f10fa 100644 (file)
@@ -780,6 +780,9 @@ GuiDocument::GuiDocument(GuiView & lv)
        outputModule->synccustomCB->addItem("\\synctex=-1");
        outputModule->synccustomCB->addItem("\\usepackage[active]{srcltx}");
 
+       outputModule->synccustomCB->setValidator(new NoNewLineValidator(
+               outputModule->synccustomCB));
+
        // fonts
        fontModule = new UiWidget<Ui::FontUi>;
        connect(fontModule->osFontsCB, SIGNAL(clicked()),
@@ -819,6 +822,11 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(fontModule->fontOsfCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
 
+       fontModule->fontencLE->setValidator(new NoNewLineValidator(
+               fontModule->fontencLE));
+       fontModule->cjkFontLE->setValidator(new NoNewLineValidator(
+               fontModule->cjkFontLE));
+
        updateFontlist();
 
        fontModule->fontsizeCO->addItem(qt_("Default"));
@@ -1007,11 +1015,14 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(langModule->languagePackageCO, SIGNAL(activated(int)),
                this, SLOT(change_adaptor()));
-       connect(langModule->languagePackageED, SIGNAL(textChanged(QString)),
+       connect(langModule->languagePackageLE, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
        connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
                this, SLOT(languagePackageChanged(int)));
 
+       langModule->languagePackageLE->setValidator(new NoNewLineValidator(
+               langModule->languagePackageLE));
+
        QAbstractItemModel * language_model = guiApp->languageModel();
        // FIXME: it would be nice if sorting was enabled/disabled via a checkbox.
        language_model->sort(0);
@@ -1102,9 +1113,12 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(biblioModule->bibtexCO, SIGNAL(activated(int)),
                this, SLOT(bibtexChanged(int)));
-       connect(biblioModule->bibtexOptionsED, SIGNAL(textChanged(QString)),
+       connect(biblioModule->bibtexOptionsLE, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
 
+       biblioModule->bibtexOptionsLE->setValidator(new NoNewLineValidator(
+               biblioModule->bibtexOptionsLE));
+
        biblioModule->citeStyleCO->addItem(qt_("Author-year"));
        biblioModule->citeStyleCO->addItem(qt_("Numerical"));
        biblioModule->citeStyleCO->setCurrentIndex(0);
@@ -1135,6 +1149,8 @@ GuiDocument::GuiDocument(GuiView & lv)
                mathsModule->mhchemCB, SLOT(setDisabled(bool)));
        connect(mathsModule->mathdotsautoCB, SIGNAL(toggled(bool)),
                mathsModule->mathdotsCB, SLOT(setDisabled(bool)));
+       connect(mathsModule->undertildeautoCB, SIGNAL(toggled(bool)),
+               mathsModule->undertildeCB, SLOT(setDisabled(bool)));
        
        connect(mathsModule->amsCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
@@ -1152,6 +1168,10 @@ GuiDocument::GuiDocument(GuiView & lv)
                this, SLOT(change_adaptor()));
        connect(mathsModule->mathdotsautoCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
+       connect(mathsModule->undertildeCB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
+       connect(mathsModule->undertildeautoCB, SIGNAL(clicked()),
+               this, SLOT(change_adaptor()));
        
 
        // latex class
@@ -1181,6 +1201,11 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(latexModule->refstyleCB, SIGNAL(clicked()),
                this, SLOT(change_adaptor()));
 
+       latexModule->optionsLE->setValidator(new NoNewLineValidator(
+               latexModule->optionsLE));
+       latexModule->childDocLE->setValidator(new NoNewLineValidator(
+               latexModule->childDocLE));
+
        // postscript drivers
        for (int n = 0; tex_graphics[n][0]; ++n) {
                QString enc = qt_(tex_graphics_gui[n]);
@@ -1282,6 +1307,17 @@ GuiDocument::GuiDocument(GuiView & lv)
        connect(pdfSupportModule->optionsLE, SIGNAL(textChanged(QString)),
                this, SLOT(change_adaptor()));
 
+       pdfSupportModule->titleLE->setValidator(new NoNewLineValidator(
+               pdfSupportModule->titleLE));
+       pdfSupportModule->authorLE->setValidator(new NoNewLineValidator(
+               pdfSupportModule->authorLE));
+       pdfSupportModule->subjectLE->setValidator(new NoNewLineValidator(
+               pdfSupportModule->subjectLE));
+       pdfSupportModule->keywordsLE->setValidator(new NoNewLineValidator(
+               pdfSupportModule->keywordsLE));
+       pdfSupportModule->optionsLE->setValidator(new NoNewLineValidator(
+               pdfSupportModule->optionsLE));
+
        for (int i = 0; backref_opts[i][0]; ++i)
                pdfSupportModule->backrefCO->addItem(qt_(backref_opts_gui[i]));
 
@@ -1817,7 +1853,7 @@ void GuiDocument::browseLayout()
        QString const label1 = qt_("Layouts|#o#O");
        QString const dir1 = toqstr(lyxrc.document_path);
        QStringList const filter(qt_("LyX Layout (*.layout)"));
-       QString file = browseRelFile(QString(), bufferFilePath(),
+       QString file = browseRelToParent(QString(), bufferFilePath(),
                qt_("Local layout file"), filter, false,
                label1, dir1);
 
@@ -1873,7 +1909,7 @@ void GuiDocument::browseMaster()
        QString const old = latexModule->childDocLE->text();
        QString const docpath = toqstr(support::onlyPath(buffer().absFileName()));
        QStringList const filter(qt_("LyX Files (*.lyx)"));
-       QString file = browseRelFile(old, docpath, title, filter, false,
+       QString file = browseRelToSub(old, docpath, title, filter, false,
                qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
 
        if (!file.isEmpty())
@@ -1939,14 +1975,14 @@ void GuiDocument::classChanged()
 
 void GuiDocument::languagePackageChanged(int i)
 {
-        langModule->languagePackageED->setEnabled(
+        langModule->languagePackageLE->setEnabled(
                langModule->languagePackageCO->itemData(i).toString() == "custom");
 }
 
 
 void GuiDocument::bibtexChanged(int n)
 {
-       biblioModule->bibtexOptionsED->setEnabled(
+       biblioModule->bibtexOptionsLE->setEnabled(
                biblioModule->bibtexCO->itemData(n).toString() != "default");
        changed();
 }
@@ -2204,7 +2240,7 @@ void GuiDocument::applyView()
                fromqstr(biblioModule->bibtexCO->itemData(
                        biblioModule->bibtexCO->currentIndex()).toString());
        string const bibtex_options =
-               fromqstr(biblioModule->bibtexOptionsED->text());
+               fromqstr(biblioModule->bibtexOptionsLE->text());
        if (bibtex_command == "default" || bibtex_options.empty())
                bp_.bibtex_command = bibtex_command;
        else
@@ -2272,7 +2308,7 @@ void GuiDocument::applyView()
                langModule->languagePackageCO->currentIndex()).toString();
        if (pack == "custom")
                bp_.lang_package =
-                       fromqstr(langModule->languagePackageED->text());
+                       fromqstr(langModule->languagePackageLE->text());
        else
                bp_.lang_package = fromqstr(pack);
 
@@ -2343,6 +2379,14 @@ void GuiDocument::applyView()
                else
                        bp_.use_mathdots = BufferParams::package_off;
        }
+       if (mathsModule->undertildeautoCB->isChecked())
+               bp_.use_undertilde = BufferParams::package_auto;
+       else {
+               if (mathsModule->undertildeCB->isChecked())
+                       bp_.use_undertilde = BufferParams::package_on;
+               else
+                       bp_.use_undertilde = BufferParams::package_off;
+       }
        
        // Page Layout
        if (pageLayoutModule->pagestyleCO->currentIndex() == 0)
@@ -2590,7 +2634,7 @@ void GuiDocument::applyView()
 void GuiDocument::paramsToDialog()
 {
        // set the default unit
-       Length::UNIT const defaultUnit = Length::defaultUnit();
+       Length::UNIT const default_unit = Length::defaultUnit();
 
        // preamble
        preambleModule->update(bp_, id());
@@ -2624,15 +2668,15 @@ void GuiDocument::paramsToDialog()
        int const bpos = biblioModule->bibtexCO->findData(toqstr(command));
        if (bpos != -1) {
                biblioModule->bibtexCO->setCurrentIndex(bpos);
-               biblioModule->bibtexOptionsED->setText(toqstr(options).trimmed());
+               biblioModule->bibtexOptionsLE->setText(toqstr(options).trimmed());
        } else {
                // We reset to default if we do not know the specified compiler
                // This is for security reasons
                biblioModule->bibtexCO->setCurrentIndex(
                        biblioModule->bibtexCO->findData(toqstr("default")));
-               biblioModule->bibtexOptionsED->clear();
+               biblioModule->bibtexOptionsLE->clear();
        }
-       biblioModule->bibtexOptionsED->setEnabled(
+       biblioModule->bibtexOptionsLE->setEnabled(
                biblioModule->bibtexCO->currentIndex() != 0);
 
        // indices
@@ -2677,10 +2721,10 @@ void GuiDocument::paramsToDialog()
        if (p == -1) {
                langModule->languagePackageCO->setCurrentIndex(
                          langModule->languagePackageCO->findData("custom"));
-               langModule->languagePackageED->setText(toqstr(bp_.lang_package));
+               langModule->languagePackageLE->setText(toqstr(bp_.lang_package));
        } else {
                langModule->languagePackageCO->setCurrentIndex(p);
-               langModule->languagePackageED->clear();
+               langModule->languagePackageLE->clear();
        }
 
        //color
@@ -2756,6 +2800,11 @@ void GuiDocument::paramsToDialog()
        mathsModule->mathdotsautoCB->setChecked(
                bp_.use_mathdots == BufferParams::package_auto);
 
+       mathsModule->undertildeCB->setChecked(
+               bp_.use_undertilde == BufferParams::package_on);
+       mathsModule->undertildeautoCB->setChecked(
+               bp_.use_undertilde == BufferParams::package_auto);
+
        switch (bp_.spacing().getSpace()) {
                case Spacing::Other: nitem = 3; break;
                case Spacing::Double: nitem = 2; break;
@@ -2784,7 +2833,7 @@ void GuiDocument::paramsToDialog()
                if (indentation != "default") {
                        lengthToWidgets(textLayoutModule->indentLE,
                        textLayoutModule->indentLengthCO,
-                       indentation, defaultUnit);
+                       indentation, default_unit);
                        indent = 1;
                }
                textLayoutModule->indentCO->setCurrentIndex(indent);
@@ -2808,7 +2857,7 @@ void GuiDocument::paramsToDialog()
                        string const length = bp_.getDefSkip().asLyXCommand();
                        lengthToWidgets(textLayoutModule->skipLE,
                                textLayoutModule->skipLengthCO,
-                               length, defaultUnit);
+                               length, default_unit);
                        break;
                        }
                default:
@@ -2996,9 +3045,9 @@ void GuiDocument::paramsToDialog()
                bp_.sides == TwoSides);
 
        lengthToWidgets(pageLayoutModule->paperwidthLE,
-               pageLayoutModule->paperwidthUnitCO, bp_.paperwidth, defaultUnit);
+               pageLayoutModule->paperwidthUnitCO, bp_.paperwidth, default_unit);
        lengthToWidgets(pageLayoutModule->paperheightLE,
-               pageLayoutModule->paperheightUnitCO, bp_.paperheight, defaultUnit);
+               pageLayoutModule->paperheightUnitCO, bp_.paperheight, default_unit);
 
        // margins
        Ui::MarginsUi * m = marginsModule;
@@ -3006,28 +3055,28 @@ void GuiDocument::paramsToDialog()
        setMargins();
 
        lengthToWidgets(m->topLE, m->topUnit,
-               bp_.topmargin, defaultUnit);
+               bp_.topmargin, default_unit);
 
        lengthToWidgets(m->bottomLE, m->bottomUnit,
-               bp_.bottommargin, defaultUnit);
+               bp_.bottommargin, default_unit);
 
        lengthToWidgets(m->innerLE, m->innerUnit,
-               bp_.leftmargin, defaultUnit);
+               bp_.leftmargin, default_unit);
 
        lengthToWidgets(m->outerLE, m->outerUnit,
-               bp_.rightmargin, defaultUnit);
+               bp_.rightmargin, default_unit);
 
        lengthToWidgets(m->headheightLE, m->headheightUnit,
-               bp_.headheight, defaultUnit);
+               bp_.headheight, default_unit);
 
        lengthToWidgets(m->headsepLE, m->headsepUnit,
-               bp_.headsep, defaultUnit);
+               bp_.headsep, default_unit);
 
        lengthToWidgets(m->footskipLE, m->footskipUnit,
-               bp_.footskip, defaultUnit);
+               bp_.footskip, default_unit);
 
        lengthToWidgets(m->columnsepLE, m->columnsepUnit,
-               bp_.columnsep, defaultUnit);
+               bp_.columnsep, default_unit);
 
        // branches
        updateUnknownBranches();