]> git.lyx.org Git - lyx.git/blob - src/textcursor.h
move cursor related data fro LyXText to new strcut TextCursor
[lyx.git] / src / textcursor.h
1 // -*- C++ -*-
2 /**
3  * \file cursor.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  *
11  * Full author contact details are available in file CREDITS
12  */
13
14 #include "lyxcursor.h"
15
16 #ifndef TEXTCURSOR_H
17 #define TEXTCURSOR_H
18
19 /** The cursor.
20         Later this variable has to be removed. There should be now internal
21         cursor in a text (and thus not in a buffer). By keeping this it is
22         (I think) impossible to have several views with the same buffer, but
23         the cursor placed at different places.
24         [later]
25         Since the LyXText now has been moved from Buffer to BufferView
26         it should not be absolutely needed to move the cursor...
27         [even later]
28         It should neverthe less to keep classes and intedependencies small 
29         */
30
31 // The structure that keeps track of the selections set.
32 struct Selection {
33         Selection()
34                 : set_(false), mark_(false)
35                 {}
36         bool set() const {
37                 return set_;
38         }
39         void set(bool s) {
40                 set_ = s;
41         }
42         bool mark() const {
43                 return mark_;
44         }
45         void mark(bool m) {
46                 mark_ = m;
47         }
48         LyXCursor cursor; // temporary cursor to hold a cursor position
49                                 // until setSelection is called!
50         LyXCursor start;  // start of a REAL selection
51         LyXCursor end;    // end of a REAL selection
52 private:
53         bool set_; // former selection
54         bool mark_; // former mark_set
55
56 };
57
58 struct TextCursor {
59         // actual cursor position
60         LyXCursor cursor;
61
62         Selection selection;
63         // this is used to handle XSelection events in the right manner
64         Selection xsel_cache;
65
66         /// needed for the toggling (cursor position on last selection made)
67         LyXCursor last_sel_cursor;
68         /// needed for toggling the selection in screen.C
69         LyXCursor toggle_cursor;
70         /// needed for toggling the selection in screen.C
71         LyXCursor toggle_end_cursor;
72 };
73
74 #endif