]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_defs.h
some small updates to Painter, and make the new painter the default.
[lyx.git] / src / mathed / math_defs.h
index b7de91e845fe53f9b0cbab65882352c1c1fdedb8..676aeb82d0217e1c114b60e8155edeee65f3c121 100644 (file)
@@ -24,6 +24,8 @@
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
 #include "support/LIstream.h"
 
 #include "LString.h"
@@ -31,6 +33,8 @@
 
 #include "array.h"
 
+class Painter;
+
 
 ///
 enum math_align {
@@ -224,9 +228,14 @@ class MathedInset  {
     MathedInset(MathedInset *);
     ///
     virtual ~MathedInset() {}
-    
+
+#ifdef USE_PAINTER
+       /// Draw the object
+       virtual void draw(Painter &, int x, int baseline) = 0;  
+#else
     /// Draw the object 
     virtual void Draw(int x, int baseline) = 0;
+#endif
 
     /// Write LaTeX and Lyx code
     virtual void Write(ostream &) = 0;
@@ -267,8 +276,10 @@ class MathedInset  {
     virtual void  SetStyle(short st) { size = st; } // Metrics();
     ///
     virtual void  SetName(char const * n) { name = n; }
+#ifndef USE_PAINTER
     /// 
     void setDrawable(long unsigned int d) { pm = d; }
+#endif
  
  protected:
     ///
@@ -283,14 +294,20 @@ class MathedInset  {
     int descent;
     ///
     short size;
+#ifndef USE_PAINTER
     /// This works while only one process can draw unless
     /// the process have their own data
-    static long unsigned int pm;
+    static unsigned long pm;
+#endif
     /// Default metrics
     static int df_asc, df_des, df_width;
 
     /// In a near future maybe we use a better fonts renderer than X
+#ifdef USE_PAINTER
+    void drawStr(Painter &, short, int, int, int, byte *, int);
+#else
     void drawStr(short, int, int, int, byte *, int);
+#endif
        ///
     friend class MathedCursor;
        ///
@@ -332,7 +349,11 @@ class MathParInset: public MathedInset  {
     virtual MathedInset * Clone();
 
     /// Draw the object on a drawable
+#ifdef USE_PAINTER
+    virtual void draw(Painter &, int x, int baseline);
+#else
     virtual void Draw(int x, int baseline);
+#endif
 
     /// Write LaTeX code
     virtual void Write(ostream &);
@@ -436,8 +457,8 @@ struct MathedRowSt {
     }
     ///
     ~MathedRowSt() {
-       delete[] w;
-       if (label) delete[] label;
+           delete[] w;
+           delete[] label;
     }
     /// Should be const but...
     MathedRowSt * getNext() const  { return next; }
@@ -490,8 +511,13 @@ class MathMatrixInset: public MathParInset {
     MathedInset * Clone();
     ///
     virtual ~MathMatrixInset();
+#ifdef USE_PAINTER
+       ///
+       void draw(Painter &, int, int);
+#else
     ///
     void Draw(int, int);
+#endif
     ///
     void Write(ostream &);
     ///