// -*- C++ -*-
/*
* File: math_inset.h
- * Purpose: Declaration of insets for mathed
- * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
+ * Purpose: Declaration of insets for mathed
+ * Author: Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
* Created: January 1996
* Description: Math paragraph and objects for a WYSIWYG math editor.
*
Abstract base class for all math objects. A math insets is for use of the
math editor only, it isn't a general LyX inset. It's used to represent all
-the math objects.
+the math objects.
Math insets do not know there parents, a cursor position or things
like that. The are dumb object that are contained in other math insets
class MathArrayInset;
+class MathBraceInset;
class MathBoxInset;
class MathCharInset;
class MathDelimInset;
class MathSpaceInset;
class MathSymbolInset;
class MathUnknownInset;
+class MathXYMatrixInset;
class NormalStream;
class OctaveStream;
class MathInset {
-public:
+public:
/// short of anything else reasonable
typedef MathArray::size_type size_type;
/// type for cursor positions differences within a cell
/// the virtual base destructor
virtual ~MathInset() {}
- /// draw the object
- virtual void draw(Painter &, int x, int y) const;
/// reproduce itself
virtual MathInset * clone() const = 0;
/// substitutes macro arguments if necessary
/// compute the size of the object, sets ascend_, descend_ and width_
// updates the (xo,yo)-caches of all contained cells
virtual void metrics(MathMetricsInfo const & st) const;
+ /// draw the object
+ virtual void draw(Painter &, int x, int y) const;
+ /// the ascent of the inset above the baseline
+ /// compute the size of the object for text based drawing
+ virtual void metricsT(TextMetricsInfo const & st) const;
+ /// draw the object as text
+ virtual void drawT(TextPainter &, int x, int y) const;
/// the ascent of the inset above the baseline
virtual int ascent() const { return 1; }
/// the descent of the inset below the baseline
/// total height (== ascent + descent)
virtual int height() const;
- /// Where should we go when we press the up cursor key?
- virtual bool idxUp(idx_type & idx) const;
- /// The down key
- virtual bool idxDown(idx_type & idx) const;
+ /// Where should we go when we press the up or down cursor key?
+ virtual bool idxUpDown(idx_type & idx, bool up) const;
/// The left key
virtual bool idxLeft(idx_type & idx, pos_type & pos) const;
/// The right key
virtual bool idxEnd(idx_type & idx, pos_type & pos) const;
/// Delete a cell and move cursor
- // the return value indicates whether the cursor should leave the inset
- // and/or the whole inset should be deleted
- virtual void idxDelete(idx_type & idx, bool & popit, bool & deleteit);
- // deletes a cell range and moves the cursor
- virtual void idxDeleteRange(idx_type from, idx_type to);
+ virtual bool idxDelete(idx_type &) { return false; }
+ /// pulls cell after pressing erase
+ virtual void idxGlue(idx_type) {}
// returns list of cell indices that are "between" from and to for
// selection purposes
virtual std::vector<idx_type> idxBetween(idx_type from, idx_type to) const;
virtual MathXArray & xcell(idx_type);
/// return cell plus drawing cache given its number
virtual MathXArray const & xcell(idx_type) const;
-
+
/// the number of columns of this inset if it is grid-like
virtual col_type ncols() const { return 1; }
/// the number of rows of this inset if it is grid-like
virtual int cellXOffset(idx_type) const { return 0; }
/// any additional y-offset when drawing a cell?
virtual int cellYOffset(idx_type) const { return 0; }
+ /// can we enter this cell?
+ virtual bool validCell(idx_type) const { return true; }
/// identifies certain types of insets
virtual MathArrayInset * asArrayInset() { return 0; }
+ virtual MathBraceInset * asBraceInset() { return 0; }
virtual MathBoxInset * asBoxInset() { return 0; }
virtual MathBoxInset const * asBoxInset() const { return 0; }
virtual MathCharInset const * asCharInset() const { return 0; }
virtual MathStringInset * asStringInset() { return 0; }
virtual MathSymbolInset const * asSymbolInset() const { return 0; }
virtual MathUnknownInset const * asUnknownInset() const { return 0; }
+ virtual MathXYMatrixInset const* asXYMatrixInset() const{ return 0; }
virtual UpdatableInset * asHyperActiveInset() const { return 0; }
/// identifies things that can get scripts