]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathDelim.cpp
Coding style
[lyx.git] / src / mathed / InsetMathDelim.cpp
index 19bcc6ccd8f254ad12bec287986575e18a5f97c2..9a1ca07f864bc1dd2bdb6f43074475ab668581ae 100644 (file)
 #include <config.h>
 
 #include "InsetMathDelim.h"
+
 #include "MathData.h"
 #include "MathStream.h"
-#include "MathStream.h"
 #include "MathSupport.h"
+#include "MetricsInfo.h"
+
+#include "support/docstring.h"
 
 #include "frontends/FontMetrics.h"
 
+using namespace std;
 
 namespace lyx {
 
@@ -55,6 +59,7 @@ Inset * InsetMathDelim::clone() const
 
 void InsetMathDelim::write(WriteStream & os) const
 {
+       MathEnsurer ensurer(os);
        os << "\\left" << convertDelimToLatexName(left_) << cell(0)
           << "\\right" << convertDelimToLatexName(right_);
 }
@@ -69,22 +74,20 @@ void InsetMathDelim::normalize(NormalStream & os) const
 
 void InsetMathDelim::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       using std::max;
-       cell(0).metrics(mi);
+       Dimension dim0;
+       cell(0).metrics(mi, dim0);
        Dimension t = theFontMetrics(mi.base.font).dimension('I');
        int h0 = (t.asc + t.des) / 2;
-       int a0 = max(cell(0).ascent(), t.asc)   - h0;
-       int d0 = max(cell(0).descent(), t.des)  + h0;
-       dw_ = cell(0).height() / 5;
+       int a0 = max(dim0.asc, t.asc)   - h0;
+       int d0 = max(dim0.des, t.des)  + h0;
+       dw_ = dim0.height() / 5;
        if (dw_ > 8)
                dw_ = 8;
        if (dw_ < 4)
                dw_ = 4;
-       dim.wid = cell(0).width() + 2 * dw_ + 8;
+       dim.wid = dim0.width() + 2 * dw_ + 8;
        dim.asc = max(a0, d0) + h0;
        dim.des = max(a0, d0) - h0;
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }