// -*- 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.
*
* ====================================================== */
#pragma interface
#endif
-#include "lyxparagraph.h"
+#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);
///
///
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);
+ ///
+ int iy() const;
///
- Row * row();
+ 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)
{
&& 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