]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/MathSupport.cpp
Whitespace.
[lyx.git] / src / mathed / MathSupport.cpp
index aa3a627addc7ad3734d7045ebc8e94c780540c46..99930ae4bd8107d9b23c2c8d1e587ee6e69d443e 100644 (file)
@@ -4,7 +4,7 @@
  * Licence details can be found in the file COPYING.
  *
  * \author Alejandro Aguilar Sierra
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 #include "MathParser.h"
 #include "MathStream.h"
 
-#include "support/debug.h"
-
-#include "support/docstream.h"
-
 #include "frontends/FontLoader.h"
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
+#include "support/debug.h"
+#include "support/docstream.h"
+
 #include <map>
-#include <sstream>
 
 using namespace std;
 
@@ -203,6 +201,15 @@ double const dddot[] = {
 };
 
 
+double const ddddot[] = {
+       1, 0.0, 0.5,  0.1, 0.5,
+       1, 0.3, 0.5,  0.4, 0.5,
+       1, 0.6, 0.5,  0.7, 0.5,
+       1, 0.9, 0.5,  1.0, 0.5,
+       0
+};
+
+
 double const hline3[] = {
        1, 0.1,   0,  0.15,  0,
        1, 0.475, 0,  0.525, 0,
@@ -314,6 +321,7 @@ named_deco_struct deco_table[] = {
        // Accents
        {"ddot",           ddot,       0 },
        {"dddot",          dddot,      0 },
+       {"ddddot",         ddddot,     0 },
        {"hat",            angle,      3 },
        {"grave",          slash,      1 },
        {"acute",          slash,      0 },
@@ -331,6 +339,8 @@ named_deco_struct deco_table[] = {
        {"cdots",          hline3,     0 },
        {"vdots",          hline3,     1 },
        {"ddots",          dline3,     0 },
+       {"adots",          dline3,     1 },
+       {"iddots",         dline3,     1 },
        {"dotsb",          hline3,     0 },
        {"dotsc",          hline3,     0 },
        {"dotsi",          hline3,     0 },
@@ -339,7 +349,7 @@ named_deco_struct deco_table[] = {
 };
 
 
-std::map<docstring, deco_struct> deco_list;
+map<docstring, deco_struct> deco_list;
 
 // sort the table on startup
 class init_deco_table {
@@ -360,7 +370,7 @@ static init_deco_table dummy;
 
 deco_struct const * search_deco(docstring const & name)
 {
-       std::map<docstring, deco_struct>::const_iterator p = deco_list.find(name);
+       map<docstring, deco_struct>::const_iterator p = deco_list.find(name);
        return p == deco_list.end() ? 0 : &(p->second);
 }
 
@@ -499,7 +509,7 @@ void math_font_max_dim(FontInfo const & font, int & asc, int & des)
 
 
 struct fontinfo {
-       std::string cmd_;
+       string cmd_;
        FontFamily family_;
        FontSeries series_;
        FontShape  shape_;
@@ -581,6 +591,12 @@ fontinfo fontinfos[] = {
        {"textipa",       inh_family, inh_series,
                          inh_shape, Color_foreground},
 
+       // mhchem support
+       {"ce",            inh_family, inh_series,
+                         inh_shape, Color_foreground},
+       {"cf",            inh_family, inh_series,
+                         inh_shape, Color_foreground},
+
        // LyX internal usage
        {"lyxtex",        inh_family, inh_series,
                          UP_SHAPE, Color_latex},
@@ -605,7 +621,7 @@ fontinfo * lookupFont(docstring const & name0)
 {
        //lyxerr << "searching font '" << name << "'" << endl;
        int const n = sizeof(fontinfos) / sizeof(fontinfo);
-       std::string name = to_utf8(name0);
+       string name = to_utf8(name0);
        for (int i = 0; i < n; ++i)
                if (fontinfos[i].cmd_ == name) {
                        //lyxerr << "found '" << i << "'" << endl;
@@ -686,9 +702,11 @@ docstring asString(MathData const & ar)
 }
 
 
-void asArray(docstring const & str, MathData & ar)
+void asArray(docstring const & str, MathData & ar, Parse::flags pf)
 {
-       mathed_parse_cell(ar, str);
+       bool quiet = pf & Parse::QUIET;
+       if ((str.size() == 1 && quiet) || (!mathed_parse_cell(ar, str, pf) && quiet))
+               mathed_parse_cell(ar, str, pf | Parse::VERBATIM);
 }