Make Angus' compiler happy

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3794 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-03-21 06:57:13 +00:00
parent 6cb48573c0
commit 277e305082
22 changed files with 85 additions and 89 deletions

View File

@ -297,9 +297,9 @@ int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
#if 1
TextMetricsInfo mi;
par()->metrics(mi);
par()->metricsT(mi);
TextPainter tpain(par()->width(), par()->height());
par()->draw(tpain, 0, par()->ascent());
par()->drawT(tpain, 0, par()->ascent());
tpain.show(os);
// reset metrics cache to "real" values
metrics();

View File

@ -80,7 +80,7 @@ void MathCharInset::draw(Painter & pain, int x, int y) const
}
void MathCharInset::metrics(TextMetricsInfo const &) const
void MathCharInset::metricsT(TextMetricsInfo const &) const
{
width_ = 1;
ascent_ = 1;
@ -88,7 +88,7 @@ void MathCharInset::metrics(TextMetricsInfo const &) const
}
void MathCharInset::draw(TextPainter & pain, int x, int y) const
void MathCharInset::drawT(TextPainter & pain, int x, int y) const
{
//lyxerr << "drawing text '" << char_ << "' code: " << code_ << endl;
pain.draw(x, y, char_);

View File

@ -27,9 +27,9 @@ public:
///
void draw(Painter &, int x, int y) const;
///
void metrics(TextMetricsInfo const & st) const;
void metricsT(TextMetricsInfo const & st) const;
///
void draw(TextPainter &, int x, int y) const;
void drawT(TextPainter &, int x, int y) const;
///
void write(WriteStream & os) const;
///

View File

@ -4,7 +4,7 @@
#include "textpainter.h"
void MathDimInset::metrics(TextMetricsInfo const &) const
void MathDimInset::metricsT(TextMetricsInfo const &) const
{
std::ostringstream os;
os << *this;
@ -14,7 +14,7 @@ void MathDimInset::metrics(TextMetricsInfo const &) const
}
void MathDimInset::draw(TextPainter & pain, int x, int y) const
void MathDimInset::drawT(TextPainter & pain, int x, int y) const
{
std::ostringstream os;
os << *this;

View File

@ -17,9 +17,9 @@ public:
/// read width
int width() const { return width_; }
///
void metrics(TextMetricsInfo const &) const;
void metricsT(TextMetricsInfo const &) const;
///
void draw(TextPainter & pain, int x, int y) const;
void drawT(TextPainter & pain, int x, int y) const;
protected:
///

View File

@ -51,21 +51,21 @@ void MathFracInset::draw(Painter & pain, int x, int y) const
}
void MathFracInset::metrics(TextMetricsInfo const & mi) const
void MathFracInset::metricsT(TextMetricsInfo const & mi) const
{
xcell(0).metrics(mi);
xcell(1).metrics(mi);
xcell(0).metricsT(mi);
xcell(1).metricsT(mi);
width_ = max(xcell(0).width(), xcell(1).width());
ascent_ = xcell(0).height() + 1;
descent_ = xcell(1).height();
}
void MathFracInset::draw(TextPainter & pain, int x, int y) const
void MathFracInset::drawT(TextPainter & pain, int x, int y) const
{
int m = x + width() / 2;
xcell(0).draw(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 1);
xcell(1).draw(pain, m - xcell(1).width() / 2, y + xcell(1).ascent());
xcell(0).drawT(pain, m - xcell(0).width() / 2, y - xcell(0).descent() - 1);
xcell(1).drawT(pain, m - xcell(1).width() / 2, y + xcell(1).ascent());
if (!atop_)
pain.horizontalLine(x, y, width());
}

View File

@ -22,9 +22,9 @@ public:
///
void draw(Painter &, int x, int y) const;
///
void metrics(TextMetricsInfo const & mi) const;
void metricsT(TextMetricsInfo const & mi) const;
///
void draw(TextPainter &, int x, int y) const;
void drawT(TextPainter &, int x, int y) const;
///
MathFracInset * asFracInset();

View File

@ -376,12 +376,12 @@ void MathGridInset::draw(Painter & pain, int x, int y) const
}
void MathGridInset::metrics(TextMetricsInfo const & mi) const
void MathGridInset::metricsT(TextMetricsInfo const & mi) const
{
// let the cells adjust themselves
//MathNestInset::metrics(mi);
for (idx_type i = 0; i < nargs(); ++i)
xcell(i).metrics(mi);
xcell(i).metricsT(mi);
// compute absolute sizes of vertical structure
for (row_type row = 0; row < nrows(); ++row) {
@ -466,10 +466,10 @@ void MathGridInset::metrics(TextMetricsInfo const & mi) const
}
void MathGridInset::draw(TextPainter & pain, int x, int y) const
void MathGridInset::drawT(TextPainter & pain, int x, int y) const
{
for (idx_type idx = 0; idx < nargs(); ++idx)
xcell(idx).draw(pain, x + cellXOffset(idx), y + cellYOffset(idx));
xcell(idx).drawT(pain, x + cellXOffset(idx), y + cellYOffset(idx));
}

View File

@ -74,9 +74,9 @@ public:
///
void draw(Painter &, int x, int y) const;
///
void metrics(TextMetricsInfo const & st) const;
void metricsT(TextMetricsInfo const & st) const;
///
void draw(TextPainter &, int x, int y) const;
void drawT(TextPainter &, int x, int y) const;
///
void halign(string const &);
///

View File

@ -200,7 +200,7 @@ void MathHullInset::draw(Painter & pain, int x, int y) const
}
/*
void MathHullInset::metrics(TextMetricsInfo const & mi) const
void MathHullInset::metricsT(TextMetricsInfo const & mi) const
{
ascent_ = 1;
descent_ = 0;
@ -208,7 +208,7 @@ void MathHullInset::metrics(TextMetricsInfo const & mi) const
}
void MathHullInset::draw(TextPainter & pain, int x, int y) const
void MathHullInset::drawT(TextPainter & pain, int x, int y) const
{
pain.draw(x, y, normalName(objtype_).c_str());
MathGridInset::draw(pain, x, y);

View File

@ -31,9 +31,9 @@ public:
///
void draw(Painter &, int x, int y) const;
///
//void metrics(TextMetricsInfo const & st) const;
//void metricsT(TextMetricsInfo const & st) const;
///
//void draw(TextPainter &, int x, int y) const;
//void drawT(TextPainter &, int x, int y) const;
///
string label(row_type row) const;
///

View File

@ -206,15 +206,15 @@ void MathInset::draw(Painter &, int, int) const
}
void MathInset::metrics(TextMetricsInfo const &) const
void MathInset::metricsT(TextMetricsInfo const &) const
{
lyxerr << "MathInset::metrics(Text) called directly!\n";
lyxerr << "MathInset::metricsT(Text) called directly!\n";
}
void MathInset::draw(TextPainter &, int, int) const
void MathInset::drawT(TextPainter &, int, int) const
{
lyxerr << "MathInset::draw(Text) called directly!\n";
lyxerr << "MathInset::drawT(Text) called directly!\n";
}

View File

@ -110,9 +110,9 @@ public:
virtual void draw(Painter &, int x, int y) const;
/// the ascent of the inset above the baseline
/// compute the size of the object for text based drawing
virtual void metrics(TextMetricsInfo const & st) const;
virtual void metricsT(TextMetricsInfo const & st) const;
/// draw the object as text
virtual void draw(TextPainter &, int x, int y) const;
virtual void drawT(TextPainter &, int x, int y) const;
/// the ascent of the inset above the baseline
virtual int ascent() const { return 1; }
/// the descent of the inset below the baseline

View File

@ -53,10 +53,6 @@ struct TextMetricsInfo {
///
TextMetricsInfo()
{}
/// used to pass some info down
MathNestInset const * inset;
///
int idx;
};
#endif

View File

@ -198,27 +198,6 @@ void MathScriptInset::metrics(MathInset const * nuc,
}
void MathScriptInset::metrics(TextMetricsInfo const & mi) const
{
metrics(0, mi);
}
void MathScriptInset::metrics(MathInset const * nuc,
TextMetricsInfo const & mi) const
{
if (hasUp())
up().metrics(mi);
if (hasDown())
down().metrics(mi);
if (nuc)
nuc->metrics(mi);
//ascent_ = ascent2(nuc);
//descent_ = descent2(nuc);
//width_ = width2(nuc);
}
void MathScriptInset::draw(Painter & pain, int x, int y) const
{
//lyxerr << "unexpected call to MathScriptInset::draw()\n";
@ -226,6 +205,27 @@ void MathScriptInset::draw(Painter & pain, int x, int y) const
}
void MathScriptInset::metricsT(TextMetricsInfo const & mi) const
{
metricsT(0, mi);
}
void MathScriptInset::metricsT(MathInset const * nuc,
TextMetricsInfo const & mi) const
{
if (hasUp())
up().metricsT(mi);
if (hasDown())
down().metricsT(mi);
if (nuc)
nuc->metricsT(mi);
//ascent_ = ascent2(nuc);
//descent_ = descent2(nuc);
//width_ = width2(nuc);
}
void MathScriptInset::draw(MathInset const * nuc, Painter & pain,
int x, int y) const
{
@ -241,22 +241,22 @@ void MathScriptInset::draw(MathInset const * nuc, Painter & pain,
down().draw(pain, x + dx0(nuc), y + dy0(nuc));
}
void MathScriptInset::draw(TextPainter & pain, int x, int y) const
void MathScriptInset::drawT(TextPainter & pain, int x, int y) const
{
//lyxerr << "unexpected call to MathScriptInset::draw()\n";
draw(0, pain, x, y);
drawT(0, pain, x, y);
}
void MathScriptInset::draw(MathInset const * nuc, TextPainter & pain,
void MathScriptInset::drawT(MathInset const * nuc, TextPainter & pain,
int x, int y) const
{
if (nuc)
nuc->draw(pain, x + dxx(nuc), y);
nuc->drawT(pain, x + dxx(nuc), y);
if (hasUp())
up().draw(pain, x + dx1(nuc), y - dy1(nuc));
up().drawT(pain, x + dx1(nuc), y - dy1(nuc));
if (hasDown())
down().draw(pain, x + dx0(nuc), y + dy0(nuc));
down().drawT(pain, x + dx0(nuc), y + dy0(nuc));
}

View File

@ -29,18 +29,18 @@ public:
///
void draw(Painter &, int x, int y) const;
///
void metrics(TextMetricsInfo const & st) const;
void metricsT(TextMetricsInfo const & st) const;
///
void draw(TextPainter &, int x, int y) const;
void drawT(TextPainter &, int x, int y) const;
///
void metrics(MathInset const * nuc, MathMetricsInfo const & st) const;
///
void draw(MathInset const * nuc, Painter &, int x, int y) const;
///
void metrics(MathInset const * nuc, TextMetricsInfo const & st) const;
void metricsT(MathInset const * nuc, TextMetricsInfo const & st) const;
///
void draw(MathInset const * nuc, TextPainter &, int x, int y) const;
void drawT(MathInset const * nuc, TextPainter &, int x, int y) const;
///
int ascent2(MathInset const * nuc) const;
///

View File

@ -44,18 +44,18 @@ void MathSqrtInset::draw(Painter & pain, int x, int y) const
}
void MathSqrtInset::metrics(TextMetricsInfo const & mi) const
void MathSqrtInset::metricsT(TextMetricsInfo const & mi) const
{
xcell(0).metrics(mi);
xcell(0).metricsT(mi);
ascent_ = xcell(0).ascent() + 1;
descent_ = xcell(0).descent();
width_ = xcell(0).width() + 2;
}
void MathSqrtInset::draw(TextPainter & pain, int x, int y) const
void MathSqrtInset::drawT(TextPainter & pain, int x, int y) const
{
xcell(0).draw(pain, x + 2, y);
xcell(0).drawT(pain, x + 2, y);
pain.horizontalLine(x + 2, y - xcell(0).ascent(), xcell(0).width(), '_');
pain.verticalLine (x + 1, y - xcell(0).ascent() + 1, xcell(0).height());
pain.draw(x, y + xcell(0).descent(), '\\');

View File

@ -22,9 +22,9 @@ public:
///
void metrics(MathMetricsInfo const & mi) const;
///
void draw(TextPainter &, int x, int y) const;
void drawT(TextPainter &, int x, int y) const;
///
void metrics(TextMetricsInfo const & mi) const;
void metricsT(TextMetricsInfo const & mi) const;
///
void write(WriteStream & os) const;

View File

@ -77,7 +77,7 @@ void MathSymbolInset::metrics(MathMetricsInfo const & mi) const
MathTextCodes c = code();
if (sym_->latex_font_id > 0 && math_font_available(c)) {
whichFont(font, c, mi_);
mathed_char_dim(font, sym_->latex_font_id, ascent_, descent_, width_);
mathed_char_dim(font, char(sym_->latex_font_id), ascent_, descent_, width_);
if (c == LM_TC_CMEX) {
h_ = 4 * descent_ / 5;
ascent_ += h_;
@ -86,7 +86,7 @@ void MathSymbolInset::metrics(MathMetricsInfo const & mi) const
} else {
if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB)) {
whichFont(font, code2(), mi_);
mathed_char_dim(font, sym_->id, ascent_, descent_, width_);
mathed_char_dim(font, char(sym_->id), ascent_, descent_, width_);
} else {
whichFont(font, LM_TC_TEX, mi_);
mathed_string_dim(font, sym_->name, ascent_, descent_, width_);
@ -105,10 +105,10 @@ void MathSymbolInset::draw(Painter & pain, int x, int y) const
LyXFont font;
if (sym_->latex_font_id > 0 && math_font_available(Code)) {
whichFont(font, Code, mi_);
drawChar(pain, font, x, y - h_, sym_->latex_font_id);
drawChar(pain, font, x, y - h_, char(sym_->latex_font_id));
} else if (sym_->id > 0 && sym_->id < 255 && math_font_available(LM_TC_SYMB)){
whichFont(font, code2(), mi_);
drawChar(pain, font, x, y, sym_->id);
drawChar(pain, font, x, y, char(sym_->id));
} else {
whichFont(font, LM_TC_TEX, mi_);
drawStr(pain, font, x, y, sym_->name);

View File

@ -114,7 +114,7 @@ void MathXArray::draw(Painter & pain, int x, int y) const
}
void MathXArray::metrics(TextMetricsInfo const & mi) const
void MathXArray::metricsT(TextMetricsInfo const & mi) const
{
//if (clean_)
// return;
@ -127,13 +127,13 @@ void MathXArray::metrics(TextMetricsInfo const & mi) const
MathInset const * p = it->nucleus();
MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it);
if (q) {
q->metrics(p, mi);
q->metricsT(p, mi);
ascent_ = max(ascent_, q->ascent2(p));
descent_ = max(descent_, q->descent2(p));
width_ += q->width2(p);
++it;
} else {
p->metrics(mi);
p->metricsT(mi);
ascent_ = max(ascent_, p->ascent());
descent_ = max(descent_, p->descent());
width_ += p->width();
@ -142,7 +142,7 @@ void MathXArray::metrics(TextMetricsInfo const & mi) const
}
void MathXArray::draw(TextPainter & pain, int x, int y) const
void MathXArray::drawT(TextPainter & pain, int x, int y) const
{
//if (drawn_ && x == xo_ && y == yo_)
// return;
@ -159,11 +159,11 @@ void MathXArray::draw(TextPainter & pain, int x, int y) const
MathInset const * p = it->nucleus();
MathScriptInset const * q = (it + 1 == et) ? 0 : asScript(it);
if (q) {
q->draw(p, pain, x, y);
q->drawT(p, pain, x, y);
x += q->width2(p);
++it;
} else {
p->draw(pain, x, y);
p->drawT(pain, x, y);
x += p->width();
}
}

View File

@ -34,9 +34,9 @@ public:
/// redraw cell using cache metrics information
void draw(Painter & pain, int x, int y) const;
/// rebuild cached metrics information
void metrics(TextMetricsInfo const & st) const;
void metricsT(TextMetricsInfo const & st) const;
/// redraw cell using cache metrics information
void draw(TextPainter & pain, int x, int y) const;
void drawT(TextPainter & pain, int x, int y) const;
/// mark cell for re-drawing
void touch() const;

View File

@ -48,8 +48,8 @@ MathXArray const & MathXYArrowInset::targetCell() const
}
}
//lyxerr << "target: x: " << x << " y: " << y << "\n";
int n = mi_.idx + p->ncols() * y + x;
if (n < 0 || n >= int(p->nargs())) {
MathInset::idx_type n = mi_.idx + p->ncols() * y + x;
if (n >= p->nargs()) {
lyxerr << "source: n: " << mi_.idx << "\n";
lyxerr << "target: n: " << n << " out of range\n";
n = 0;