]> git.lyx.org Git - features.git/blobdiff - src/mathed/MathRow.h
Improved character count statistics for letter based insets (e.g. the LyX logo).
[features.git] / src / mathed / MathRow.h
index 95786b23b4e398768fae2800797fac8d54e48169..6d1a410372b9582b7abeba5683d0d2253b45eedc 100644 (file)
@@ -12,6 +12,7 @@
 #ifndef MATH_ROW_H
 #define MATH_ROW_H
 
+#include "InsetMath.h"
 #include "MathClass.h"
 
 #include "ColorCode.h"
@@ -29,7 +30,6 @@ class PainterInfo;
 
 class InsetMath;
 class MathData;
-class MathMacro;
 
 /*
  * While for editing purpose it is important that macros are counted
@@ -47,41 +47,38 @@ public:
        // What row elements can be
        enum Type {
                INSET, // this element is a plain inset
-               BEG_MACRO, // a macro begins here
-               END_MACRO, // a macro ends here
-               BEG_ARG, // a macro argument begins here
-               END_ARG, // a macro argument ends here
-               BEGIN, // dummy element before row
-               END, // dummy element after row
-               BOX // an empty box
+               BOX, // an empty box
+               BEGIN, // an inset and/or a math array begins here
+               END, // an inset and/or a math array ends here
+               DUMMY // a dummy element (used before or after row)
        };
 
        // An elements, together with its spacing
        struct Element
        {
                ///
-               Element(Type t);
+               Element(MetricsInfo const & mi, Type t, MathClass mc = MC_UNKNOWN);
 
                /// Classifies the contents of the object
                Type type;
+               /// the class of the element
+               MathClass mclass;
+               /// the spacing around the element
+               int before, after;
+               /// count whether the current mathdata is nested in macro(s)
+               int macro_nesting;
+               /// Marker type
+               InsetMath::marker_type marker;
 
                /// When type is INSET
-               /// the math inset
+               /// the math inset (also for BEGIN and END)
                InsetMath const * inset;
-               /// the class of the inset
-               MathClass mclass;
-               /// the spacing around the inset
-               int before, after;
                // Non empty when there is a completion to draw
                docstring compl_text;
                // the number of characters forming the unique part.
                size_t compl_unique_to;
 
-               /// When type is BEG_MACRO, END_MACRO, BEG_ARG, END_ARG
-               /// the math macro
-               MathMacro const * macro;
-
-               // type is BEG_ARG, END_ARG
+               // type is BEGIN, END
                MathData const * ar;
 
                // type is BOX
@@ -89,7 +86,7 @@ public:
        };
 
        ///
-       MathRow() {};
+       MathRow(int asc = 0, int des = 0) : caret_ascent(asc), caret_descent(des) {};
        ///
        typedef std::vector<Element> Elements;
        ///
@@ -114,13 +111,17 @@ public:
        MathRow(MetricsInfo & mi, MathData const * ar);
 
        //
-       void metrics(MetricsInfo & mi, Dimension & dim) const;
+       void metrics(MetricsInfo & mi, Dimension & dim);
        //
        void draw(PainterInfo & pi, int const x, int const y) const;
 
        /// superscript kerning
        int kerning(BufferView const *) const;
 
+       /// useful when the caret visits this cell
+       int caret_ascent, caret_descent;
+
+
 private:
        // Index of the first inset element before position i
        int before(int i) const;