]> git.lyx.org Git - lyx.git/blobdiff - src/insets/lyxinset.h
some small updates to Painter, and make the new painter the default.
[lyx.git] / src / insets / lyxinset.h
index 17b26b046408ad5f505c22797c958cd01fbf5f5d..6a8b29d210ea933673615301519550c977c44513 100644 (file)
 #pragma interface
 #endif
 
+#define USE_PAINTER 1
+
 #include "gettext.h"
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "lyxscreen.h"
 
+//#define USE_PAINTER 1
+
+#ifdef USE_PAINTER
+class Painter;
+#endif
+
 class Buffer;
 struct LaTeXFeatures;
 
@@ -79,6 +87,17 @@ public:
 
        ///
        virtual ~Inset() {}
+#ifdef USE_PAINTER
+       ///
+       virtual int ascent(Painter &, LyXFont const &) const = 0;
+       ///
+       virtual int descent(Painter &, LyXFont const &) const = 0;
+       ///
+       virtual int width(Painter &, LyXFont const &) const = 0;
+       ///
+       virtual void draw(Painter &, LyXFont const &,
+                         int baseline, float & x) const = 0;
+#else
        ///
        virtual int Ascent(LyXFont const & font) const = 0;
        ///
@@ -86,10 +105,11 @@ public:
        ///
        virtual int Width(LyXFont const & font) const = 0;
        ///
-       virtual LyXFont ConvertFont(LyXFont font);
-       ///
        virtual void Draw(LyXFont font, LyXScreen & scr,
                          int baseline, float & x) = 0;
+#endif
+       ///
+       virtual LyXFont ConvertFont(LyXFont font);
        /// what appears in the minibuffer when opening
        virtual char const * EditMessage() const {return _("Opened inset");}
        ///
@@ -99,14 +119,15 @@ public:
        ///
        virtual bool AutoDelete() const;
        ///
-       virtual void Write(FILE * file) = 0;
+       virtual void Write(ostream &) = 0;
        ///
        virtual void Read(LyXLex & lex) = 0;
        /** returns the number of rows (\n's) of generated tex code.
         fragile != 0 means, that the inset should take care about
         fragile commands by adding a \protect before.
         */
-       virtual int Latex(FILE * file, signed char fragile) = 0;
+       virtual int Latex(ostream &, signed char fragile) = 0;
+       ///
        virtual int Latex(string & file, signed char fragile) = 0;
        ///
        virtual int Linuxdoc(string & /*file*/) = 0;
@@ -172,7 +193,7 @@ public:
 class UpdatableInset: public Inset {
 public:
        ///
-       virtual ~UpdatableInset() {}
+       //virtual ~UpdatableInset() {}
        ///
        virtual unsigned char Editable() const;
    
@@ -198,6 +219,6 @@ public:
        bool isCursorVisible() const { return cursor_visible; }
 protected:
        ///
-       bool cursor_visible;
+       mutable bool cursor_visible;
 };
 #endif