+2003-05-06 Ling Li <ling@caltech.edu>
+
+ * Makefile, math_makeboxinset.[Ch]:
+ * math_factory.C (createMathInset):
+ * math_parser.C (parse1): New support for \makebox.
+
+ * math_nestinset.C (drawMarkers, drawMarkers2):
+ * math_boxinset.C, math_frameboxinset.C (draw):
+ Fix spacing and marker length.
+
2003-05-03 John Levon <levon@movementarian.org>
* formula.C:
math_macrotemplate.h \
math_macrotable.C \
math_macrotable.h \
+ math_makeboxinset.C \
+ math_makeboxinset.h \
math_mathmlstream.C \
math_mathmlstream.h \
math_matrixinset.C \
{
FontSetChanger dummy(pi.base, "textnormal");
cell(0).draw(pi, x, y);
- drawMarkers2(pi, x + 1, y);
+ drawMarkers2(pi, x, y);
}
#include "math_macrotable.h"
#include "math_macrotemplate.h"
#include "math_macroarg.h"
+#include "math_makeboxinset.h"
#include "math_parboxinset.h"
#include "math_rootinset.h"
#include "math_sizeinset.h"
return MathAtom(new MathMacroArgument(s[2] - '0'));
if (s == "framebox")
return MathAtom(new MathFrameboxInset);
+ if (s == "makebox")
+ return MathAtom(new MathMakeboxInset);
if (s == "kern")
return MathAtom(new MathKernInset);
if (s == "xymatrix")
--- /dev/null
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_makeboxinset.h"
+#include "math_support.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
+#include "frontends/Painter.h"
+
+
+
+MathMakeboxInset::MathMakeboxInset()
+ : MathNestInset(3)
+{}
+
+
+MathInset * MathMakeboxInset::clone() const
+{
+ return new MathMakeboxInset(*this);
+}
+
+
+void MathMakeboxInset::metrics(MetricsInfo & mi) const
+{
+ FontSetChanger dummy(mi.base, "textnormal");
+ w_ = mathed_char_width(mi.base.font, '[');
+ MathNestInset::metrics(mi);
+ dim_ = cell(0).dim();
+ dim_ += cell(1).dim();
+ dim_ += cell(2).dim();
+ dim_.w += 4 * w_ + 4;
+ metricsMarkers2();
+}
+
+
+void MathMakeboxInset::draw(PainterInfo & pi, int x, int y) const
+{
+ FontSetChanger dummy(pi.base, "textnormal");
+ drawMarkers2(pi, x, y);
+
+ drawStrBlack(pi, x, y, "[");
+ x += w_;
+ cell(0).draw(pi, x, y);
+ x += cell(0).width();
+ drawStrBlack(pi, x, y, "]");
+ x += w_ + 2;
+
+ drawStrBlack(pi, x, y, "[");
+ x += w_;
+ cell(1).draw(pi, x, y);
+ x += cell(1).width();
+ drawStrBlack(pi, x, y, "]");
+ x += w_ + 2;
+
+ cell(2).draw(pi, x, y);
+}
+
+
+void MathMakeboxInset::write(WriteStream & os) const
+{
+ os << "\\makebox";
+ os << '[' << cell(0) << ']';
+ if (cell(1).size())
+ os << '[' << cell(1) << ']';
+ os << '{' << cell(2) << '}';
+}
+
+
+void MathMakeboxInset::normalize(NormalStream & os) const
+{
+ os << "[makebox " << cell(0) << ' ' << cell(1) << ' ' << cell(2) << ']';
+}
--- /dev/null
+// -*- C++ -*-
+#ifndef MATH_MAKEBOXINSET_H
+#define MATH_MAKEBOXINSET_H
+
+#include "math_nestinset.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/** Extra nesting: \\makebox.
+ * \author Ling Li
+ *
+ * Full author contact details are available in file CREDITS
+ */
+
+// consolidate with MathFrameboxInset?
+
+class MathMakeboxInset : public MathNestInset {
+public:
+ ///
+ MathMakeboxInset();
+ ///
+ MathInset * clone() const;
+ ///
+ void metrics(MetricsInfo & mi) const;
+ ///
+ void draw(PainterInfo & pi, int x, int y) const;
+ ///
+ void write(WriteStream & os) const;
+ /// write normalized content
+ void normalize(NormalStream & ns) const;
+ ///
+ mode_type currentMode() const { return TEXT_MODE; }
+private:
+ /// width of '[' in current font
+ mutable int w_;
+};
+
+#endif
pi.pain.line(x, d - 3, x, d, LColor::mathframe);
pi.pain.line(t, d - 3, t, d, LColor::mathframe);
pi.pain.line(x, d, x + 3, d, LColor::mathframe);
- pi.pain.line(t - 2, d, t, d, LColor::mathframe);
+ pi.pain.line(t - 3, d, t, d, LColor::mathframe);
}
pi.pain.line(x, a + 3, x, a, LColor::mathframe);
pi.pain.line(t, a + 3, t, a, LColor::mathframe);
pi.pain.line(x, a, x + 3, a, LColor::mathframe);
- pi.pain.line(t - 2, a, t, a, LColor::mathframe);
+ pi.pain.line(t - 3, a, t, a, LColor::mathframe);
}
parse2(cell->back(), FLAG_ITEM, mode, false);
}
- else if (t.cs() == "framebox") {
+ else if (t.cs() == "framebox" || t.cs() == "makebox") {
cell->push_back(createMathInset(t.cs()));
parse(cell->back().nucleus()->cell(0), FLAG_OPTION, MathInset::TEXT_MODE);
parse(cell->back().nucleus()->cell(1), FLAG_OPTION, MathInset::TEXT_MODE);