#define MATH_GRID_H
#include "InsetMathNest.h"
-#include "Length.h"
+#include "support/Length.h"
+
+#include <map>
namespace lyx {
class BufferParams;
-
+class BufferView;
/** Gridded math inset base class.
* This is the base to all grid-like editable math objects
CellInfo();
/// multicolumn flag
Multicolumn multi;
- /// special multi colums alignment
+ /// special multi columns alignment
docstring align;
};
mutable int descent;
/// cached ascent
mutable int ascent;
- /// cached offset
- mutable int offset;
+ /// cached offset for each bufferview
+ mutable std::map<BufferView const *, int> offset;
/// how many hlines above this row?
unsigned int lines;
/// parameter to the line break
};
public:
- /// sets nrows and ncols to 1, vertical alingment to 'c'
- InsetMathGrid(Buffer * buf);
+ /// sets nrows and ncols to 1, vertical alignment to 'c'
+ explicit InsetMathGrid(Buffer * buf);
/// Note: columns first!
InsetMathGrid(Buffer * buf, col_type m, row_type n);
///
///
void drawT(TextPainter & pi, int x, int y) const;
///
- void updateBuffer(ParIterator const &, UpdateType);
+ void updateBuffer(ParIterator const &, UpdateType, bool const deleted = false);
/// extract number of columns from alignment string
static col_type guessColumns(docstring const & halign);
/// accepts some LaTeX column codes: p,m,!,@,M,<,>
/// returns x offset of cell compared to inset
int cellXOffset(BufferView const &, idx_type idx) const;
/// returns y offset of cell compared to inset
- int cellYOffset(idx_type idx) const;
+ int cellYOffset(BufferView const &, idx_type idx) const;
/// Width of cell, taking combined columns into account
int cellWidth(idx_type idx) const;
///
// InsetMathSplit.
/// The value of a fixed col align for a certain hull type (can
/// depend on the "indent math" setting).
- static char colAlign(HullType type, col_type col, BufferParams const &);
+ char colAlign(HullType type, col_type col) const;
/// The value of a fixed col spacing for a certain hull type
static int colSpace(HullType type, col_type col);
/// positions of vertical and horizontal lines
int vLineHOffset(col_type col, unsigned int line) const;
- int hLineVOffset(row_type row, unsigned int line) const;
+ int hLineVOffset(BufferView const &, row_type row, unsigned int line) const;
///
InsetCode lyxCode() const { return MATH_GRID_CODE; }