]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.h
Clean up InsetGraphics::Cache and rename as GraphicsInset.
[lyx.git] / src / insets / insettext.h
index 7a97e17789ff244354f2014c120ee1ece9d03bc1..52f76e7e2c9c7f05b2a8360c47f0d6f72aa02d49 100644 (file)
 #ifndef INSETTEXT_H
 #define INSETTEXT_H
 
-
 #include "updatableinset.h"
 #include "LString.h"
 #include "LColor.h"
 #include "ParagraphList.h"
+#include "RowList.h"
+#include "dimension.h"
+#include "frontends/mouse_state.h"
 
 #include "support/types.h"
 
 #include <boost/shared_ptr.hpp>
+#include <map>
 
 class Painter;
 class BufferView;
@@ -70,11 +73,11 @@ public:
        InsetText(BufferParams const &);
        ///
        explicit
-       InsetText(InsetText const &, bool same_id = false);
+       InsetText(InsetText const &);
        ///
        ~InsetText();
        ///
-       Inset * clone(Buffer const &, bool same_id = false) const;
+       Inset * clone() const;
        ///
        InsetText & operator=(InsetText const & it);
        /// empty inset to empty par, or just mark as erased
@@ -84,15 +87,11 @@ public:
        ///
        void write(Buffer const *, std::ostream &) const;
        ///
-       int ascent(BufferView *, LyXFont const &) const;
-       ///
-       int descent(BufferView *, LyXFont const &) const;
-       ///
-       int width(BufferView *, LyXFont const & f) const;
+       void metrics(MetricsInfo &, Dimension &) const;
        ///
        int textWidth(BufferView *, bool fordraw = false) const;
        ///
-       void draw(BufferView *, LyXFont const &, int , float &) const;
+       void draw(PainterInfo & pi, int x, int y) const;
        ///
        void update(BufferView *, bool = false);
        ///
@@ -100,10 +99,6 @@ public:
        ///
        string const editMessage() const;
        ///
-       void edit(BufferView *, int, int, mouse_button::state);
-       ///
-       void edit(BufferView *, bool front = true);
-       ///
        bool isTextInset() const { return true; }
        ///
        void insetUnlock(BufferView *);
@@ -118,7 +113,7 @@ public:
        RESULT localDispatch(FuncRequest const &);
        ///
        int latex(Buffer const *, std::ostream &,
-                 bool fragile, bool free_spc) const;
+                 LatexRunParams const &) const;
        ///
        int ascii(Buffer const *, std::ostream &, int linelen) const;
        ///
@@ -129,17 +124,13 @@ public:
        void validate(LaTeXFeatures & features) const;
        ///
        Inset::Code lyxCode() const { return Inset::TEXT_CODE; }
-       ///
+       /// FIXME, document
        void getCursorPos(BufferView *, int & x, int & y) const;
+       /// Get the absolute document x,y of the cursor
+       virtual void getCursor(BufferView &, int &, int &) const;
        ///
        int insetInInsetY() const;
        ///
-       void toggleInsetCursor(BufferView *);
-       ///
-       void showInsetCursor(BufferView *, bool show = true);
-       ///
-       void hideInsetCursor(BufferView *);
-       ///
        void fitInsetCursor(BufferView *) const;
        ///
        bool insertInset(BufferView *, Inset *);
@@ -156,11 +147,11 @@ public:
        ///
        int getMaxWidth(BufferView *, UpdatableInset const *) const;
        ///
-       void init(InsetText const * ins = 0, bool same_id = false);
+       void init(InsetText const * ins);
        ///
        void writeParagraphData(Buffer const *, std::ostream &) const;
        ///
-       void setParagraphData(Paragraph *, bool same_id = false);
+       void setParagraphData(ParagraphList const &);
        ///
        void setText(string const &, LyXFont const &);
        ///
@@ -201,16 +192,10 @@ public:
        ///
        Inset * getInsetFromID(int id) const;
        ///
-       Paragraph * firstParagraph() const;
-       ///
-       Paragraph * getFirstParagraph(int) const;
+       ParagraphList * getParagraphs(int) const;
        ///
        LyXCursor const & cursor(BufferView *) const;
        ///
-       Paragraph * paragraph() const;
-       ///
-       void paragraph(Paragraph *);
-       ///
        bool allowSpellcheck() const { return true; }
        ///
        WordLangTuple const
@@ -244,7 +229,7 @@ public:
        ///
        void getDrawFont(LyXFont &) const;
        /// append text onto the existing text
-       void appendParagraphs(Buffer * bp, Paragraph *);
+       void appendParagraphs(Buffer * bp, ParagraphList &);
 
        ///
        void addPreview(grfx::PreviewLoader &) const;
@@ -254,6 +239,9 @@ public:
        ///
        mutable int need_update;
 
+       bool haveParagraphs() const {
+               return true;
+       }
        ///
        ParagraphList paragraphs;
 protected:
@@ -336,15 +324,15 @@ private:
        ///
        lyx::pos_type cpos(BufferView *) const;
        ///
-       Paragraph * cpar(BufferView *) const;
+       ParagraphList::iterator cpar(BufferView *) const;
        ///
        bool cboundary(BufferView *) const;
        ///
-       Row * crow(BufferView *) const;
+       RowList::iterator crow(BufferView *) const;
        ///
-       void drawFrame(Painter &) const;
+       void drawFrame(Painter &, int x) const;
        ///
-       void clearInset(BufferView *, int baseline) const;
+       void clearInset(BufferView *, int start_x, int baseline) const;
        ///
        void saveLyXTextState(LyXText *) const;
        ///
@@ -358,15 +346,11 @@ private:
        ///
        mutable bool locked;
        ///
-       mutable int insetAscent;
-       ///
-       mutable int insetDescent;
-       ///
-       mutable int insetWidth;
+       mutable Dimension dim_;
        ///
        mutable int top_y;
        ///
-       Paragraph * inset_par;
+       ParagraphList::iterator inset_par;
        ///
        lyx::pos_type inset_pos;
        ///
@@ -382,7 +366,7 @@ private:
        ///
        UpdatableInset * the_locking_inset;
        ///
-       mutable Paragraph * old_par;
+       mutable ParagraphList::iterator old_par;
        /// The cache.
        mutable Cache cache;
        ///
@@ -393,9 +377,9 @@ private:
        mutable boost::shared_ptr<LyXText> cached_text;
        ///
        struct save_state {
-               Paragraph * lpar;
-               Paragraph * selstartpar;
-               Paragraph * selendpar;
+               ParagraphList::iterator lpar;
+               ParagraphList::iterator selstartpar;
+               ParagraphList::iterator selendpar;
                lyx::pos_type pos;
                lyx::pos_type selstartpos;
                lyx::pos_type selendpos;