]> git.lyx.org Git - lyx.git/blob - src/textcursor.h
Point fix, earlier forgotten
[lyx.git] / src / textcursor.h
1 // -*- C++ -*-
2 /**
3  * \file textcursor.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author Lars Gullik Bjønnes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #include "lyxcursor.h"
16
17 #ifndef TEXTCURSOR_H
18 #define TEXTCURSOR_H
19
20 // Do not even think of forward declaring LyXText/BufferView etc here!
21 // If you need Paragraph proper, go to text_func.h
22
23 /** The cursor.
24         Later this variable has to be removed. There should be no internal
25         cursor in a text (and thus not in a buffer). By keeping this it is
26         (I think) impossible to have several views with the same buffer, but
27         the cursor placed at different places.
28         [later]
29         Since the LyXText now has been moved from Buffer to BufferView
30         it should not be absolutely needed to move the cursor...
31         [even later]
32         Nevertheless, it should still be moved, in order to keep classes
33         and interdependencies small.
34         */
35
36 // The structure that keeps track of the selections set.
37 struct Selection {
38         Selection()
39                 : set_(false), mark_(false)
40                 {}
41         bool set() const {
42                 return set_;
43         }
44         void set(bool s) {
45                 set_ = s;
46         }
47         bool mark() const {
48                 return mark_;
49         }
50         void mark(bool m) {
51                 mark_ = m;
52         }
53         LyXCursor cursor; // temporary cursor to hold a cursor position
54                                 // until setSelection is called!
55         LyXCursor start;  // start of a REAL selection
56         LyXCursor end;    // end of a REAL selection
57 private:
58         bool set_; // former selection
59         bool mark_; // former mark_set
60
61 };
62
63 struct TextCursor {
64         ///
65         void setSelection();
66         ///
67         void clearSelection();
68         ///
69         string const selectionAsString(Buffer const & buffer, bool label) const;
70
71         // actual cursor position
72         LyXCursor cursor;
73
74         Selection selection;
75         // this is used to handle XSelection events in the right manner
76         Selection xsel_cache;
77 };
78
79 #endif