X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fmath_xdata.h;h=b35c062b9a575f02826100cec3fe7d52f511f658;hb=c649284611c4198c9d70be8a16d153cdf1ec0700;hp=e4005c6316b3fae487c180b0c8e0d2942425a265;hpb=e71bea78ca687336f17f1070493414fcc8b27241;p=lyx.git diff --git a/src/mathed/math_xdata.h b/src/mathed/math_xdata.h index e4005c6316..b35c062b9a 100644 --- a/src/mathed/math_xdata.h +++ b/src/mathed/math_xdata.h @@ -12,7 +12,8 @@ #pragma interface #endif -class Painter; +class MathPainterInfo; +class TextPainter; /** This class extends a MathArray by drawing routines and caches for @@ -29,14 +30,24 @@ public: /// constructor MathXArray(); /// rebuild cached metrics information - void metrics(MathMetricsInfo const & st) const; + void metrics(MathMetricsInfo & st) const; /// redraw cell using cache metrics information - void draw(Painter & pain, int x, int y) const; + void draw(MathPainterInfo & pain, int x, int y) const; + /// rebuild cached metrics information + void metricsT(TextMetricsInfo const & st) const; + /// redraw cell using cache metrics information + void drawT(TextPainter & pain, 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_; } /// access to cached y coordinate of last drawing int yo() const { return yo_; } + /// access to cached x coordinate of mid point of last drawing + int xm() const { return xo_ + width_ / 2; } + /// access to cached y coordinate of mid point of last drawing + int ym() const { return yo_ + (descent_ - ascent_) / 2; } /// returns x coordinate of given position in the array int pos2x(size_type pos) const; /// returns position of given x coordinate @@ -57,12 +68,16 @@ public: void boundingBox(int & xlow, int & xhigh, int & ylow, int & yhigh); /// find best position to do things //void findPos(PosFinder &) const; + /// 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; /// begin iterator of the underlying MathArray const_iterator begin() const { return data_.begin(); } /// end iterator of the underlying MathArray const_iterator end() const { return data_.end(); } - + public: /// the underlying MathArray MathArray data_; @@ -78,6 +93,10 @@ public: mutable int yo_; /// cache size information of last drawing mutable MathMetricsInfo size_; + /// cached cleaness of cell + mutable bool clean_; + /// cached draw status of cell + mutable bool drawn_; }; /// output cell on a stream