MathBoxInset::MathBoxInset(string const & name)
- : MathGridInset(1, 1), name_(name)
+ : MathNestInset(1), name_(name)
{}
void MathBoxInset::metrics(MathMetricsInfo & mi) const
{
MathFontSetChanger dummy(mi.base, "textnormal");
- MathGridInset::metrics(mi);
+ xcell(0).metrics(mi);
+ ascent_ = xcell(0).ascent() + 1;
+ descent_ = xcell(0).descent() + 1;
+ width_ = xcell(0).width() + 2;
}
void MathBoxInset::draw(MathPainterInfo & pi, int x, int y) const
{
MathFontSetChanger dummy(pi.base, "textnormal");
- MathGridInset::draw(pi, x, y);
- mathed_draw_framebox(pi, x, y, this);
+ xcell(0).draw(pi, x, y);
+ drawMarkers2(pi, x + 1, y);
}
#ifndef MATH_BOXINSET_H
#define MATH_BOXINSET_H
-#include "math_gridinset.h"
+#include "math_nestinset.h"
#include "LString.h"
#ifdef __GNUG__
/// Support for \\mbox
-class MathBoxInset : public MathGridInset {
+class MathBoxInset : public MathNestInset {
public:
///
explicit MathBoxInset(string const & name);
void infoize(std::ostream & os) const;
private:
- ///
- mutable MathMetricsInfo mi_;
///
string name_;
};
}
+void MathNestInset::metricsMarkers() const
+{
+ descent_ += 1;
+ width_ += 2;
+}
+
+
+void MathNestInset::metricsMarkers2() const
+{
+ ascent_ += 1;
+ descent_ += 1;
+ width_ += 2;
+}
+
+
bool MathNestInset::idxNext(idx_type & idx, pos_type & pos) const
{
if (idx + 1 >= nargs())
/// the size is usuall some sort of convex hull of the cells
void metrics(MathMetricsInfo const & mi) const;
+ /// add space for markers
+ void metricsMarkers() const;
+ /// add space for markers
+ void metricsMarkers2() const;
/// draw background if locked
void draw(MathPainterInfo & pi, int x, int y) const;
/// draw two angular markers
return;
}
- else if (l->inset == "mbox") {
- // switch to text mode
- cell->push_back(createMathInset(t.cs()));
- parse_into(cell->back()->cell(0), FLAG_ITEM, mathmode);
- }
-
else if (l->inset == "style") {
cell->push_back(createMathInset(t.cs()));
parse_into(cell->back()->cell(0), flags, mathmode);
else {
MathAtom p = createMathInset(t.cs());
for (MathInset::idx_type i = 0; i < p->nargs(); ++i)
- parse_into(p->cell(i), FLAG_ITEM, l->extra == "mathmode");
+ parse_into(p->cell(i), FLAG_ITEM, l->extra != "forcetext");
cell->push_back(p);
}
}