From 82121d83da688d958abd9fac5fcf45ef0e4aa315 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 12 Mar 2002 16:39:27 +0000 Subject: [PATCH] traversing math tables should be at least as fast as for ordinary table by now... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3732 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_cursor.C | 2 ++ src/mathed/math_diminset.C | 26 -------------------------- src/mathed/math_diminset.h | 15 ++++++++------- src/mathed/math_xdata.C | 8 +++++--- 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 2fe623fc35..c2a82d1222 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -945,6 +945,7 @@ void MathCursor::touch() void MathCursor::normalize() { +#if 0 // rebreak { MathIterator it = ibegin(formula()->par().nucleus()); @@ -953,6 +954,7 @@ void MathCursor::normalize() if (it.par()->asBoxInset()) it.par()->asBoxInset()->rebreak(); } +#endif if (idx() >= par()->nargs()) { lyxerr << "this should not really happen - 1: " diff --git a/src/mathed/math_diminset.C b/src/mathed/math_diminset.C index 6ea2b8231e..e69de29bb2 100644 --- a/src/mathed/math_diminset.C +++ b/src/mathed/math_diminset.C @@ -1,26 +0,0 @@ -#include - -#include "math_diminset.h" - - -MathDimInset::MathDimInset() - : MathInset(), width_(0), ascent_(0), descent_(0) -{} - - -int MathDimInset::ascent() const -{ - return ascent_; -} - - -int MathDimInset::descent() const -{ - return descent_; -} - - -int MathDimInset::width() const -{ - return width_; -} diff --git a/src/mathed/math_diminset.h b/src/mathed/math_diminset.h index e9e612450f..f8fe2897e1 100644 --- a/src/mathed/math_diminset.h +++ b/src/mathed/math_diminset.h @@ -8,13 +8,14 @@ class MathDimInset : public MathInset { public: - MathDimInset(); - /// - int ascent() const; - /// - int descent() const; - /// - int width() const; + /// not sure whether the initialization is really necessary + MathDimInset() : width_(0), ascent_(0), descent_(0) {} + /// read ascent value (should be inline according to gprof) + int ascent() const { return ascent_; } + /// read descent + int descent() const { return descent_; } + /// read width + int width() const { return width_; } protected: /// diff --git a/src/mathed/math_xdata.C b/src/mathed/math_xdata.C index 3a1faff1fc..914844d9e6 100644 --- a/src/mathed/math_xdata.C +++ b/src/mathed/math_xdata.C @@ -78,14 +78,16 @@ void MathXArray::draw(Painter & pain, int x, int y) const yo_ = y; drawn_ = true; - if (data_.empty()) { + const_iterator it = begin(), et = end(); + + if (it == et) { pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline); return; } - for (const_iterator it = begin(); it != end(); ++it) { + for (; it != et; ++it) { MathInset const * p = it->nucleus(); - MathScriptInset const * q = (it + 1 == end()) ? 0 : asScript(it); + MathScriptInset const * q = (it + 1 == et) ? 0 : asScript(it); if (q) { q->draw(p, pain, x, y); x += q->width2(p); -- 2.39.2