]> git.lyx.org Git - lyx.git/blob - src/lyxcursor.h
Remove unused font variable which caused a warning.
[lyx.git] / src / lyxcursor.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *       
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef LYXCURSOR_H
13 #define LYXCURSOR_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "paragraph.h"
20
21 struct Row;
22
23 /** All these variables should be explained. Matthias?
24  */
25 class LyXCursor {
26 public:
27         LyXCursor();
28         ///
29         void par(Paragraph * p);
30         ///
31         //Paragraph * par();
32         ///
33         Paragraph * par() const;
34         ///
35         void pos(Paragraph::size_type p);
36         ///
37         Paragraph::size_type pos() const;
38         ///
39         void boundary(bool b);
40         ///
41         bool boundary() const;
42         ///
43         void x(int i);
44         ///
45         int x() const;
46         ///
47         void x_fix(int i);
48         ///
49         int x_fix() const;
50         ///
51         void y(int i);
52         ///
53         int y() const;
54         ///
55         void row(Row * r);
56         ///
57         //Row * row();
58         ///
59         Row * row() const;
60 private:
61         /// The paragraph the cursor is in.
62         Paragraph * par_;
63         /// The position inside the paragraph
64         Paragraph::size_type pos_;
65         ///
66         bool boundary_;
67         ///
68         int x_;
69         ///
70         int x_fix_;
71         ///
72         int y_;
73         ///
74         Row * row_;
75 };
76
77 ///
78 inline
79 bool operator==(LyXCursor const & a, LyXCursor const & b)
80 {
81         return (a.par() == b.par())
82                 && (a.pos() == b.pos())
83                 && a.boundary() == b.boundary();
84 }
85
86 ///
87 inline
88 bool operator!=(LyXCursor const & a, LyXCursor const & b)
89 {
90         return !(a == b);
91 }
92
93 ///
94 inline
95 bool operator<(LyXCursor const & a, LyXCursor const & b) 
96 {
97         // Can this be done in a nother way?
98         return (a.y() < b.y() && a.pos() < b.pos());
99 }
100
101 ///
102 inline
103 bool operator>(LyXCursor const & a, LyXCursor const & b) 
104 {
105         return b < a;
106 }
107
108 ///
109 inline
110 bool operator>=(LyXCursor const & a, LyXCursor const & b)
111 {
112 #if 0
113         return (a > b || a == b);
114 #else
115         return !(a < b);
116 #endif
117 }
118
119
120 ///
121 inline
122 bool operator<=(LyXCursor const & a, LyXCursor const & b)
123 {
124 #if 0
125         return (a < b || a == b);
126 #else
127         return !(a > b);
128 #endif
129 }
130
131 #endif