]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathScript.cpp
tex2lyx/text.cpp: fix typos
[lyx.git] / src / mathed / InsetMathScript.cpp
index 0b6a4d86cb39d43059503b34d467ab8b91e306b0..a9f4b38bd19c55ab384a2986378bb6c7255e93e6 100644 (file)
@@ -14,6 +14,7 @@
 #include "Cursor.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
+#include "FuncStatus.h"
 #include "InsetMathFont.h"
 #include "InsetMathScript.h"
 #include "InsetMathSymbol.h"
@@ -704,13 +705,13 @@ bool InsetMathScript::notifyCursorLeaves(Cursor const & old, Cursor & cur)
                        // must be a subscript...
                        old.recordUndoInset();
                        removeScript(false);
-                       cur.updateFlags(cur.result().update() | Update::SinglePar);
+                       cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
                        return true;
                } else if (cell(1).empty()) {
                        // must be a superscript...
                        old.recordUndoInset();
                        removeScript(true);
-                       cur.updateFlags(cur.result().update() | Update::SinglePar);
+                       cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
                        return true;
                }
        }
@@ -740,7 +741,7 @@ bool InsetMathScript::notifyCursorLeaves(Cursor const & old, Cursor & cur)
                insetCur.cell().insert(insetCur.pos(), ar);
 
                // redraw
-               cur.updateFlags(cur.result().update() | Update::SinglePar);
+               cur.screenUpdateFlags(cur.result().screenUpdate() | Update::SinglePar);
                return true;
        }
 
@@ -754,6 +755,7 @@ void InsetMathScript::doDispatch(Cursor & cur, FuncRequest & cmd)
        //LYXERR("InsetMathScript: request: " << cmd);
 
        if (cmd.action() == LFUN_MATH_LIMITS) {
+               cur.recordUndoInset();
                if (!cmd.argument().empty()) {
                        if (cmd.argument() == "limits")
                                limits_ = 1;
@@ -772,16 +774,35 @@ void InsetMathScript::doDispatch(Cursor & cur, FuncRequest & cmd)
 }
 
 
+bool InsetMathScript::getStatus(Cursor & cur, FuncRequest const & cmd,
+                               FuncStatus & flag) const
+{
+       if (cmd.action() == LFUN_MATH_LIMITS) {
+               if (!cmd.argument().empty()) {
+                       if (cmd.argument() == "limits")
+                               flag.setOnOff(limits_ == 1);
+                       else if (cmd.argument() == "nolimits")
+                               flag.setOnOff(limits_ == -1);
+                       else
+                               flag.setOnOff(limits_ == 0);
+               } 
+               flag.setEnabled(true);
+               return true;
+       }
+
+       return InsetMathNest::getStatus(cur, cmd, flag);
+}
+
+
 // the idea for dual scripts came from the eLyXer code
 void InsetMathScript::validate(LaTeXFeatures & features) const
 {
        if (features.runparams().math_flavor == OutputParams::MathAsHTML)
-               features.addPreambleSnippet("<style type=\"text/css\">\n"
+               features.addCSSSnippet(
                        "span.scripts{display: inline-block; vertical-align: middle; text-align:center; font-size: 75%;}\n"
                        "span.scripts span {display: block;}\n"
                        "sub.math{font-size: 75%;}\n"
-                       "sup.math{font-size: 75%;}\n"
-                       "</style>");
+                       "sup.math{font-size: 75%;}");
        InsetMathNest::validate(features);
 }