// -*- C++ -*-
/**
- * You are free to use and modify this code under the terms of
- * the GNU General Public Licence version 2 or later.
- */
-
-/** \class MathArray
- \brief Low level container for math insets
- * \author Alejandro Aguilar Sierra
- * \author André Pönitz
- * \author Lars Gullik Bjønnes
+ * \file math_data.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author Alejandro Aguilar Sierra
+ * \author André Pönitz
+ * \author Lars Gullik Bjønnes
*
- * Full author contact details are available in file CREDITS
- \version February 2001
- */
+ * Full author contact details are available in file CREDITS.
+ */
#ifndef MATH_DATA_H
#define MATH_DATA_H
#include "math_atom.h"
#include "dimension.h"
-class MathMacro;
class LaTeXFeatures;
class ReplaceData;
class MetricsInfo;
class TextPainter;
-
-
class MathArray : private std::vector<MathAtom> {
public:
/// re-use inhertited stuff
///
void dump2() const;
///
- void substitute(MathMacro const & macro);
- ///
void replace(ReplaceData &);
+ ///
+ void substitute(MathArray const & m);
/// looks for exact match
bool match(MathArray const & ar) const;
/// checked read access
MathAtom const & operator[](pos_type) const;
/// rebuild cached metrics information
- Dimension const & metrics(MetricsInfo & mi) const;
+ void metrics(MetricsInfo & mi) const;
+ /// rebuild cached metrics information
+ void metrics(MetricsInfo & mi, Dimension & dim) const;
/// redraw cell using cache metrics information
void draw(PainterInfo & pi, int x, int y) const;
/// rebuild cached metrics information
- Dimension const & metricsT(TextMetricsInfo const & mi) const;
+ void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
/// redraw cell using cache metrics information
void drawT(TextPainter & pi, int x, int y) const;
/// mark cell for re-drawing
void touch() const;
/// access to cached x coordinate of last drawing
- int xo() const { return xo_; }
+ int xo() const;
/// access to cached y coordinate of last drawing
- int yo() const { return yo_; }
+ int yo() const;
/// access to cached x coordinate of mid point of last drawing
- int xm() const { return xo_ + dim_.wid / 2; }
+ int xm() const { return xo() + dim_.wid / 2; }
/// access to cached y coordinate of mid point of last drawing
- int ym() const { return yo_ + (dim_.des - dim_.asc) / 2; }
+ int ym() const { return yo() + (dim_.des - dim_.asc) / 2; }
/// write access to coordinate;
void setXY(int x, int y) const;
/// returns x coordinate of given position in the array
/// width of this cell
int width() const { return dim_.wid; }
/// dimensions of cell
- Dimension const & dim() const { return dim_; }
+ Dimension const & dim() const { return dim_; }
/// dimensions of cell
void setDim(Dimension const & d) const { dim_ = d; }
- /// bounding box of this cell
- void boundingBox(int & xlow, int & xhigh, int & ylow, int & yhigh);
- /// gives center coordinates
- void center(int & x, int & y) const;
- /// adjust (x,y) to point on boundary on a straight line from the center
- void towards(int & x, int & y) const;
- /// clean up if necessary
- void notifyCursorLeaves();
private:
/// is this an exact match at this position?
/// cached dimensions of cell
mutable Dimension dim_;
- /// cached x coordinate of last drawing
- mutable int xo_;
- /// cached y coordinate of last drawing
- mutable int yo_;
- /// cached cleaness of cell
- mutable bool clean_;
- /// cached draw status of cell
- mutable bool drawn_;
};
///