]> git.lyx.org Git - features.git/commitdiff
First step towards a more generic package off/auto/on handling:
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Tue, 3 Jan 2012 20:51:07 +0000 (20:51 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Tue, 3 Jan 2012 20:51:07 +0000 (20:51 +0000)
Internal machinery, no file format change and no UI change yet

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40562 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferParams.cpp
src/BufferParams.h
src/LaTeXFeatures.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/ui/MathsUi.ui
src/mathed/InsetMathHull.cpp
src/mathed/MathFactory.cpp
src/mathed/MathParser.cpp

index 38f298c76fa4a0a0a04b2e918ca2fc9e46c30516..03f9829364b74a7f1fd0c378d5846a7ab5c2611e 100644 (file)
@@ -361,11 +361,6 @@ BufferParams::BufferParams()
        papersize = PAPER_DEFAULT;
        orientation = ORIENTATION_PORTRAIT;
        use_geometry = false;
-       use_amsmath = package_auto;
-       use_esint = package_auto;
-       use_mhchem = package_auto;
-       use_mathdots = package_auto;
-       use_undertilde = package_auto;
        cite_engine_ = ENGINE_BASIC;
        biblio_style = "plain";
        use_bibtopic = false;
@@ -432,6 +427,36 @@ docstring BufferParams::B_(string const & l10n) const
 }
 
 
+BufferParams::Package BufferParams::use_package(std::string const & p) const
+{
+       PackageMap::const_iterator it = use_packages.find(p);
+       if (it == use_packages.end())
+               return package_auto;
+       return it->second;
+}
+
+
+void BufferParams::use_package(std::string const & p, BufferParams::Package u)
+{
+       use_packages[p] = u;
+}
+
+
+vector<string> const & BufferParams::auto_packages()
+{
+       static vector<string> packages;
+       if (packages.empty()) {
+               // adding a package here implies a file format change!
+               packages.push_back("amsmath");
+               packages.push_back("esint");
+               packages.push_back("mathdots");
+               packages.push_back("mhchem");
+               packages.push_back("undertilde");
+       }
+       return packages;
+}
+
+
 AuthorList & BufferParams::authors()
 {
        return pimpl_->authorlist;
@@ -678,23 +703,23 @@ string BufferParams::readToken(Lexer & lex, string const & token,
        } else if (token == "\\use_amsmath") {
                int use_ams;
                lex >> use_ams;
-               use_amsmath = packagetranslator().find(use_ams);
+               use_package("amsmath", packagetranslator().find(use_ams));
        } else if (token == "\\use_esint") {
                int useesint;
                lex >> useesint;
-               use_esint = packagetranslator().find(useesint);
+               use_package("esint", packagetranslator().find(useesint));
        } else if (token == "\\use_mhchem") {
                int usemhchem;
                lex >> usemhchem;
-               use_mhchem = packagetranslator().find(usemhchem);
+               use_package("mhchem", packagetranslator().find(usemhchem));
        } else if (token == "\\use_mathdots") {
                int usemathdots;
                lex >> usemathdots;
-               use_mathdots = packagetranslator().find(usemathdots);
+               use_package("mathdots", packagetranslator().find(usemathdots));
        } else if (token == "\\use_undertilde") {
                int useundertilde;
                lex >> useundertilde;
-               use_undertilde = packagetranslator().find(useundertilde);
+               use_package("undertilde", packagetranslator().find(useundertilde));
        } else if (token == "\\cite_engine") {
                string engine;
                lex >> engine;
@@ -999,11 +1024,11 @@ void BufferParams::writeFile(ostream & os) const
 
        os << "\\papersize " << string_papersize[papersize]
           << "\n\\use_geometry " << convert<string>(use_geometry)
-          << "\n\\use_amsmath " << use_amsmath
-          << "\n\\use_esint " << use_esint
-          << "\n\\use_mhchem " << use_mhchem
-          << "\n\\use_mathdots " << use_mathdots
-          << "\n\\use_undertilde " << use_undertilde
+          << "\n\\use_amsmath " << use_package("amsmath")
+          << "\n\\use_esint " << use_package("esint")
+          << "\n\\use_mhchem " << use_package("mhchem")
+          << "\n\\use_mathdots " << use_package("mathdots")
+          << "\n\\use_undertilde " << use_package("undertilde")
           << "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
           << "\n\\biblio_style " << biblio_style
           << "\n\\use_bibtopic " << convert<string>(use_bibtopic)
@@ -1168,18 +1193,16 @@ void BufferParams::validate(LaTeXFeatures & features) const
        if (float_placement.find('H') != string::npos)
                features.require("float");
 
-       // AMS Style is at document level
-       if (use_amsmath == package_on
-           || documentClass().provides("amsmath"))
-               features.require("amsmath");
-       if (use_esint == package_on)
-               features.require("esint");
-       if (use_mhchem == package_on)
-               features.require("mhchem");
-       if (use_mathdots == package_on)
-               features.require("mathdots");
-       if (use_undertilde == package_on)
-               features.require("undertilde");
+       for (PackageMap::const_iterator it = use_packages.begin();
+            it != use_packages.end(); ++it) {
+               if (it->first == "amsmath") {
+                       // AMS Style is at document level
+                       if (it->second == package_on ||
+                           documentClass().provides("amsmath"))
+                               features.require(it->first);
+               } else if (it->second == package_on)
+                       features.require(it->first);
+       }
 
        // Document-level line spacing
        if (spacing().getSpace() != Spacing::Single && !spacing().isDefault())
index 5432a094efed15104679f7dba910e4caebec5429..726047e692533f9107fdc5ed6c57fbce0b09573f 100644 (file)
@@ -343,16 +343,12 @@ public:
                /// some ERT that needs the package)
                package_on = 2
        };
-       /// Whether and how to load amsmath
-       Package use_amsmath;
-       /// Whether and how to load esint
-       Package use_esint;
-       /// Whether and how to load mhchem
-       Package use_mhchem;
-       /// Whether and how to load mathdots
-       Package use_mathdots;
-       /// Whether and how to load undertilde
-       Package use_undertilde;
+       /// Whether to load a package such as amsmath or esint.
+       Package use_package(std::string const & p) const;
+       /// Set whether to load a package such as amsmath or esint.
+       void use_package(std::string const & p, Package u);
+       /// All packages that can be switched on or off
+       static std::vector<std::string> const & auto_packages();
        /// Split bibliography?
        bool use_bibtopic;
        /// Split the index?
@@ -487,6 +483,12 @@ private:
        /// the list of included children (for includeonly)
        std::list<std::string> included_children_;
 
+       typedef std::map<std::string, Package> PackageMap;
+       /** Whether and how to load packages like amsmath, esint, mhchem,
+        *  mathdots and undertilde.
+        */
+       PackageMap use_packages;
+
        /** Use the Pimpl idiom to hide those member variables that would otherwise
         *  drag in other header files.
         */
index 1f66ce5052091d6cd28dbf4d8f6cdec6970bc709..a0e55981c02dd013171453260ee7454bfc7d1fdf 100644 (file)
@@ -691,7 +691,7 @@ string const LaTeXFeatures::getPackages() const
                packages << amsPackages;
 
        // fixltx2e must be loaded after amsthm, since amsthm produces an error with
-       // the redefined \[ command (bug 7233). Load is as early as possible, since
+       // the redefined \[ command (bug 7233). Load it as early as possible, since
        // other packages might profit from it.
        if (mustProvide("fixltx2e"))
                packages << "\\usepackage{fixltx2e}\n";
@@ -705,24 +705,27 @@ string const LaTeXFeatures::getPackages() const
        // integral symbols from wasysym and amsmath.
        // See http://www.lyx.org/trac/ticket/1942
        if (mustProvide("wasysym") &&
-           (params_.use_esint != BufferParams::package_off || !isRequired("esint")))
+           params_.use_package("wasysym") != BufferParams::package_off &&
+           (params_.use_package("esint") != BufferParams::package_off || !isRequired("esint")))
                packages << "\\usepackage{wasysym}\n";
 
        // accents must be loaded after amsmath
-       if (mustProvide("accents"))
+       if (mustProvide("accents") &&
+           params_.use_package("accents") != BufferParams::package_off)
                packages << "\\usepackage{accents}\n";
 
        // mathdots must be loaded after amsmath
        if (mustProvide("mathdots") &&
-               params_.use_mathdots != BufferParams::package_off)
+               params_.use_package("mathdots") != BufferParams::package_off)
                packages << "\\usepackage{mathdots}\n";
 
        // yhmath must be loaded after amsmath
-       if (mustProvide("yhmath"))
+       if (mustProvide("yhmath") &&
+           params_.use_package("yhmath") != BufferParams::package_off)
                packages << "\\usepackage{yhmath}\n";
 
        if (mustProvide("undertilde") &&
-               params_.use_undertilde != BufferParams::package_off)
+               params_.use_package("undertilde") != BufferParams::package_off)
                packages << "\\usepackage{undertilde}\n";
 
        // [x]color and pdfcolmk are handled in getColorOptions() above
@@ -757,7 +760,7 @@ string const LaTeXFeatures::getPackages() const
        // esint must be after amsmath and wasysym, since it will redeclare
        // inconsistent integral symbols
        if (mustProvide("esint") &&
-           params_.use_esint != BufferParams::package_off)
+           params_.use_package("esint") != BufferParams::package_off)
                packages << "\\usepackage{esint}\n";
 
        // natbib.sty
@@ -796,9 +799,9 @@ string const LaTeXFeatures::getPackages() const
                packages << "\\PassOptionsToPackage{normalem}{ulem}\n"
                            "\\usepackage{ulem}\n";
 
-       if (params_.use_mhchem == BufferParams::package_on ||
+       if (params_.use_package("mhchem") == BufferParams::package_on ||
            (mustProvide("mhchem") &&
-            params_.use_mhchem != BufferParams::package_off))
+            params_.use_package("mhchem") != BufferParams::package_off))
                packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
                            "\\usepackage{mhchem}\n";
 
@@ -1051,7 +1054,7 @@ string const LaTeXFeatures::loadAMSPackages() const
                tmp << "\\usepackage{amsthm}\n";
 
        if (mustProvide("amsmath")
-           && params_.use_amsmath != BufferParams::package_off) {
+           && params_.use_package("amsmath") != BufferParams::package_off) {
                tmp << "\\usepackage{amsmath}\n";
        } else {
                // amsbsy and amstext are already provided by amsmath
@@ -1062,7 +1065,7 @@ string const LaTeXFeatures::loadAMSPackages() const
        }
 
        if (mustProvide("amssymb")
-           || params_.use_amsmath == BufferParams::package_on)
+           || params_.use_package("amsmath") == BufferParams::package_on)
                tmp << "\\usepackage{amssymb}\n";
 
        return tmp.str();
index 44f2afd7f79e6d567b78f4814b3bfa7d09f97638..53c9c55f1c33cf89ced2b58e2395d92025bb5e7a 100644 (file)
@@ -54,6 +54,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
+#include "support/lassert.h"
 #include "support/lstrings.h"
 
 #include "frontends/alert.h"
@@ -171,6 +172,32 @@ char const * backref_opts_gui[] =
 };
 
 
+char const * packages_gui[][4] =
+{
+       {"amsmath",
+        N_("&Use AMS math package automatically"),
+        N_("Use AMS &math package"),
+        N_("The AMS LaTeX packages are only used if symbols from the AMS math toolbars are inserted into formulas")},
+       {"esint",
+        N_("Use esint package &automatically"),
+        N_("Use &esint package"),
+        N_("The LaTeX package esint is only used if special integral symbols are inserted into formulas")},
+       {"mathdots",
+        N_("Use math&dots package automatically"),
+        N_("Use mathdo&ts package"),
+        N_("The LaTeX package mathdots is only used if the command \\iddots is inserted into formulas")},
+       {"mhchem",
+        N_("Use mhchem &package automatically"),
+        N_("Use mh&chem package"),
+        N_("The LaTeX package mhchem is only used if either the command \\ce or \\cf is inserted into formulas")},
+       {"undertilde",
+        N_("Use u&ndertilde package automatically"),
+        N_("Use undertilde pac&kage"),
+        N_("The LaTeX package undertilde is only used if you use the math frame decoration 'utilde'")},
+       {"", "", "", ""}
+};
+
+
 vector<pair<string, QString> > pagestyles;
 
 
@@ -1148,38 +1175,49 @@ GuiDocument::GuiDocument(GuiView & lv)
 
 
        // maths
+       // FIXME This UI has problems:
+       //       1) It is not generic, packages_gui needs to be changed for each new package
+       //       2) Two checkboxes have 4 states, but one is invalid (both pressed)
+       //       3) The auto cb is not disabled if the use cb is checked
        mathsModule = new UiWidget<Ui::MathsUi>;
-       connect(mathsModule->amsautoCB, SIGNAL(toggled(bool)),
-               mathsModule->amsCB, SLOT(setDisabled(bool)));
-       connect(mathsModule->esintautoCB, SIGNAL(toggled(bool)),
-               mathsModule->esintCB, SLOT(setDisabled(bool)));
-       connect(mathsModule->mhchemautoCB, SIGNAL(toggled(bool)),
-               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()));
-       connect(mathsModule->amsautoCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
-       connect(mathsModule->esintCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
-       connect(mathsModule->esintautoCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
-       connect(mathsModule->mhchemCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
-       connect(mathsModule->mhchemautoCB, SIGNAL(clicked()),
-               this, SLOT(change_adaptor()));
-       connect(mathsModule->mathdotsCB, SIGNAL(clicked()),
-               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()));
+       vector<string> const & packages = BufferParams::auto_packages();
+        for (size_t i = 0; i < packages.size(); ++i) {
+               // Use the order of BufferParams::auto_packages() for easier
+               // access in applyView() and paramsToDialog()
+               int n = 0;
+               for (n = 0; packages_gui[n][0][0]; n++)
+                       if (packages_gui[n][0] == packages[i])
+                               break;
+               // If this fires somebody changed
+               // BufferParams::auto_packages() without adjusting packages_gui
+               LASSERT(packages_gui[n][0][0], /**/);
+               QString autoText = qt_(packages_gui[n][1]);
+               QString alwaysText = qt_(packages_gui[n][2]);
+               QString autoTooltip = qt_(packages_gui[n][3]);
+               QString alwaysTooltip;
+               if (packages[i] == "amsmath")
+                       alwaysTooltip =
+                               qt_("The AMS LaTeX packages are always used");
+               else
+                       alwaysTooltip = toqstr(bformat(
+                               _("The LaTeX package %1$s is always used"),
+                               from_ascii(packages[i])));
+               QCheckBox * autoCB = new QCheckBox(autoText, mathsModule);
+               QCheckBox * alwaysCB = new QCheckBox(alwaysText, mathsModule);
+               mathsModule->gridLayout->addWidget(autoCB, 2 * i, 0);
+               mathsModule->gridLayout->addWidget(alwaysCB, 2 * i + 1, 0);
+               autoCB->setToolTip(autoTooltip);
+               alwaysCB->setToolTip(alwaysTooltip);
+               connect(autoCB, SIGNAL(toggled(bool)),
+                       alwaysCB, SLOT(setDisabled(bool)));
+               connect(autoCB, SIGNAL(clicked()),
+                       this, SLOT(change_adaptor()));
+               connect(alwaysCB, SIGNAL(clicked()),
+                       this, SLOT(change_adaptor()));
+       }
+       QSpacerItem * spacer = new QSpacerItem(20, 20, QSizePolicy::Minimum,
+                                              QSizePolicy::Expanding);
+       mathsModule->gridLayout->addItem(spacer, 2 * packages.size(), 0);
 
 
        // latex class
@@ -2369,45 +2407,20 @@ void GuiDocument::applyView()
        modulesToParams(bp_);
 
        // Math
-       if (mathsModule->amsautoCB->isChecked())
-               bp_.use_amsmath = BufferParams::package_auto;
-       else {
-               if (mathsModule->amsCB->isChecked())
-                       bp_.use_amsmath = BufferParams::package_on;
-               else
-                       bp_.use_amsmath = BufferParams::package_off;
-       }
-       if (mathsModule->esintautoCB->isChecked())
-               bp_.use_esint = BufferParams::package_auto;
-       else {
-               if (mathsModule->esintCB->isChecked())
-                       bp_.use_esint = BufferParams::package_on;
-               else
-                       bp_.use_esint = BufferParams::package_off;
-       }
-       if (mathsModule->mhchemautoCB->isChecked())
-               bp_.use_mhchem = BufferParams::package_auto;
-       else {
-               if (mathsModule->mhchemCB->isChecked())
-                       bp_.use_mhchem = BufferParams::package_on;
-               else
-                       bp_.use_mhchem = BufferParams::package_off;
-       }
-       if (mathsModule->mathdotsautoCB->isChecked())
-               bp_.use_mathdots = BufferParams::package_auto;
-       else {
-               if (mathsModule->mathdotsCB->isChecked())
-                       bp_.use_mathdots = BufferParams::package_on;
-               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;
+       vector<string> const & packages = BufferParams::auto_packages();
+        for (size_t n = 0; n < packages.size(); ++n) {
+               QCheckBox * autoCB = static_cast<QCheckBox *>(
+                       mathsModule->gridLayout->itemAtPosition(2 * n, 0)->widget());
+               if (autoCB->isChecked())
+                       bp_.use_package(packages[n], BufferParams::package_auto);
+               else {
+                       QCheckBox * alwaysCB = static_cast<QCheckBox *>(
+                               mathsModule->gridLayout->itemAtPosition(2 * n + 1, 0)->widget());
+                       if (alwaysCB->isChecked())
+                               bp_.use_package(packages[n], BufferParams::package_on);
+                       else
+                               bp_.use_package(packages[n], BufferParams::package_off);
+               }
        }
 
        // Page Layout
@@ -2810,30 +2823,15 @@ void GuiDocument::paramsToDialog()
                latexModule->psdriverCO->setCurrentIndex(nitem);
        updateModuleInfo();
 
-       mathsModule->amsCB->setChecked(
-               bp_.use_amsmath == BufferParams::package_on);
-       mathsModule->amsautoCB->setChecked(
-               bp_.use_amsmath == BufferParams::package_auto);
-
-       mathsModule->esintCB->setChecked(
-               bp_.use_esint == BufferParams::package_on);
-       mathsModule->esintautoCB->setChecked(
-               bp_.use_esint == BufferParams::package_auto);
-
-       mathsModule->mhchemCB->setChecked(
-               bp_.use_mhchem == BufferParams::package_on);
-       mathsModule->mhchemautoCB->setChecked(
-               bp_.use_mhchem == BufferParams::package_auto);
-
-       mathsModule->mathdotsCB->setChecked(
-               bp_.use_mathdots == BufferParams::package_on);
-       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);
+       vector<string> const & packages = BufferParams::auto_packages();
+        for (size_t n = 0; n < packages.size(); ++n) {
+               QCheckBox * alwaysCB = static_cast<QCheckBox *>(
+                       mathsModule->gridLayout->itemAtPosition(2 * n + 1, 0)->widget());
+               alwaysCB->setChecked(bp_.use_package(packages[n]) == BufferParams::package_on);
+               QCheckBox * autoCB = static_cast<QCheckBox *>(
+                       mathsModule->gridLayout->itemAtPosition(2 * n, 0)->widget());
+               autoCB->setChecked(bp_.use_package(packages[n]) == BufferParams::package_auto);
+       }
 
        switch (bp_.spacing().getSpace()) {
                case Spacing::Other: nitem = 3; break;
index 36a9a827a62cd65807c1a4b42bb9d1cfd83fafc0..4c0f1161da852df70eca0e22fb0381aa552a0dff 100644 (file)
    <string/>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="0" column="0">
-    <widget class="QCheckBox" name="amsautoCB">
-     <property name="toolTip">
-      <string>The AMS LaTeX packages are only used if symbols from the AMS math toolbars are inserted into formulas</string>
-     </property>
-     <property name="text">
-      <string>&amp;Use AMS math package automatically</string>
-     </property>
-     <property name="checked">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QCheckBox" name="amsCB">
-     <property name="toolTip">
-      <string>The AMS LaTeX packages are always used</string>
-     </property>
-     <property name="text">
-      <string>Use AMS &amp;math package</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0">
-    <widget class="QCheckBox" name="esintautoCB">
-     <property name="toolTip">
-      <string>The LaTeX package esint is only used if special integral symbols are inserted into formulas</string>
-     </property>
-     <property name="text">
-      <string>Use esint package &amp;automatically</string>
-     </property>
-     <property name="checked">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="3" column="0">
-    <widget class="QCheckBox" name="esintCB">
-     <property name="toolTip">
-      <string>The LaTeX package esint is always used</string>
-     </property>
-     <property name="text">
-      <string>Use &amp;esint package</string>
-     </property>
-    </widget>
-   </item>
-   <item row="4" column="0">
-    <widget class="QCheckBox" name="mathdotsautoCB">
-     <property name="toolTip">
-      <string>The LaTeX package mathdots is only used if the command \iddots is inserted into formulas</string>
-     </property>
-     <property name="text">
-      <string>Use math&amp;dots package automatically</string>
-     </property>
-    </widget>
-   </item>
-   <item row="5" column="0">
-    <widget class="QCheckBox" name="mathdotsCB">
-     <property name="toolTip">
-      <string>The LaTeX package mathdots is used</string>
-     </property>
-     <property name="text">
-      <string>Use mathdo&amp;ts package</string>
-     </property>
-    </widget>
-   </item>
-   <item row="6" column="0">
-    <widget class="QCheckBox" name="mhchemautoCB">
-     <property name="toolTip">
-      <string>The LaTeX package mhchem is only used if either the command \ce or \cf is inserted into formulas</string>
-     </property>
-     <property name="text">
-      <string>Use mhchem &amp;package automatically</string>
-     </property>
-     <property name="checked">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="7" column="0">
-    <widget class="QCheckBox" name="mhchemCB">
-     <property name="toolTip">
-      <string>The LaTeX package mhchem is always used</string>
-     </property>
-     <property name="text">
-      <string>Use mh&amp;chem package</string>
-     </property>
-    </widget>
-   </item>
-   <item row="8" column="0">
-    <widget class="QCheckBox" name="undertildeautoCB">
-     <property name="toolTip">
-      <string>The LaTeX package undertilde is only used if you use the math frame decoration 'utilde'</string>
-     </property>
-     <property name="text">
-      <string>Use u&amp;ndertilde package automatically</string>
-     </property>
-     <property name="checked">
-      <bool>false</bool>
-     </property>
-    </widget>
-   </item>
-   <item row="9" column="0">
-    <widget class="QCheckBox" name="undertildeCB">
-     <property name="toolTip">
-      <string>The LaTeX package undertilde is always used</string>
-     </property>
-     <property name="text">
-      <string>Use undertilde pac&amp;kage</string>
-     </property>
-    </widget>
-   </item>
-   <item row="10" column="0">
-    <spacer>
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeType">
-      <enum>QSizePolicy::Expanding</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
   </layout>
  </widget>
  <includes>
index 84f9ec467941ff8fff61aba760745ac72d00d2d5..2055fb2c4ba0a9aa5f523e0cabf6cb1c2525863d 100644 (file)
@@ -1377,7 +1377,7 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
                if (type_ == hullSimple || type_ == hullEquation) {
                        cur.recordUndoInset();
                        bool const align =
-                               cur.bv().buffer().params().use_amsmath == BufferParams::package_on;
+                               cur.bv().buffer().params().use_package("amsmath") == BufferParams::package_on;
                        mutate(align ? hullAlign : hullEqnArray);
                        // mutate() may change labels and such.
                        cur.forceBufferUpdate();
index 4c5c01a653f0de92293742b0bb73a9512787216a..ee35102cf21d6c243719dd430d4d7b95f534a260 100644 (file)
@@ -322,7 +322,7 @@ MathAtom createInsetMath(docstring const & s, Buffer * buf)
 {
        //lyxerr << "creating inset with name: '" << to_utf8(s) << '\'' << endl;
        if ((s == "ce" || s == "cf") && buf
-           && buf->params().use_mhchem == BufferParams::package_off)
+           && buf->params().use_package("mhchem") == BufferParams::package_off)
                return MathAtom(new MathMacro(buf, s));
 
        latexkeys const * l = in_word_set(s);
index 0a0f31c1b7771f3074564d0df8ed0874565d3c3a..288a14a97d16cb1179ff04764736295b5f068cf8 100644 (file)
@@ -1838,7 +1838,7 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
                else if (t.cs().size()) {
                        bool const no_mhchem =
                                (t.cs() == "ce" || t.cs() == "cf")
-                               && buf && buf->params().use_mhchem ==
+                               && buf && buf->params().use_package("mhchem") ==
                                                BufferParams::package_off;
 
                        bool const is_user_macro = no_mhchem ||