+#include <config.h>
+#include "debug.h"
+#include "support/LOstream.h"
+
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_scriptinset.h"
-#include "support/LOstream.h"
-MathScriptInset::MathScriptInset(bool up, bool down)
- : MathUpDownInset(up, down)
+MathScriptInset::MathScriptInset(bool up)
+ : MathNestInset(1), up_(up)
{}
MathInset * MathScriptInset::clone() const
-{
+{
return new MathScriptInset(*this);
}
-void MathScriptInset::WriteNormal(std::ostream & os) const
+void MathScriptInset::write(std::ostream & os, bool fragile) const
+{
+ cell(0).write(os, fragile);
+}
+
+
+void MathScriptInset::metrics(MathStyles st) const
{
- if (up()) {
- os << "[superscript ";
- cell(0).WriteNormal(os);
- os << "] ";
- }
- if (down()) {
- os << "[subscript ";
- cell(1).WriteNormal(os);
- os << "] ";
- }
+ size_ = st;
+ xcell(0).metrics(st);
+ width_ = xcell(0).width();
+ ascent_ = xcell(0).ascent();
+ descent_ = xcell(0).descent();
}
-void MathScriptInset::idxDelete(int & idx, bool & popit, bool & deleteit)
+void MathScriptInset::draw(Painter & pain, int x, int y) const
{
- if (idx == 0)
- up(false);
- else
- down(false);
- popit = true;
- deleteit = !(up() || down());
+ xo(x);
+ yo(y);
+ xcell(0).draw(pain, x, y);
}