X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxcursor.h;h=1032055f0e5006f217dfe3fe6ee165907d9a3214;hb=c93e9dcbc59d0b404561dbc7c373716f11fc13f1;hp=7606a066b0205dfdfd3fcd9d6383dabfb2be7398;hpb=2889b5fd3e8987d0c265ff4726a7fb6c6cb6c034;p=lyx.git diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 7606a066b0..1032055f0e 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -5,14 +5,18 @@ * 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 "paragraph.h" struct Row; @@ -20,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); /// @@ -43,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_; /// @@ -64,12 +65,11 @@ private: /// int x_fix_; /// - unsigned long y_; + int y_; /// Row * row_; }; - /// inline bool operator==(LyXCursor const & a, LyXCursor const & b) @@ -79,7 +79,6 @@ bool operator==(LyXCursor const & a, LyXCursor const & b) && a.boundary() == b.boundary(); } - /// inline bool operator!=(LyXCursor const & a, LyXCursor const & b) @@ -87,4 +86,34 @@ 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