X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_gridinset.h;h=101d506fc3cf8618f4e37afa20ea31b01e75ee06;hb=c9c3b9b447c3f99a059730e7e4a6caf95496221a;hp=8f555774023302506861063968fcb07d57d677f9;hpb=fda98080ccb5d208bd961fb9f73af578622f7d42;p=lyx.git diff --git a/src/mathed/math_gridinset.h b/src/mathed/math_gridinset.h index 8f55577402..101d506fc3 100644 --- a/src/mathed/math_gridinset.h +++ b/src/mathed/math_gridinset.h @@ -2,7 +2,8 @@ #ifndef MATH_GRID_H #define MATH_GRID_H -#include "math_inset.h" +#include "math_nestinset.h" +#include "LString.h" #ifdef __GNUG__ #pragma interface @@ -14,21 +15,21 @@ \author André Pönitz 2001 */ -class MathGridInset : public MathInset { +class MathGridInset : public MathNestInset { /// additional per-row information struct RowInfo { /// RowInfo(); - /// - int descent_; - /// - int ascent_; - /// - int offset_; - /// + /// cached descent + mutable int descent_; + /// cached ascent + mutable int ascent_; + /// cached offset + mutable int offset_; + /// hline abow this row? bool upperline_; - /// + /// hline below this row? bool lowerline_; }; @@ -40,11 +41,11 @@ class MathGridInset : public MathInset { char h_align_; /// cache for drawing int h_offset; - /// - int width_; - /// - int offset_; - /// + /// cached width + mutable int width_; + /// cached offset + mutable int offset_; + /// bool leftline_; /// bool rightline_; @@ -52,15 +53,13 @@ class MathGridInset : public MathInset { public: /// - MathGridInset(int m, int n, string const & nm, MathInsetTypes ot); - /// - virtual MathInset * clone() const = 0; + MathGridInset(int m, int n); /// void write(std::ostream &, bool fragile) const; /// - void metrics(MathStyles st); + void metrics(MathStyles st) const; /// - void draw(Painter &, int, int); + void draw(Painter &, int x, int y) const; /// void halign(string const &); /// @@ -77,6 +76,8 @@ public: const RowInfo & rowinfo(int row) const; /// RowInfo & rowinfo(int row); + /// + bool isGrid() const { return true; } /// int ncols() const { return colinfo_.size(); } @@ -86,6 +87,10 @@ public: int col(int idx) const { return idx % ncols(); } /// int row(int idx) const { return idx / ncols(); } + /// + int cellXOffset(int idx) const; + /// + int cellYOffset(int idx) const; /// bool idxUp(int &, int &) const;