]> git.lyx.org Git - lyx.git/blobdiff - src/lyxcursor.h
Call an update before setting the_locking_inset = 0 as otherwise we
[lyx.git] / src / lyxcursor.h
index 7c4bed06bac301329a819e05907ca08147d0d369..d33515c44df339bc985778d887f2ad9aaf519846 100644 (file)
@@ -1,35 +1,40 @@
 // -*- C++ -*-
 /* This file is part of
- * ====================================================== 
- * 
+ * ======================================================
+ *
  *           LyX, The Document Processor
- *      
+ *
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
 #ifndef LYXCURSOR_H
 #define LYXCURSOR_H
 
-#include "lyxparagraph.h"
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "support/types.h"
 
-struct Row;
+class Paragraph;
+class Row;
 
 /** All these variables should be explained. Matthias?
  */
 class LyXCursor {
 public:
        ///
-       void par(LyXParagraph * p);
+       LyXCursor();
        ///
-       LyXParagraph * par();
+       void par(Paragraph * p);
        ///
-       LyXParagraph * par() const;
+       Paragraph * par() const;
        ///
-       void pos(LyXParagraph::size_type p);
+       void pos(lyx::pos_type p);
        ///
-       LyXParagraph::size_type pos() const;
+       lyx::pos_type pos() const;
        ///
        void boundary(bool b);
        ///
@@ -39,37 +44,56 @@ public:
        ///
        int x() const;
        ///
+       void ix(int i);
+       ///
+       int ix() const;
+       ///
        void x_fix(int i);
        ///
        int x_fix() const;
        ///
-       void y(unsigned long i);
+       void y(int i);
        ///
-       unsigned long y() const;
+       int y() const;
        ///
-       void row(Row * r);
+       void iy(int i);
        ///
-       Row * row();
+       int iy() const;
+       ///
+       void row(Row * r);
        ///
        Row * row() const;
+       ///
+       void irow(Row * r);
+       ///
+       Row * irow() const;
 private:
        /// The paragraph the cursor is in.
-       LyXParagraph * par_;
+       Paragraph * par_;
        /// The position inside the paragraph
-       LyXParagraph::size_type pos_;
+       lyx::pos_type pos_;
        ///
        bool boundary_;
        ///
        int x_;
+       /// the x position of the position before the inset when we put
+       /// the cursor on the end of the row before, otherwise equal to x.
+       int ix_;
        ///
        int x_fix_;
        ///
-       unsigned long y_;
+       int y_;
+       /// the y position of the position before the inset when we put
+       /// the cursor on the end of the row before, otherwise equal to y.
+       int iy_;
        ///
        Row * row_;
+       /// the row of the position before the inset when we put
+       /// the cursor on the end of the row before, otherwise equal to row.
+       Row * irow_;
 };
 
-
+///
 inline
 bool operator==(LyXCursor const & a, LyXCursor const & b)
 {
@@ -78,11 +102,41 @@ bool operator==(LyXCursor const & a, LyXCursor const & b)
                && a.boundary() == b.boundary();
 }
 
-
+///
 inline
 bool operator!=(LyXCursor const & a, LyXCursor const & b)
 {
        return !(a == b);
 }
 
+///
+inline
+bool operator<(LyXCursor const & a, LyXCursor const & b)
+{
+       // Can this be done in a nother way?
+       return (a.y() < b.y() && a.pos() < b.pos());
+}
+
+///
+inline
+bool operator>(LyXCursor const & a, LyXCursor const & b)
+{
+       return b < a;
+}
+
+///
+inline
+bool operator>=(LyXCursor const & a, LyXCursor const & b)
+{
+       return !(a < b);
+}
+
+
+///
+inline
+bool operator<=(LyXCursor const & a, LyXCursor const & b)
+{
+       return !(a > b);
+}
+
 #endif