]> git.lyx.org Git - lyx.git/blobdiff - src/lyxtext.h
fix "make dist" target
[lyx.git] / src / lyxtext.h
index 55dbb9e0f9d4149608c0b59c786d026ab1d070e3..d651cf154cf755184420733145540884b82908fe 100644 (file)
 #include "lyxcursor.h"
 #include "lyxparagraph.h"
 #include "layout.h"
+#include "lyxrow.h"
 
 class Buffer;
 class BufferParams;
-class Row;
 class BufferView;
 class InsetText;
 
@@ -58,7 +58,7 @@ public:
        ///
        mutable int number_of_rows;
        ///
-       mutable long height;
+       mutable int height;
        ///
        mutable unsigned int width;
        /// the current font settings
@@ -66,12 +66,17 @@ public:
        /// 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;
+       ///
+       UpdatableInset * the_locking_inset;
 
+       ///
+       int GetRealCursorX(BufferView *) const;
        ///
        LyXFont const GetFont(Buffer const *, LyXParagraph * par,
                        LyXParagraph::size_type pos) const;
@@ -151,14 +156,10 @@ 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;
        ///
@@ -179,7 +180,7 @@ 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
@@ -191,7 +192,7 @@ public:
         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
         */
@@ -228,9 +229,9 @@ public:
        LyXCursor toggle_end_cursor;
    
        /// need the selection cursor:
-       void SetSelection();
+       void SetSelection(BufferView *);
        ///
-       void ClearSelection() const;
+       void ClearSelection(BufferView *) const;
        ///
        string const selectionAsString(Buffer const *) const;
        
@@ -271,10 +272,10 @@ public:
                         LyXFont const & font) const;
 
        ///
-       void SetCursorFromCoordinates(BufferView *, int x, long y) const;
+       void SetCursorFromCoordinates(BufferView *, int x, int y) const;
        ///
        void SetCursorFromCoordinates(BufferView *, LyXCursor &,
-                                     int x, long y) const;
+                                     int x, int y) const;
        ///
        void CursorUp(BufferView *) const;
        ///
@@ -324,37 +325,15 @@ public:
        };
        /// Change the case of the word at cursor position.
        void ChangeWordCase(BufferView *, TextCase action);
-
+       void TransposeChars(BufferView const &);
+       
        /** returns a printed row in a pixmap. The y value is needed to
          decide, wether it is selected text or not. This is a strange
          solution but faster.
         */
        void GetVisibleRow(BufferView *, int y_offset, int x_offset,
-                          Row * row_ptr, long y, bool cleared=false);
-
-#ifndef NEW_INSETS
-       /* footnotes: */
-       ///
-       void ToggleFootnote(BufferView *);
-       ///
-       void OpenStuff(BufferView *);
-       ///
-       void OpenFootnotes();
-       ///
-       void OpenFootnote(BufferView *);
-       ///
-       void CloseFootnotes();
-       ///
-       void CloseFootnote(BufferView *);
+                          Row * row_ptr, int y, bool cleared=false);
 
-       /** turn the selection into a new environment. If there is no
-         selection, create an empty environment
-        */ 
-       void InsertFootnoteEnvironment(BufferView *,
-                                      LyXParagraph::footnote_kind kind);
-       ///
-       void MeltFootnoteEnvironment(BufferView *);
-#endif
        ///
        void CutSelection(BufferView *, bool = true);
        ///
@@ -388,21 +367,9 @@ public:
                          LyXAlignment align, 
                          string labelwidthstring,
                          bool noindent);
-       ///
-       void SetParagraphExtraOpt(BufferView *, int type,
-                                 string const & width,
-                                 string const & widthp,
-                                 int alignment, bool hfill,
-                                 bool start_minipage);
 
        /* these things are for search and replace */
 
-       /** returns true if the specified string is at the specified
-         position
-         */
-       bool IsStringInText(LyXParagraph * par,
-                           LyXParagraph::size_type pos,
-                           string const & str) const;
        /** sets the selection over the number of characters of string,
          no check!!
          */
@@ -413,22 +380,15 @@ public:
          */
        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 *, string const & str) const;
-       ///
-       bool SearchBackward(BufferView *, string const & str) const;
-
        /// needed to insert the selection
        void InsertStringA(BufferView *, string const & str);
        /// needed to insert the selection
        void InsertStringB(BufferView *, string const & str);
 
-       /// usefull when texing from within LyX
-       bool GotoNextError(BufferView *) const;
-
-       /// just another feature :)
-       bool GotoNextNote(BufferView *) const;
+       /// Find next inset of some specified type.
+       bool GotoNextInset(BufferView *, std::vector<Inset::Code> const & codes,
+                          string const & contents = string()) const;
+       ///
 
        /* for the greater insets */
   
@@ -504,7 +464,7 @@ public:
        }
        ///
        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
@@ -673,4 +633,23 @@ private:
        LyXParagraph * OwnerParagraph(LyXParagraph *) const;
 };
 
+
+/* returns a pointer to the row near the specified y-coordinate
+ * (relative to the whole text). y is set to the real beginning
+ * of this row */
+inline
+Row * LyXText::GetRowNearY(int & y) const
+{
+       // If possible we should optimize this method. (Lgb)
+       Row * tmprow = firstrow;
+       int tmpy = 0;
+       
+       while (tmprow->next() && tmpy + tmprow->height() <= y) {
+               tmpy += tmprow->height();
+               tmprow = tmprow->next();
+       }
+       
+       y = tmpy;   // return the real y
+       return tmprow;
+}
 #endif