]> git.lyx.org Git - lyx.git/blobdiff - src/lyxcursor.h
some support for matrix operations with maple ('M-x math-extern maple evalm')
[lyx.git] / src / lyxcursor.h
index 9137f48d4e4cc9ba2848c263ae34f22eed6e5d2a..1032055f0e5006f217dfe3fe6ee165907d9a3214 100644 (file)
@@ -5,7 +5,7 @@
  *           LyX, The Document Processor
  *      
  *           Copyright 1995 Matthias Ettrich
- *           Copyright 1995-2000 The LyX Team.
+ *           Copyright 1995-2001 The LyX Team.
  *
  * ====================================================== */
 
@@ -16,7 +16,7 @@
 #pragma interface
 #endif
 
-#include "lyxparagraph.h"
+#include "paragraph.h"
 
 struct Row;
 
@@ -24,16 +24,15 @@ struct Row;
  */
 class LyXCursor {
 public:
+       LyXCursor();
        ///
-       void par(LyXParagraph * p);
+       void par(Paragraph * p);
        ///
-       LyXParagraph * par();
+       Paragraph * par() const;
        ///
-       LyXParagraph * par() const;
+       void pos(Paragraph::size_type p);
        ///
-       void pos(LyXParagraph::size_type p);
-       ///
-       LyXParagraph::size_type pos() const;
+       Paragraph::size_type pos() const;
        ///
        void boundary(bool b);
        ///
@@ -47,20 +46,18 @@ public:
        ///
        int x_fix() const;
        ///
-       void y(unsigned long i);
+       void y(int i);
        ///
-       unsigned long y() const;
+       int y() const;
        ///
        void row(Row * r);
        ///
-       Row * row();
-       ///
        Row * row() const;
 private:
        /// The paragraph the cursor is in.
-       LyXParagraph * par_;
+       Paragraph * par_;
        /// The position inside the paragraph
-       LyXParagraph::size_type pos_;
+       Paragraph::size_type pos_;
        ///
        bool boundary_;
        ///
@@ -68,12 +65,12 @@ private:
        ///
        int x_fix_;
        ///
-       unsigned long y_;
+       int y_;
        ///
        Row * row_;
 };
 
-
+///
 inline
 bool operator==(LyXCursor const & a, LyXCursor const & b)
 {
@@ -82,11 +79,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