]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtext.h
Dekels tabular/textinset patches
[lyx.git] / src / lyxtext.h
index c5ea5c05f5c53dc05f66feb737a2f28a9159a1c1..7a7d551ced8406050502274368fe9575197b7fe1 100644 (file)
@@ -41,18 +41,14 @@ public:
                ///
                NEED_MORE_REFRESH,
                ///
-               NEED_VERY_LITTLE_REFRESH
-       };
-
-       enum Letter_Form {
-               FORM_ISOLATED,
-               FORM_INITIAL,
-               FORM_MEDIAL,
-               FORM_FINAL
+               NEED_VERY_LITTLE_REFRESH,
+               ///
+               CHANGED_IN_DRAW
        };
 
        /// Constructor
        LyXText(BufferView *);
+       ///
        LyXText(InsetText *);
    
        /// Destructor
@@ -62,24 +58,25 @@ public:
        ///
        mutable int number_of_rows;
        ///
-       mutable long height;
-       mutable int  width;
+       mutable int height;
+       ///
+       mutable unsigned int width;
        /// the current font settings
        mutable LyXFont current_font;
        /// the current font
        mutable LyXFont real_current_font;
        /// first visible pixel-row is set from LyXScreen!!!
-       unsigned long first;
+       // unsigned is wrong here for text-insets!
+       int first;
        ///
        BufferView * bv_owner;
        ///
        InsetText * inset_owner;
-
        ///
-       //      void owner(BufferView *);
-       
+       UpdatableInset * the_locking_inset;
+
        ///
-       LyXFont GetFont(Buffer const *, LyXParagraph * par,
+       LyXFont const GetFont(Buffer const *, LyXParagraph * par,
                        LyXParagraph::size_type pos) const;
        ///
        void SetCharFont(Buffer const *, LyXParagraph * par,
@@ -157,12 +154,14 @@ public:
            Returns true if something was broken. */
         bool FullRebreak(BufferView *);
 
+#ifndef NEW_INSETS
        ///
        LyXParagraph::footnote_flag GetFootnoteFlag(int row);
+#endif
        ///
        Row * need_break_row;
        ///
-       mutable long refresh_y;
+       mutable int refresh_y;
        ///
        int refresh_height;
        ///
@@ -183,18 +182,19 @@ public:
          (relative to the whole text). y is set to the real beginning
          of this row
          */ 
-       Row * GetRowNearY(long & y) const;
+       Row * GetRowNearY(int & y) const;
        
        /** returns the column near the specified x-coordinate of the row 
         x is set to the real beginning of this column
         */ 
-       int GetColumnNearX(BufferView *, Row * row, int & x, bool & boundary) const;
+       int GetColumnNearX(BufferView *, Row * row,
+                          int & x, bool & boundary) const;
        
        /** returns a pointer to a specified row. y is set to the beginning
         of the row
         */
        Row * GetRow(LyXParagraph * par,
-                    LyXParagraph::size_type pos, long & y) const;
+                    LyXParagraph::size_type pos, int & y) const;
 
        /** returns the height of a default row, needed  for scrollbar
         */
@@ -235,7 +235,7 @@ public:
        ///
        void ClearSelection() const;
        ///
-       string selectionAsString(Buffer const *) const;
+       string const selectionAsString(Buffer const *) const;
        
        /// just selects the word the cursor is in
        void SelectWord(BufferView *);
@@ -245,7 +245,7 @@ public:
         to the beginning of this word. 
         With SelectSelectedWord can this be highlighted really
         */ 
-       char * SelectNextWord(BufferView *, float & value);
+       string const SelectNextWord(BufferView *, float & value) const;
        ///
        void SelectSelectedWord(BufferView *);
        ///
@@ -253,7 +253,7 @@ public:
                       LyXParagraph::size_type pos,
                       bool setfont = true,
                       bool boundary = false) const;
-
+       ///
        void SetCursor(BufferView *, LyXCursor &, LyXParagraph * par,
                       LyXParagraph::size_type pos,
                       bool boundary = false) const;
@@ -274,8 +274,10 @@ public:
                         LyXFont const & font) const;
 
        ///
-       void SetCursorFromCoordinates(BufferView *, int x, long y) const;
-       void SetCursorFromCoordinates(BufferView *, LyXCursor &, int x, long y) const;
+       void SetCursorFromCoordinates(BufferView *, int x, int y) const;
+       ///
+       void SetCursorFromCoordinates(BufferView *, LyXCursor &,
+                                     int x, int y) const;
        ///
        void CursorUp(BufferView *) const;
        ///
@@ -285,10 +287,6 @@ public:
        ///
        void CursorRight(BufferView *, bool internal = true) const;
        ///
-       void CursorLeftIntern(BufferView *, bool internal = true) const;
-       ///
-       void CursorRightIntern(BufferView *, bool internal = true) const;
-       ///
        void CursorLeftOneWord(BufferView *) const;
        ///
        void CursorRightOneWord(BufferView *) const;
@@ -318,10 +316,13 @@ public:
        void DeleteLineForward(BufferView *);
        ///
        bool SelectWordWhenUnderCursor(BufferView *);
-
+       ///
        enum TextCase {
+               ///
                text_lowercase = 0,
+               ///
                text_capitalization = 1,
+               ///
                text_uppercase = 2
        };
        /// Change the case of the word at cursor position.
@@ -332,8 +333,9 @@ public:
          solution but faster.
         */
        void GetVisibleRow(BufferView *, int y_offset, int x_offset,
-                          Row * row_ptr, long y);
+                          Row * row_ptr, int y, bool cleared=false);
 
+#ifndef NEW_INSETS
        /* footnotes: */
        ///
        void ToggleFootnote(BufferView *);
@@ -355,6 +357,7 @@ public:
                                       LyXParagraph::footnote_kind kind);
        ///
        void MeltFootnoteEnvironment(BufferView *);
+#endif
        ///
        void CutSelection(BufferView *, bool = true);
        ///
@@ -388,9 +391,10 @@ public:
                          LyXAlignment align, 
                          string labelwidthstring,
                          bool noindent);
+       ///
        void SetParagraphExtraOpt(BufferView *, int type,
-                                 char const * width,
-                                 char const * widthp,
+                                 string const & width,
+                                 string const & widthp,
                                  int alignment, bool hfill,
                                  bool start_minipage);
 
@@ -401,21 +405,22 @@ public:
          */
        bool IsStringInText(LyXParagraph * par,
                            LyXParagraph::size_type pos,
-                           char const * str) const;
+                           string const & str) const;
        /** sets the selection over the number of characters of string,
          no check!!
          */
-       void SetSelectionOverString(BufferView *, char const * str);
+       void SetSelectionOverString(BufferView *, string const & str);
 
        /** simple replacing. The font of the first selected character
          is used
          */
-       void ReplaceSelectionWithString(BufferView *, char const * str);
+       void ReplaceSelectionWithString(BufferView *, string const & str);
 
        /** if the string can be found: return true and set the cursor to
          the new position */
-       bool SearchForward(BufferView *, char const * str) const;
-       bool SearchBackward(BufferView *, char const * str) const;
+       bool SearchForward(BufferView *, string const & str) const;
+       ///
+       bool SearchBackward(BufferView *, string const & str) const;
 
        /// needed to insert the selection
        void InsertStringA(BufferView *, string const & str);
@@ -438,31 +443,6 @@ public:
        ///
        int NumberOfCell(LyXParagraph * par,
                         LyXParagraph::size_type pos) const;
-       /* table stuff -- begin*/
-
-       /** all table features of the text-class are put together in
-         this function. Possible values of feature are defined in table.h
-         */
-       void TableFeatures(BufferView *, int feature, string const & val) const;
-        ///
-       void TableFeatures(BufferView *, int feature) const;
-
-       /** pos points at the beginning of the next cell (if there is one)
-        */
-       int WidthOfCell(BufferView *, LyXParagraph * par,
-                       LyXParagraph::size_type & pos) const;
-       ///
-       void CheckParagraphInTable(BufferView *, LyXParagraph * par,
-                                  LyXParagraph::size_type pos);
-       ///
-       void InsertCharInTable(BufferView *, char c);
-       ///
-       void BackspaceInTable(BufferView *);
-       ///
-       bool HitInTable(BufferView *, Row * row, int x) const;
-       ///
-       bool MouseHitInTable(BufferView *, int x, long y) const;
-       /* table stuff -- end*/
        ///
        LyXParagraph * GetParFromID(int id);
 
@@ -506,8 +486,6 @@ public:
        ///
        int workWidth(BufferView *) const;
        ///
-       //      Buffer * buffer() const;
-       ///
        void ComputeBidiTables(Buffer const *, Row * row) const;
 
        /// Maps positions in the visual string to positions in logical string.
@@ -527,15 +505,15 @@ public:
                else
                        return vis2log_list[pos-bidi_start];
        }
-
+       ///
        inline
-       int bidi_level(LyXParagraph::size_type pos) const {
+       LyXParagraph::size_type bidi_level(LyXParagraph::size_type pos) const {
                if (bidi_start == -1)
                        return 0;
                else
                        return bidi_levels[pos-bidi_start];
        }       
-
+       ///
        inline
        bool bidi_InRange(LyXParagraph::size_type pos) const {
                return bidi_start == -1 ||
@@ -549,14 +527,14 @@ private:
        ///
        mutable Row * lastrow;
 
-       /** Copybuffer for copy environment type
+       /** Copybuffer for copy environment type.
          Asger has learned that this should be a buffer-property instead
          Lgb has learned that 'char' is a lousy type for non-characters
          */
        LyXTextClass::size_type copylayouttype;
 
        /** inserts a new row behind the specified row, increments
-        * the touched counters */
+           the touched counters */
        void InsertRow(Row * row, LyXParagraph * par,
                       LyXParagraph::size_type pos) const;
        /** removes the row and reset the touched counters */
@@ -566,7 +544,8 @@ private:
        void RemoveParagraph(Row * row) const;
 
        /** insert the specified paragraph behind the specified row */
-       void InsertParagraph(BufferView *, LyXParagraph * par, Row * row) const;
+       void InsertParagraph(BufferView *,
+                            LyXParagraph * par, Row * row) const;
 
        /** appends  the implizit specified paragraph behind the specified row,
         * start at the implizit given position */
@@ -610,7 +589,7 @@ private:
        ///
        void draw(BufferView *, Row const * row,
                  LyXParagraph::size_type & pos,
-                 int offset, float & x);
+                 int offset, float & x, bool cleared);
 
        /// get the next breakpoint in a given paragraph
        LyXParagraph::size_type NextBreakPoint(BufferView *, Row const * row,
@@ -676,9 +655,6 @@ private:
        ///
        mutable bool bidi_same_direction;
 
-       ///
-       unsigned char TransformChar(unsigned char c, Letter_Form form) const;
-
        ///
        unsigned char TransformChar(unsigned char c, LyXParagraph * par,
                                LyXParagraph::size_type pos) const;
@@ -692,13 +668,12 @@ private:
 
        ///
        void charInserted();
-       ///
-       /// special owner functions
+       //
+       // special owner functions
        ///
        LyXParagraph * OwnerParagraph() const;
-       ///
+       //
        LyXParagraph * OwnerParagraph(LyXParagraph *) const;
-       ///
 };
 
 #endif