]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_braceinset.C
Andreas' patch to prevent crash on click on previewd inset
[lyx.git] / src / mathed / math_braceinset.C
index aa7b914896c9205f76f3804d446df960101fa011..7e8a70234969bf181baddd470e7044a3dcdf87e5 100644 (file)
@@ -16,6 +16,7 @@
 #include "math_support.h"
 #include "LColor.h"
 #include "support/std_ostream.h"
+#include "frontends/Painter.h"
 
 using std::max;
 using std::auto_ptr;
@@ -33,7 +34,7 @@ MathBraceInset::MathBraceInset(MathArray const & ar)
 }
 
 
-auto_ptr<InsetBase> MathBraceInset::clone() const
+auto_ptr<InsetBase> MathBraceInset::doClone() const
 {
        return auto_ptr<InsetBase>(new MathBraceInset(*this));
 }
@@ -44,11 +45,11 @@ void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
        cell(0).metrics(mi);
        Dimension t;
        mathed_char_dim(mi.base.font, '{', t);
-       wid_ = t.wid;
-       dim_.asc = max(cell(0).ascent(), t.asc);
-       dim_.des = max(cell(0).descent(), t.des);
-       dim_.wid = cell(0).width() + 2 * wid_;
-       dim = dim_;
+       dim.asc = max(cell(0).ascent(), t.asc);
+       dim.des = max(cell(0).descent(), t.des);
+       dim.wid = cell(0).width() + 2 * t.wid;
+       metricsMarkers(dim);
+       dim_ = dim;
 }
 
 
@@ -56,9 +57,12 @@ void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
 {
        LyXFont font = pi.base.font;
        font.setColor(LColor::latex);
-       drawChar(pi, font, x, y, '{');
-       cell(0).draw(pi, x + wid_, y);
-       drawChar(pi, font, x + dim_.width() - wid_, y, '}');
+       Dimension t;
+       mathed_char_dim(font, '{', t);
+       pi.pain.text(x, y, '{', font);
+       cell(0).draw(pi, x + t.wid, y);
+       pi.pain.text(x + t.wid + cell(0).width(), y, '}', font);
+       drawMarkers(pi, x, y);
 }