math_nestinset.h \
math_numberinset.C \
math_numberinset.h \
+ math_oversetinset.C \
+ math_oversetinset.h \
math_parboxinset.C \
math_parboxinset.h \
math_parinset.C \
#include "math_macrotemplate.h"
#include "math_macroarg.h"
#include "math_makeboxinset.h"
+#include "math_oversetinset.h"
#include "math_parboxinset.h"
#include "math_rootinset.h"
#include "math_sizeinset.h"
inset << '\'' << endl;
if (inset == "ref")
return MathAtom(new RefInset(l->name));
+ if (inset == "overset")
+ return MathAtom(new MathOversetInset);
if (inset == "underset")
return MathAtom(new MathUndersetInset);
if (inset == "decoration")
--- /dev/null
+/**
+ * \file math_oversetinset.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_oversetinset.h"
+#include "math_mathmlstream.h"
+#include "math_support.h"
+
+
+using std::max;
+using std::auto_ptr;
+
+
+MathOversetInset::MathOversetInset()
+{}
+
+
+auto_ptr<InsetBase> MathOversetInset::clone() const
+{
+ return auto_ptr<InsetBase>(new MathOversetInset(*this));
+}
+
+
+void MathOversetInset::metrics(MetricsInfo & mi, Dimension & dim) const
+{
+ cell(1).metrics(mi);
+ FracChanger dummy(mi.base);
+ cell(0).metrics(mi);
+ dim_.wid = max(cell(0).width(), cell(1).width()) + 4;
+ dim_.asc = cell(1).ascent() + cell(0).height() + 4;
+ dim_.des = cell(1).descent();
+ dim = dim_;
+}
+
+
+void MathOversetInset::draw(PainterInfo & pi, int x, int y) const
+{
+ int m = x + pi.width / 2;
+ int yo = y - cell(1).ascent() + cell(0).descent() + 1;
+ cell(1).draw(pi, m - cell(1).width() / 2, y);
+ FracChanger dummy(pi.base);
+ cell(0).draw(pi, m - cell(0).width() / 2, yo);
+}
+
+
+void MathOversetInset::write(WriteStream & os) const
+{
+ os << "\\overset{" << cell(0) << "}{" << cell(1) << '}';
+}
+
+
+void MathOversetInset::normalize(NormalStream & os) const
+{
+ os << "[overset " << cell(0) << ' ' << cell(1) << ']';
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file math_oversetinset.h
+ * 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.
+ */
+
+#ifndef MATH_OVERSETINSET_H
+#define MATH_OVERSETINSET_H
+
+
+#include "math_fracbase.h"
+
+/// Inset for overset
+class MathOversetInset : public MathFracbaseInset {
+public:
+ ///
+ MathOversetInset();
+ ///
+ virtual std::auto_ptr<InsetBase> clone() const;
+ ///
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
+ ///
+ void draw(PainterInfo & pi, int x, int y) const;
+
+ ///
+ void write(WriteStream & os) const;
+ ///
+ void normalize(NormalStream &) const;
+};
+
+#endif
int xo, int y, int yf, int yo)
{
lyxerr << " paintRows: rit: " << &*rit << endl;
- const_cast<LyXText&>(text).updateRowPositions();
+ //const_cast<LyXText&>(text).updateRowPositions();
int const yy = yf - y;
int const y2 = bv.painter().paperHeight();
{
ParagraphList::iterator pit = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end();
- for (int y = 0; pit != end; ++pit) {
+ for (height = 0; pit != end; ++pit) {
RowList::iterator rit = pit->rows.begin();
RowList::iterator rend = pit->rows.end();
for ( ; rit != rend ; rit = ++rit) {
- rit->y(y);
- y += rit->height();
+ rit->y(height);
+ height += rit->height();
}
}
}
//anchor_y_ = 0;
redoParagraphs(ownerParagraphs().begin(), ownerParagraphs().end());
+ updateRowPositions();
// final dimension
dim.asc = firstRow()->ascent_of_text();