]> git.lyx.org Git - lyx.git/blobdiff - src/insets/insettext.h
fix typo that put too many include paths for most people
[lyx.git] / src / insets / insettext.h
index 7bb3355b02f6993aa1b55b25328b05dca35db682..cf5977a20a81022fd2941fa8ba54ed738a9469f3 100644 (file)
@@ -1,7 +1,7 @@
 // -*- C++ -*-
 /* This file is part of
  * ======================================================
- * 
+ *
  *           LyX, The Document Processor
  *
  *           Copyright 1998 The LyX Team.
 #include "LColor.h"
 #include "paragraph.h"
 #include "lyxcursor.h"
+
 #include <boost/smart_ptr.hpp>
 
 class Painter;
 class BufferView;
 class Buffer;
+class BufferParams;
 class LyXCursor;
 class LyXText;
 class LyXScreen;
@@ -36,7 +38,7 @@ class Row;
 
 /**
  A text inset is like a TeX box to write full text
- (including styles and other insets) in a given space. 
+ (including styles and other insets) in a given space.
  @author: Jürgen Vigna
  */
 class InsetText : public UpdatableInset {
@@ -72,7 +74,7 @@ public:
                ALWAYS
        };
        ///
-       InsetText();
+       InsetText(BufferParams const &);
        ///
        explicit
        InsetText(InsetText const &, bool same_id = false);
@@ -95,11 +97,11 @@ public:
        ///
        int width(BufferView *, LyXFont const & f) const;
        ///
-       int textWidth(BufferView *) const;
+       int textWidth(BufferView *, bool fordraw = false) const;
        ///
        void draw(BufferView *, LyXFont const &, int , float &, bool) const;
        ///
-       void update(BufferView *, LyXFont const &, bool =false);
+       void update(BufferView *, LyXFont const &, bool = false);
        ///
        void setUpdateStatus(BufferView *, int what) const;
        ///
@@ -122,7 +124,7 @@ public:
        ///
        bool updateInsetInInset(BufferView *, Inset *);
        ///
-       void insetButtonRelease(BufferView *, int, int, int);
+       bool insetButtonRelease(BufferView *, int, int, int);
        ///
        void insetButtonPress(BufferView *, int, int, int);
        ///
@@ -140,7 +142,7 @@ public:
        ///
        int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
        ///
-       int docBook(Buffer const *, std::ostream &) const ;
+       int docbook(Buffer const *, std::ostream &) const ;
        ///
        void validate(LaTeXFeatures & features) const;
        ///
@@ -152,7 +154,7 @@ public:
        ///
        void toggleInsetCursor(BufferView *);
        ///
-       void showInsetCursor(BufferView *, bool show=true);
+       void showInsetCursor(BufferView *, bool show = true);
        ///
        void hideInsetCursor(BufferView *);
        ///
@@ -168,7 +170,7 @@ public:
        ///
        void setFont(BufferView *, LyXFont const &,
                     bool toggleall = false,
-                    bool selectall = false);
+                    bool selectall = false);
        ///
        int getMaxWidth(BufferView *, UpdatableInset const *) const;
        ///
@@ -176,12 +178,14 @@ public:
        ///
        void writeParagraphData(Buffer const *, std::ostream &) const;
        ///
-       void setParagraphData(Paragraph *);
+       void setParagraphData(Paragraph *, bool same_id = false);
        ///
-       void setText(string const &);
+       void setText(string const &, LyXFont const &);
        ///
        void setAutoBreakRows(bool);
        ///
+       bool getAutoBreakRows() const { return autoBreakRows; }
+       ///
        void setDrawFrame(BufferView *, DrawFrame);
        ///
        void setFrameColor(BufferView *, LColor::color);
@@ -199,19 +203,19 @@ public:
        ///
        bool nodraw() const;
        ///
-       int scroll(bool recursive=true) const;
+       int scroll(bool recursive = true) const;
        ///
-       void scroll(BufferView *bv, float sx) const {
+       void scroll(BufferView * bv, float sx) const {
                UpdatableInset::scroll(bv, sx);
        }
        ///
-       void scroll(BufferView *bv, int offset) const {
+       void scroll(BufferView * bv, int offset) const {
                UpdatableInset::scroll(bv, offset);
        }
        ///
-       void selectAll(BufferView *bv);
+       void selectAll(BufferView * bv);
        ///
-       void clearSelection(BufferView *bv);
+       void clearSelection(BufferView * bv);
        ///
        Paragraph * getParFromID(int id) const;
        ///
@@ -219,21 +223,34 @@ public:
        ///
        Paragraph * firstParagraph() const;
        ///
+       Paragraph * getFirstParagraph(int) const;
+       ///
        LyXCursor const & cursor(BufferView *) const;
        ///
        Paragraph * paragraph() const;
        ///
        void paragraph(Paragraph *);
        ///
-       string selectNextWord(BufferView *, float & value) const;
+       bool allowSpellcheck() { return true; }
+       ///
+       string const selectNextWordToSpellcheck(BufferView *,
+                                               float & value) const;
        void selectSelectedWord(BufferView *);
+       ///
        void toggleSelection(BufferView *, bool kill_selection);
        ///
        bool searchForward(BufferView *, string const &,
-                          bool const & = true, bool const & = false);
+                          bool = true, bool = false);
+       ///
        bool searchBackward(BufferView *, string const &,
-                           bool const & = true, bool const & = false);
-       
+                           bool = true, bool = false);
+       ///
+       bool checkInsertChar(LyXFont &);
+       ///
+       void getDrawFont(LyXFont &) const;
+       ///
+       void appendParagraphs(BufferParams const & bparams, Paragraph *);
+       ///
        //
        // Public structures and variables
        ///
@@ -243,6 +260,8 @@ protected:
        ///
        void updateLocal(BufferView *, int what, bool mark_dirty) const;
        ///
+       void lockInset(BufferView *, UpdatableInset *);
+       ///
        mutable int drawTextXOffset;
        ///
        mutable int drawTextYOffset;
@@ -254,14 +273,17 @@ protected:
        LColor::color frame_color;
 
 private:
+       ///
        struct InnerCache {
+               ///
                InnerCache(boost::shared_ptr<LyXText>);
-
+               ///
                boost::shared_ptr<LyXText> text;
+               ///
                bool remove;
        };
        ///
-       typedef std::map<BufferView *, struct InnerCache > Cache;
+       typedef std::map<BufferView *, InnerCache> Cache;
        ///
        typedef Cache::value_type value_type;
        ///
@@ -279,7 +301,7 @@ private:
                                               bool activate_inset = true,
                                               bool selecting = false);
        ///
-       UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind, 
+       UpdatableInset::RESULT moveLeftIntern(BufferView *, bool behind,
                                              bool activate_inset = true,
                                              bool selecting = false);
 
@@ -290,8 +312,6 @@ private:
        ///
        void setCharFont(Buffer const *, int pos, LyXFont const & font);
        ///
-       string const getText(int);
-       ///
        bool checkAndActivateInset(BufferView * bv, bool behind);
        ///
        bool checkAndActivateInset(BufferView * bv, int x = 0, int y = 0,
@@ -303,7 +323,7 @@ private:
        ///
        int cy(BufferView *) const;
        ///
-       Paragraph::size_type cpos(BufferView *) const;
+       lyx::pos_type cpos(BufferView *) const;
        ///
        Paragraph * cpar(BufferView *) const;
        ///
@@ -315,11 +335,16 @@ private:
        ///
        void clearFrame(Painter &, bool cleared) const;
        ///
-       void clearInset(Painter &, int baseline, bool & cleared) const;
+       void clearInset(BufferView *, int baseline, bool & cleared) const;
        ///
        void saveLyXTextState(LyXText *) const;
+       ///
        void restoreLyXTextState(BufferView *, LyXText *) const;
-       
+       ///
+       void reinitLyXText() const;
+       ///
+       void collapseParagraphs(BufferParams const & bparams) const;
+
        /* Private structures and variables */
        ///
        Paragraph * par;
@@ -332,15 +357,11 @@ private:
        ///
        mutable int insetWidth;
        ///
-       mutable int last_width;
-       ///
-       mutable int last_height;
-       ///
        mutable int top_y;
        ///
        Paragraph * inset_par;
        ///
-       Paragraph::size_type inset_pos;
+       lyx::pos_type inset_pos;
        ///
        bool inset_boundary;
        ///
@@ -348,7 +369,7 @@ private:
        ///
        mutable int inset_y;
        ///
-       mutable unsigned int old_max_width;
+       mutable int old_max_width;
        ///
        bool no_selection;
        ///
@@ -368,22 +389,43 @@ private:
        ///
        mutable boost::shared_ptr<LyXText> cached_text;
        ///
-       mutable struct save_state {
+       struct save_state {
                Paragraph * lpar;
                Paragraph * selstartpar;
                Paragraph * selendpar;
-               Paragraph::size_type pos;
-               Paragraph::size_type selstartpos;
-               Paragraph::size_type selendpos;
+               lyx::pos_type pos;
+               lyx::pos_type selstartpos;
+               lyx::pos_type selendpos;
                bool boundary;
                bool selstartboundary;
                bool selendboundary;
                bool selection;
                bool mark_set;
-       } sstate;
+               bool refresh;
+       };
+       ///
+       mutable save_state sstate;
+
        ///
        // this is needed globally so we know that we're using it actually and
        // so the LyXText-Cache is not erased until used!
        mutable LyXText * lt;
+       ///
+       // to remember old painted frame dimensions to clear it on the right spot!
+       ///
+       mutable int frame_x;
+       mutable int frame_y;
+       mutable int frame_w;
+       mutable int frame_h;
+       ///
+       bool in_update; /* as update is not reentrant! */
+       mutable BufferView * do_resize;
+       mutable bool do_reinit;
+       mutable bool in_insetAllowed;
+       ///
+       // these are used to check for mouse movement in Motion selection code
+       ///
+       int mouse_x;
+       int mouse_y;
 };
 #endif