InsetFormula::InsetFormula(InsetFormula const & other)
- : par_(other.par_),
+ : InsetFormulaBase(other),
+ par_(other.par_),
preview_(new PreviewImpl(*this))
{}
void MathDiffInset::addDer(MathArray const & der)
{
cells_.push_back(MathXArray());
- cells_.back().data_ = der;
+ cells_.back().data() = der;
}
// create extra script inset and move superscript over
MathScriptInset * q = new MathScriptInset;
q->ensure(true);
- q->up().data_.swap(p->up().data_);
+ q->up().data().swap(p->up().data());
p->removeScript(true);
// insert new inset behind
if (st != ar.end())
if (MathScriptInset * sub = (*st)->asScriptInset())
if (sub->hasDown()) {
- p->cell(2) = sub->down().data_;
+ p->cell(2) = sub->down().data();
++st;
}
if (st != ar.end())
if (MathScriptInset * sup = (*st)->asScriptInset())
if (sup->hasUp()) {
- p->cell(3) = sup->up().data_;
+ p->cell(3) = sup->up().data();
++st;
}
if (MathScriptInset * sub = (*st)->asScriptInset())
if (sub->hasDown()) {
// try to figure out the summation index from the subscript
- MathArray & ar = sub->down().data_;
+ MathArray & ar = sub->down().data();
MathArray::iterator it =
find_if(ar.begin(), ar.end(), &testEqualSign);
if (it != ar.end()) {
if (st != ar.end())
if (MathScriptInset * sup = (*st)->asScriptInset())
if (sup->hasUp()) {
- p->cell(3) = sup->up().data_;
+ p->cell(3) = sup->up().data();
++st;
}
if (script && script->hasUp()) {
// things like d.../dx^n
int mult = 1;
- if (extractNumber(script->up().data_, mult)) {
+ if (extractNumber(script->up().data(), mult)) {
//lyxerr << "mult: " << mult << endl;
for (int i = 0; i < mult; ++i)
diff->addDer(MathArray(dt + 1, st));
MathArray & MathInset::cell(idx_type)
{
lyxerr << "I don't have a cell 3\n";
- return dummyCell.data_;
+ return dummyCell.data();
}
MathArray const & MathInset::cell(idx_type) const
{
lyxerr << "I don't have a cell 4\n";
- return dummyCell.data_;
+ return dummyCell.data();
}
}
expand();
- expanded_.data_.substitute(*this);
+ expanded_.data().substitute(*this);
expanded_.metrics(mi_);
width_ = expanded_.width();
ascent_ = expanded_.ascent();
void MathMacro::maplize(MapleStream & os) const
{
updateExpansion();
- ::maplize(expanded_.data_, os);
+ ::maplize(expanded_.data(), os);
}
void MathMacro::mathmlize(MathMLStream & os) const
{
updateExpansion();
- ::mathmlize(expanded_.data_, os);
+ ::mathmlize(expanded_.data(), os);
}
void MathMacro::octavize(OctaveStream & os) const
{
updateExpansion();
- ::octavize(expanded_.data_, os);
+ ::octavize(expanded_.data(), os);
}
void MathMacro::updateExpansion() const
{
expand();
- expanded_.data_.substitute(*this);
+ expanded_.data().substitute(*this);
}
MathArray & MathNestInset::cell(idx_type i)
{
- return cells_[i].data_;
+ return cells_[i].data();
}
MathArray const & MathNestInset::cell(idx_type i) const
{
- return cells_[i].data_;
+ return cells_[i].data();
}
else
os << "{}";
- if (hasDown() && down().data_.size())
- os << "_{" << down().data_ << '}';
+ if (hasDown() && down().data().size())
+ os << "_{" << down().data() << '}';
- if (hasUp() && up().data_.size())
- os << "^{" << up().data_ << '}';
+ if (hasUp() && up().data().size())
+ os << "^{" << up().data() << '}';
}
void MathScriptInset::normalize2(MathInset const * nuc, NormalStream & os) const
{
- bool d = hasDown() && down().data_.size();
- bool u = hasUp() && up().data_.size();
+ bool d = hasDown() && down().data().size();
+ bool u = hasUp() && up().data().size();
if (u)
os << "[sup ";
os << "[par]";
if (d)
- os << down().data_ << ']';
+ os << down().data() << ']';
if (u)
- os << up().data_ << ']';
+ os << up().data() << ']';
}
{
if (nuc)
os << nuc;
- if (hasDown() && down().data_.size())
- os << '[' << down().data_ << ']';
- if (hasUp() && up().data_.size())
- os << "^(" << up().data_ << ')';
+ if (hasDown() && down().data().size())
+ os << '[' << down().data() << ']';
+ if (hasUp() && up().data().size())
+ os << "^(" << up().data() << ')';
}
void MathScriptInset::mathematicize2(MathInset const * nuc, MathematicaStream & os) const
{
- bool d = hasDown() && down().data_.size();
- bool u = hasUp() && up().data_.size();
+ bool d = hasDown() && down().data().size();
+ bool u = hasUp() && up().data().size();
if (nuc)
if (d) //subscript only if nuc !
else
os << nuc;
if (u)
- os << "^(" << up().data_ << ")";
+ os << "^(" << up().data() << ")";
if (nuc)
if (d)
- os << "," << down().data_ << "]";
+ os << "," << down().data() << "]";
}
void MathScriptInset::mathmlize2(MathInset const * nuc, MathMLStream & os) const
{
- bool d = hasDown() && down().data_.size();
- bool u = hasUp() && up().data_.size();
+ bool d = hasDown() && down().data().size();
+ bool u = hasUp() && up().data().size();
if (u && d)
os << MTag("msubsup");
os << "<mrow/>";
if (u && d)
- os << down().data_ << up().data_ << ETag("msubsup");
+ os << down().data() << up().data() << ETag("msubsup");
else if (u)
- os << up().data_ << ETag("msup");
+ os << up().data() << ETag("msup");
else if (d)
- os << down().data_ << ETag("msub");
+ os << down().data() << ETag("msub");
}
{
if (nuc)
os << nuc;
- if (hasDown() && down().data_.size())
- os << '[' << down().data_ << ']';
- if (hasUp() && up().data_.size())
- os << "^(" << up().data_ << ')';
+ if (hasDown() && down().data().size())
+ os << '[' << down().data() << ']';
+ if (hasUp() && up().data().size())
+ os << "^(" << up().data() << ')';
}
{
//MathStyleChanger dummy(mi.base, MathStyles(key_->id));
xcell(0).metrics(mi);
- ascent_ = xcell(0).ascent_ + 1;
- descent_ = xcell(0).descent_ + 1;
- width_ = xcell(0).width_ + 2;
+ ascent_ = xcell(0).ascent() + 1;
+ descent_ = xcell(0).descent() + 1;
+ width_ = xcell(0).width() + 2;
}
/// constructor
MathXArray();
/// rebuild cached metrics information
- void metrics(MathMetricsInfo & st) const;
+ void metrics(MathMetricsInfo & mi) const;
/// redraw cell using cache metrics information
- void draw(MathPainterInfo & pain, int x, int y) const;
+ void draw(MathPainterInfo & pi, int x, int y) const;
/// rebuild cached metrics information
- void metricsT(TextMetricsInfo const & st) const;
+ void metricsT(TextMetricsInfo const & mi) const;
/// redraw cell using cache metrics information
- void drawT(TextPainter & pain, int x, int y) const;
+ void drawT(TextPainter & pi, int x, int y) const;
/// mark cell for re-drawing
void touch() const;
const_iterator begin() const { return data_.begin(); }
/// end iterator of the underlying MathArray
const_iterator end() const { return data_.end(); }
+ /// access to data
+ MathArray const & data() const { return data_; }
+ /// access to data
+ MathArray & data() { return data_; }
-public:
+private:
/// the underlying MathArray
MathArray data_;
/// cached width of cell
mutable bool clean_;
/// cached draw status of cell
mutable bool drawn_;
+
+ // cached metrics
+ struct Row {
+ ///
+ Row();
+ /// y offset relative to yo
+ int yo;
+ /// glue between words
+ int glue;
+ };
+ std::vector<Row> rows_;
};
/// output cell on a stream