#endif
#include "math_sizeinset.h"
-#include "support/LOstream.h"
+#include "math_parser.h"
+#include "math_mathmlstream.h"
+#include "math_streamstr.h"
+#include "math_support.h"
-MathSizeInset::MathSizeInset(MathStyles st)
- : MathInset(1), style_(st)
-{
- name_ = verbose();
-}
-
-
-char const * MathSizeInset::verbose() const
-{
- switch (style_) {
- case LM_ST_DISPLAY:
- return "displaystyle";
- case LM_ST_TEXT:
- return "textstyle";
- case LM_ST_SCRIPT:
- return "scriptstyle";
- case LM_ST_SCRIPTSCRIPT:
- return "scriptscriptstyle";
- }
- return "unknownstyle";
-}
+MathSizeInset::MathSizeInset(latexkeys const * l)
+ : MathNestInset(1), key_(l)
+{}
MathInset * MathSizeInset::clone() const
}
-void MathSizeInset::draw(Painter & pain, int x, int y)
+void MathSizeInset::draw(Painter & pain, int x, int y) const
{
- xo(x);
- yo(y);
- xcell(0).draw(pain, x, y);
+ xcell(0).draw(pain, x + 1, y);
+ mathed_draw_framebox(pain, x, y, this);
}
-void MathSizeInset::Metrics(MathStyles /* st */, int, int)
+void MathSizeInset::metrics(MathMetricsInfo const & mi) const
{
- xcell(0).Metrics(style_);
- ascent_ = xcell(0).ascent_;
- descent_ = xcell(0).descent_;
- width_ = xcell(0).width_;
+ MathMetricsInfo m = mi;
+ m.style = MathStyles(key_->id);
+ xcell(0).metrics(m);
+ ascent_ = xcell(0).ascent_ + 1;
+ descent_ = xcell(0).descent_ + 1;
+ width_ = xcell(0).width_ + 2;
}
-void MathSizeInset::Write(std::ostream & os, bool fragile) const
+void MathSizeInset::write(WriteStream & os) const
{
- os << "{\\" << name() << " ";
- cell(0).Write(os, fragile);
- os << "}";
+ os << "{\\" << key_->name << ' ' << cell(0) << '}';
}
-void MathSizeInset::WriteNormal(std::ostream & os) const
+void MathSizeInset::normalize(NormalStream & os) const
{
- os << "[" << name() << " ";
- cell(0).WriteNormal(os);
- os << "]";
+ os << "[" << key_->name << ' ' << cell(0) << ']';
}