MathGridInset::maplize(os);
os << ")";
}
+
+
+void MathCasesInset::infoize(std::ostream & os) const
+{
+ os << "Cases ";
+}
///
void draw(MathPainterInfo & pain, int x, int y) const;
+ ///
+ void infoize(std::ostream & os) const;
///
void normalize(NormalStream &) const;
///
#include "textpainter.h"
+void MathDimInset::dimensions(int & w, int & a, int & d) const
+{
+ w = width_;
+ a = ascent_;
+ d = descent_;
+}
+
+
void MathDimInset::metricsT(TextMetricsInfo const &) const
{
std::ostringstream os;
int descent() const { return descent_; }
/// read width
int width() const { return width_; }
+ ///
+ void dimensions(int & w, int & a, int & d) const;
///
void metricsT(TextMetricsInfo const &) const;
///
}
+void MathInset::dimensions(int & w, int & a, int & d) const
+{
+ w = width();
+ a = ascent();
+ d = descent();
+}
+
+
MathXArray dummyCell;
MathXArray & MathInset::xcell(idx_type)
virtual int descent() const { return 1; }
/// total width
virtual int width() const { return 2; }
+ /// all in one batch
+ virtual void dimensions(int & w, int & a, int & d) const;
/// total height (== ascent + descent)
virtual int height() const;
}
-int MathScriptInset::ascent2(MathInset const * nuc) const
+void MathScriptInset::dimensions2
+ (MathInset const * nuc, int & w, int & a, int & d) const
{
- return dy1(nuc) + (hasUp() ? up().ascent() : 0);
-}
-
-
-int MathScriptInset::descent2(MathInset const * nuc) const
-{
- return dy0(nuc) + (hasDown() ? down().descent() : 0);
+ a = dy1(nuc) + (hasUp() ? up().ascent() : 0);
+ d = dy0(nuc) + (hasDown() ? down().descent() : 0);
+ w = width2(nuc);
}
int MathScriptInset::width2(MathInset const * nuc) const
{
- int wid = 0;
+ int w = 0;
if (hasLimits(nuc)) {
- wid = nwid(nuc);
+ w = nwid(nuc);
if (hasUp())
- wid = max(wid, up().width());
+ w = max(w, up().width());
if (hasDown())
- wid = max(wid, down().width());
+ w = max(w, down().width());
} else {
if (hasUp())
- wid = max(wid, up().width());
+ w = max(w, up().width());
if (hasDown())
- wid = max(wid, down().width());
- wid += nwid(nuc);
+ w = max(w, down().width());
+ w += nwid(nuc);
}
- return wid;
+ return w;
}
nuc->metrics(mi);
MathNestInset::metrics(mi);
MathScriptChanger dummy(mi.base);
- ascent_ = ascent2(nuc);
- descent_ = descent2(nuc);
- width_ = width2(nuc);
+ dimensions2(nuc, width_, ascent_, descent_);
}
void metricsT(MathInset const * nuc, TextMetricsInfo const & st) const;
///
void drawT(MathInset const * nuc, TextPainter &, int x, int y) const;
- ///
- int ascent2(MathInset const * nuc) const;
- ///
- int descent2(MathInset const * nuc) const;
- ///
+ /// helper
+ void dimensions2(MathInset const * nuc, int & w, int & a, int & d) const;
+ /// only the width
int width2(MathInset const * nuc) const;
///
}
width_ = 0;
-
- int a = 0;
- int d = 0;
+ ascent_ = 0;
+ descent_ = 0;
for (const_iterator it = begin(); it != end(); ++it) {
MathInset const * p = it->nucleus();
MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
- int w = 0;
+ int ww, aa, dd;
if (q) {
q->metrics(p, mi);
- a = max(a, q->ascent2(p));
- d = max(d, q->descent2(p));
- w = q->width2(p);
+ q->dimensions2(p, ww, aa, dd);
++it;
} else {
p->metrics(mi);
- a = max(a, p->ascent());
- d = max(d, p->descent());
- w = p->width();
}
- width_ += w;
+ ascent_ = max(ascent_, aa);
+ descent_ = max(descent_, dd);
+ width_ += ww;
}
- ascent_ = a;
- descent_ = d;
- //width_ = 0;
-
//lyxerr << "MathXArray::metrics(): '" << ascent_ << " "
// << descent_ << " " << width_ << "'\n";
for (const_iterator it = begin(); it != end(); ++it) {
MathInset const * p = it->nucleus();
MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
+ int ww, aa, dd;
if (q) {
q->metricsT(p, mi);
- ascent_ = max(ascent_, q->ascent2(p));
- descent_ = max(descent_, q->descent2(p));
- width_ += q->width2(p);
+ q->dimensions(ww, aa, dd);
++it;
} else {
p->metricsT(mi);
- ascent_ = max(ascent_, p->ascent());
- descent_ = max(descent_, p->descent());
- width_ += p->width();
}
+ ascent_ = max(ascent_, aa);
+ descent_ = max(descent_, dd);
+ width_ += ww;
}
}