]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathSubstack.cpp
Use convertDelimToXMLEscape with matrix delimiters, too.
[lyx.git] / src / mathed / InsetMathSubstack.cpp
index 7810ff479e9065a92d58f6cd588d1172639358aa..06fd296a98d6a3c1398b6ebffd3578acafbc34cd 100644 (file)
 
 #include "InsetMathSubstack.h"
 
-#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
 
 #include "FuncRequest.h"
 #include "FuncStatus.h"
-#include "support/gettext.h"
+#include "LaTeXFeatures.h"
+#include "MetricsInfo.h"
 
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
 #include <ostream>
@@ -44,17 +45,14 @@ Inset * InsetMathSubstack::clone() const
 
 void InsetMathSubstack::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       if (mi.base.style == LM_ST_DISPLAY) {
-               StyleChanger dummy(mi.base, LM_ST_TEXT);
-               InsetMathGrid::metrics(mi, dim);
-       } else {
-               InsetMathGrid::metrics(mi, dim);
-       }
+       Changer dummy = mi.base.changeStyle(LM_ST_TEXT, mi.base.style == LM_ST_DISPLAY);
+       InsetMathGrid::metrics(mi, dim);
 }
 
 
 void InsetMathSubstack::draw(PainterInfo & pi, int x, int y) const
 {
+       Changer dummy = pi.base.changeStyle(LM_ST_TEXT, pi.base.style == LM_ST_DISPLAY);
        InsetMathGrid::draw(pi, x + 1, y);
 }
 
@@ -63,27 +61,21 @@ bool InsetMathSubstack::getStatus(Cursor & cur, FuncRequest const & cmd,
                FuncStatus & flag) const
 {
        switch (cmd.action()) {
-       case LFUN_INSET_MODIFY: {
-               istringstream is(to_utf8(cmd.argument()));
-               string s;
-               is >> s;
-               if (s != "tabular")
-                       break;
-               is >> s;
-               string const name = "substack";
+       case LFUN_TABULAR_FEATURE: {
+               string s = cmd.getArg(0);
                if (s == "add-vline-left" || s == "add-vline-right") {
                        flag.message(bformat(
                                from_utf8(N_("Can't add vertical grid lines in '%1$s'")),
-                               from_utf8(name)));
+                               from_utf8("substack")));
                        flag.setEnabled(false);
                        return true;
                }
-               // in contrary to \subaray, the columns in \substack
+               // in contrary to \subarray, the columns in \substack
                // are always centered and this cannot be changed
                if (s == "align-left" || s == "align-right") {
                        flag.message(bformat(
                                from_utf8(N_("Can't change horizontal alignment in '%1$s'")),
-                               from_utf8(name)));
+                               from_utf8("substack")));
                        flag.setEnabled(false);
                        return true;
                }