X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Flyxcursor.h;h=0fdf06a2961d30637f34f768f4fea6e619932d55;hb=d1182f17daa1a164d9527ccbe6500840d7ac6bc8;hp=12a25b08188b48681c53556e34a0a15a46fa57e3;hpb=dfe1bc44b44903faf77ef454c98c4c3e56c1d5e3;p=lyx.git diff --git a/src/lyxcursor.h b/src/lyxcursor.h index 12a25b0818..0fdf06a296 100644 --- a/src/lyxcursor.h +++ b/src/lyxcursor.h @@ -1,40 +1,93 @@ // -*- C++ -*- /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * - * Copyright (C) 1995 Matthias Ettrich + * Copyright 1995 Matthias Ettrich + * 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; -/** All these variavles should be explained. Matthias? +/** All these variables should be explained. Matthias? */ -struct LyXCursor { +class LyXCursor { +public: + LyXCursor(); /// - LyXParagraph * par; -#ifdef NEW_TEXT + void par(Paragraph * p); /// - LyXParagraph::size_type pos; -#else + Paragraph * par(); /// - int pos; -#endif + Paragraph * par() const; + /// + void pos(Paragraph::size_type p); + /// + Paragraph::size_type pos() const; + /// + void boundary(bool b); + /// + bool boundary() const; + /// + void x(int i); + /// + int x() const; + /// + void x_fix(int i); /// - int x; + int x_fix() const; /// - int x_fix; + void y(int i); /// - long y; + int y() const; /// - Row * row; + void row(Row * r); + /// + Row * row(); + /// + Row * row() const; +private: + /// The paragraph the cursor is in. + Paragraph * par_; + /// The position inside the paragraph + Paragraph::size_type pos_; + /// + bool boundary_; + /// + int x_; + /// + int x_fix_; + /// + int y_; + /// + Row * row_; }; +/// +inline +bool operator==(LyXCursor const & a, LyXCursor const & b) +{ + return (a.par() == b.par()) + && (a.pos() == b.pos()) + && a.boundary() == b.boundary(); +} + +/// +inline +bool operator!=(LyXCursor const & a, LyXCursor const & b) +{ + return !(a == b); +} + #endif