ascii export tweaking

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4604 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-07-11 15:04:43 +00:00
parent 0123437d76
commit e3d52bd203
4 changed files with 21 additions and 26 deletions

View File

@ -154,23 +154,22 @@ int InsetFormula::latex(Buffer const *, ostream & os, bool fragile, bool) const
}
int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
#if 0
TextMetricsInfo mi;
par()->metricsT(mi);
TextPainter tpain(par()->width(), par()->height());
par()->drawT(tpain, 0, par()->ascent());
tpain.show(os);
// reset metrics cache to "real" values
metrics();
return tpain.textheight();
#else
WriteStream wi(os, false, true);
par_->write(wi);
return wi.line();
#endif
if (display()) {
TextMetricsInfo mi;
par()->metricsT(mi);
TextPainter tpain(par()->width(), par()->height());
par()->drawT(tpain, 0, par()->ascent());
tpain.show(os, 3);
// reset metrics cache to "real" values
metrics();
return tpain.textheight();
} else {
WriteStream wi(os, false, true);
wi << ' ' << (par_->asNestInset()->cell(0)) << ' ';
return wi.line();
}
}

View File

@ -213,14 +213,11 @@ void MathHullInset::draw(MathPainterInfo & pi, int x, int y) const
}
void MathHullInset::metricsT(TextMetricsInfo const &) const
void MathHullInset::metricsT(TextMetricsInfo const & mi) const
{
#if 0
if (display()) {
MathGridInset::metricsT(mi);
} else
#endif
{
} else {
ostringstream os;
WriteStream wi(os, false, true);
write(wi);
@ -233,12 +230,9 @@ void MathHullInset::metricsT(TextMetricsInfo const &) const
void MathHullInset::drawT(TextPainter & pain, int x, int y) const
{
#if 0
if (display()) {
MathGridInset::drawT(pain, x, y);
} else
#endif
{
} else {
ostringstream os;
WriteStream wi(os, false, true);
write(wi);

View File

@ -50,10 +50,12 @@ void TextPainter::draw(int x, int y, char c)
}
void TextPainter::show(std::ostream & os) const
void TextPainter::show(std::ostream & os, int offset) const
{
os << '\n';
for (int j = 0; j <= ymax_; ++j) {
for (int i = 0; i < offset; ++i)
os << ' ';
for (int i = 0; i < xmax_; ++i)
os << at(i, j);
os << '\n';

View File

@ -13,7 +13,7 @@ class TextPainter {
///
void draw(int x, int y, char c);
///
void show(std::ostream & os) const;
void show(std::ostream & os, int offset = 0) const;
///
int textheight() const { return ymax_; }
///