]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathCases.cpp
Change the interface to a paragraph's layout. We still store a LayoutPtr, but now...
[lyx.git] / src / mathed / InsetMathCases.cpp
index d044d1291a6a08f0688dc7c230064633f804d338..6ade4d2ebe875d6eacc725b769a7a6e7e6e6d8a8 100644 (file)
 #include <config.h>
 
 #include "InsetMathCases.h"
+
+#include "Cursor.h"
+#include "FuncRequest.h"
+#include "FuncStatus.h"
+#include "support/gettext.h"
+#include "LaTeXFeatures.h"
 #include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
-#include "FuncStatus.h"
-#include "LaTeXFeatures.h"
-#include "support/std_ostream.h"
-#include "Cursor.h"
-#include "FuncRequest.h"
-#include "gettext.h"
-#include "Undo.h"
+#include "MetricsInfo.h"
 
 #include "support/lstrings.h"
 
+#include <ostream>
 
-namespace lyx {
-
-using support::bformat;
+using namespace std;
+using namespace lyx::support;
 
-using std::endl;
-using std::max;
-using std::min;
-using std::swap;
-using std::auto_ptr;
+namespace lyx {
 
 
 InsetMathCases::InsetMathCases(row_type n)
@@ -41,28 +37,31 @@ InsetMathCases::InsetMathCases(row_type n)
 {}
 
 
-auto_ptr<Inset> InsetMathCases::doClone() const
+Inset * InsetMathCases::clone() const
+{
+       return new InsetMathCases(*this);
+}
+
+
+void InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       return auto_ptr<Inset>(new InsetMathCases(*this));
+       InsetMathGrid::metrics(mi, dim);
+       dim.wid += 8;
 }
 
 
-bool InsetMathCases::metrics(MetricsInfo & mi, Dimension & dim) const
+Dimension const InsetMathCases::dimension(BufferView const & bv) const
 {
-       dim = dim_;
-       InsetMathGrid::metrics(mi);
-       dim_.wid += 8;
-
-       if (dim_ == dim)
-               return false;
-       dim = dim_;
-       return true;
+       Dimension dim = InsetMathGrid::dimension(bv);
+       dim.wid += 8;
+       return dim;
 }
 
 
 void InsetMathCases::draw(PainterInfo & pi, int x, int y) const
 {
-       mathed_draw_deco(pi, x + 1, y - dim_.ascent(), 6, dim_.height(), from_ascii("{"));
+       Dimension const dim = dimension(*pi.base.bv);
+       mathed_draw_deco(pi, x + 1, y - dim.ascent(), 6, dim.height(), from_ascii("{"));
        InsetMathGrid::drawWithMargin(pi, x, y, 8, 0);
        setPosCache(pi, x, y);
 }
@@ -73,7 +72,7 @@ void InsetMathCases::doDispatch(Cursor & cur, FuncRequest & cmd)
        //lyxerr << "*** InsetMathCases: request: " << cmd << endl;
        switch (cmd.action) {
        case LFUN_TABULAR_FEATURE: {
-               recordUndo(cur);
+               cur.recordUndo();
                docstring const & s = cmd.argument();
                if (s == "add-vline-left" || s == "add-vline-right") {
                        cur.undispatched();