]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/CommandInset.cpp
Improve the list of equations
[lyx.git] / src / mathed / CommandInset.cpp
index 84894adf2f9a8c4e5b5046fd416845076b9eb647..0c9e585e1a7a976893db08d832889aba627b0c8b 100644 (file)
@@ -14,7 +14,6 @@
 #include "MathData.h"
 #include "MathStream.h"
 #include "DispatchResult.h"
-#include "FuncRequest.h"
 
 #include <sstream>
 
@@ -23,8 +22,8 @@ using namespace std;
 namespace lyx {
 
 
-CommandInset::CommandInset(docstring const & name, bool needs_math_mode)
-       : InsetMathNest(2), name_(name), needs_math_mode_(needs_math_mode),
+CommandInset::CommandInset(Buffer * buf, docstring const & name, bool needs_math_mode)
+       : InsetMathNest(buf, 2), name_(name), needs_math_mode_(needs_math_mode),
          set_label_(false)
 {
        lock_ = true;
@@ -44,8 +43,6 @@ void CommandInset::metrics(MetricsInfo & mi, Dimension & dim) const
                button_.update(screenLabel(), true);
        }
        button_.metrics(mi, dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
@@ -59,15 +56,15 @@ Inset * CommandInset::editXY(Cursor & cur, int /*x*/, int /*y*/)
 void CommandInset::draw(PainterInfo & pi, int x, int y) const
 {
        button_.draw(pi, x, y);
-       setPosCache(pi, x, y);
 }
 
 
 void CommandInset::write(WriteStream & os) const
 {
+       ModeSpecifier specifier(os, currentMode(), lockedMode(), asciiOnly());
        MathEnsurer ensurer(os, needs_math_mode_);
-       os << '\\' << name_.c_str();
-       if (cell(1).size())
+       os << '\\' << name_;
+       if (!cell(1).empty())
                os << '[' << cell(1) << ']';
        os << '{' << cell(0) << '}';
 }