]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathBrace.cpp
Merge branch 'master' of git.lyx.org:lyx
[lyx.git] / src / mathed / InsetMathBrace.cpp
index 769474941e5e86afa38536d90b1a95a14c22ec15..52ccc01b83055169b456241f980d95242a8eaa93 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  *
  * Full author contact details are available in file CREDITS.
  */
 #include <config.h>
 
 #include "InsetMathBrace.h"
+
 #include "MathData.h"
 #include "MathStream.h"
 #include "MathSupport.h"
+#include "MetricsInfo.h"
 
 #include "frontends/FontMetrics.h"
 #include "frontends/Painter.h"
 
-#include "support/std_ostream.h"
+#include <ostream>
+#include <algorithm>
+
+using namespace std;
 
 namespace lyx {
 
-InsetMathBrace::InsetMathBrace()
-       : InsetMathNest(1)
+InsetMathBrace::InsetMathBrace(Buffer * buf)
+       : InsetMathNest(buf, 1)
 {}
 
 
 InsetMathBrace::InsetMathBrace(MathData const & ar)
-       : InsetMathNest(1)
+       : InsetMathNest(const_cast<Buffer *>(ar.buffer()), 1)
 {
        cell(0) = ar;
 }
@@ -44,19 +49,21 @@ void InsetMathBrace::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        Dimension dim0;
        cell(0).metrics(mi, dim0);
-       Dimension t = theFontMetrics(mi.base.font).dimension('{');
-       dim.asc = std::max(dim0.asc, t.asc);
-       dim.des = std::max(dim0.des, t.des);
+       FontInfo font = mi.base.font;
+       augmentFont(font, "mathnormal");
+       Dimension t = theFontMetrics(font).dimension('{');
+       dim.asc = max(dim0.asc, t.asc);
+       dim.des = max(dim0.des, t.des);
        dim.wid = dim0.width() + 2 * t.wid;
        metricsMarkers(dim);
-       // Cache the inset dimension. 
-       setDimCache(mi, dim);
 }
 
 
 void InsetMathBrace::draw(PainterInfo & pi, int x, int y) const
 {
        FontInfo font = pi.base.font;
+       augmentFont(font, "mathnormal");
+       font.setShape(UP_SHAPE);
        font.setColor(Color_latex);
        Dimension t = theFontMetrics(font).dimension('{');
        pi.pain.text(x, y, '{', font);
@@ -97,6 +104,12 @@ void InsetMathBrace::mathmlize(MathStream & os) const
 }
 
 
+void InsetMathBrace::htmlize(HtmlStream & os) const
+{
+       os << cell(0);
+}
+
+
 void InsetMathBrace::mathematica(MathematicaStream & os) const
 {
        os << cell(0);