#include "math_scriptinset.h"
#include "support/LOstream.h"
+#include "support.h"
MathScriptInset::MathScriptInset()
- : MathInset(2), up_(false), down_(false), limits_(0), symbol_(0)
+ : MathNestInset(2), up_(false), down_(false), limits_(0), symbol_(0)
{}
MathScriptInset::MathScriptInset(bool up, bool down, MathInset * symbol)
- : MathInset(2), up_(up), down_(down), limits_(0), symbol_(symbol)
+ : MathNestInset(2), up_(up), down_(down), limits_(0), symbol_(symbol)
{}
MathScriptInset::MathScriptInset(MathScriptInset const & p)
- : MathInset(p), up_(p.up_), down_(p.down_),
+ : MathNestInset(p), up_(p.up_), down_(p.down_),
limits_(p.limits_), symbol_(p.symbol_ ? p.symbol_->clone() : 0)
{}
}
-void MathScriptInset::Write(std::ostream & os, bool fragile) const
+void MathScriptInset::write(std::ostream & os, bool fragile) const
{
if (symbol_) {
- symbol_->Write(os, fragile);
+ symbol_->write(os, fragile);
if (limits())
os << (limits() == 1 ? "\\limits" : "\\nolimits");
}
if (up()) {
os << "^{";
- cell(0).Write(os, fragile);
+ cell(0).write(os, fragile);
os << "}";
}
if (down()) {
os << "_{";
- cell(1).Write(os, fragile);
+ cell(1).write(os, fragile);
os << "}";
}
os << " ";
}
-void MathScriptInset::WriteNormal(std::ostream & os) const
+void MathScriptInset::writeNormal(std::ostream & os) const
{
if (limits() && symbol_)
os << "[" << (limits() ? "limits" : "nolimits") << "]";
if (up()) {
os << "[superscript ";
- cell(0).WriteNormal(os);
+ cell(0).writeNormal(os);
os << "] ";
}
if (down()) {
os << "[subscript ";
- cell(1).WriteNormal(os);
+ cell(1).writeNormal(os);
os << "] ";
}
}
-void MathScriptInset::Metrics(MathStyles st)
+void MathScriptInset::metrics(MathStyles st) const
{
size_ = st;
MathStyles tt = smallerStyleScript(st);
- xcell(0).Metrics(tt);
- xcell(1).Metrics(tt);
+ xcell(0).metrics(tt);
+ xcell(1).metrics(tt);
width_ = std::max(xcell(0).width(), xcell(1).width());
if (hasLimits()) {
- symbol_->Metrics(st);
+ symbol_->metrics(st);
int wid = symbol_->width();
ascent_ = symbol_->ascent();
descent_ = symbol_->descent();
dx0_ = (width_ - xcell(0).width()) / 2;
dx1_ = (width_ - xcell(1).width()) / 2;
} else {
- int asc;
- int des;
+ int asc = 0;
+ int des = 0;
int wid = 0;
mathed_char_height(LM_TC_VAR, st, 'I', asc, des);
if (symbol_) {
- symbol_->Metrics(st);
+ symbol_->metrics(st);
wid = symbol_->width();
asc = symbol_->ascent();
- des = symbol_->descent();
+ des = symbol_->descent();
}
ascent_ = up() ? xcell(0).height() + asc : 0;
descent_ = down() ? xcell(1).height() + des : 0;
}
-void MathScriptInset::draw(Painter & pain, int x, int y)
+void MathScriptInset::draw(Painter & pain, int x, int y) const
{
xo(x);
yo(y);