]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_gridinset.h
move things around
[lyx.git] / src / mathed / math_gridinset.h
index 027433705ea4b3e1423bca6088bc11e0736c76a7..101d506fc3cf8618f4e37afa20ea31b01e75ee06 100644 (file)
@@ -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
     \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 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;