X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxcursor.h;h=c36812befd3ac70d82f49f08ab19a6df233d88ab;hb=98c966c64594611e469313314abd1e59524adb4a;hp=9137f48d4e4cc9ba2848c263ae34f22eed6e5d2a;hpb=4b2a999762c83627476428e595d3c1e3704a3da0;p=lyx.git diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 9137f48d4e..c36812befd 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -1,11 +1,11 @@ // -*- 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. * * ====================================================== */ @@ -16,24 +16,25 @@ #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); /// @@ -47,20 +48,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_; + lyx::pos_type pos_; /// bool boundary_; /// @@ -68,12 +67,12 @@ private: /// int x_fix_; /// - unsigned long y_; + int y_; /// Row * row_; }; - +/// inline bool operator==(LyXCursor const & a, LyXCursor const & b) { @@ -82,11 +81,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