-#include <config.h>
+/**
+ * \file math_braceinset.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author André Pönitz
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+#include <config.h>
#include "math_braceinset.h"
-#include "math_parser.h"
-#include "math_support.h"
+#include "math_data.h"
#include "math_mathmlstream.h"
-#include "support/LOstream.h"
+#include "math_support.h"
+#include "LColor.h"
+#include "support/std_ostream.h"
using std::max;
+using std::auto_ptr;
MathBraceInset::MathBraceInset()
}
-MathInset * MathBraceInset::clone() const
+auto_ptr<InsetBase> MathBraceInset::doClone() const
{
- return new MathBraceInset(*this);
+ return auto_ptr<InsetBase>(new MathBraceInset(*this));
}
-void MathBraceInset::metrics(MathMetricsInfo & mi) const
+void MathBraceInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi);
Dimension t;
mathed_char_dim(mi.base.font, '{', t);
- wid_ = t.w;
- dim_.a = max(cell(0).ascent(), t.a);
- dim_.d = max(cell(0).descent(), t.a);
- dim_.w = cell(0).width() + 2 * wid_;
+ 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;
}
-void MathBraceInset::draw(MathPainterInfo & pi, int x, int y) const
+void MathBraceInset::draw(PainterInfo & pi, int x, int y) const
{
LyXFont font = pi.base.font;
font.setColor(LColor::latex);
+ Dimension t;
+ mathed_char_dim(font, '{', t);
drawChar(pi, font, x, y, '{');
- cell(0).draw(pi, x + wid_, y);
- drawChar(pi, font, x + width() - wid_, y, '}');
+ cell(0).draw(pi, x + t.wid, y);
+ drawChar(pi, font, x + t.wid + cell(0).width(), y, '}');
+ drawMarkers(pi, x, y);
}