]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
move some selection related stuff over to textcursor.C
[lyx.git] / src / BufferView_pimpl.h
1 // -*- C++ -*-
2 /**
3  * \file BufferView_pimpl.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author various
8  */
9
10 #ifndef BUFFERVIEW_PIMPL_H
11 #define BUFFERVIEW_PIMPL_H
12
13 #include "errorlist.h"
14 #include "BufferView.h"
15 #include "frontends/Timeout.h"
16 #include "frontends/key_state.h"
17 #include "frontends/LyXKeySym.h"
18 #include "support/types.h"
19
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/signals/trackable.hpp>
22
23
24 class Change;
25 class LyXView;
26 class WorkArea;
27 class LyXScreen;
28 class FuncRequest;
29
30 ///
31 struct BufferView::Pimpl : public boost::signals::trackable {
32         ///
33         Pimpl(BufferView * i, LyXView * o,
34               int xpos, int ypos, int width, int height);
35         ///
36         Painter & painter() const;
37         /// return the screen for this bview
38         LyXScreen & screen() const;
39         ///
40         void buffer(Buffer *);
41         /// Return true if the cursor was fitted.
42         bool fitCursor();
43         ///
44         void redoCurrentBuffer();
45         ///
46         int resizeCurrentBuffer();
47         ///
48         void update();
49         //
50         void update(LyXText *, BufferView::UpdateCodes);
51         /// update the toplevel lyx text
52         void update(BufferView::UpdateCodes);
53         /**
54          * Repaint pixmap. Used for when we've made a visible
55          * change but don't need the full update() logic
56          */
57         ///
58         bool loadLyXFile(string const &, bool);
59         ///
60         void repaint();
61         ///
62         void workAreaResize();
63         ///
64         void updateScrollbar();
65         ///
66         void scrollDocView(int value);
67         /**
68          * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
69          */
70         void scroll(int lines);
71         ///
72         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
73         ///
74         void selectionRequested();
75         ///
76         void selectionLost();
77         ///
78         void cursorToggle();
79         ///
80         bool available() const;
81         /// get the change at the cursor position
82         Change const getCurrentChange();
83         ///
84         void beforeChange(LyXText *);
85         ///
86         void savePosition(unsigned int i);
87         ///
88         void restorePosition(unsigned int i);
89         ///
90         bool isSavedPosition(unsigned int i);
91         ///
92         void switchKeyMap();
93         ///
94         void insetUnlock();
95         ///
96         void toggleSelection(bool = true);
97         ///
98         void toggleToggle();
99         ///
100         void center();
101         ///
102         bool insertInset(Inset * inset, string const & lout = string());
103         ///
104         void updateInset(Inset * inset);
105         /// a function should be executed from the workarea
106         bool workAreaDispatch(FuncRequest const & ev);
107         /// a function should be executed
108         bool dispatch(FuncRequest const & ev);
109 private:
110         /// An error list (replaces the error insets)
111         ErrorList errorlist_;
112         /// add an error to the list
113         void addError(ErrorItem const &);
114
115         /// track changes for the document
116         void trackChanges();
117
118         ///
119         friend class BufferView;
120
121         ///
122         BufferView * bv_;
123         ///
124         LyXView * owner_;
125         ///
126         Buffer * buffer_;
127         ///
128         boost::scoped_ptr<LyXScreen> screen_;
129         ///
130         boost::scoped_ptr<WorkArea> workarea_;
131         ///
132         Timeout cursor_timeout;
133         ///
134         void stuffClipboard(string const &) const;
135         ///
136         bool using_xterm_cursor;
137         ///
138         struct Position {
139                 /// Filename
140                 string filename;
141                 /// Cursor paragraph Id
142                 int par_id;
143                 /// Cursor position
144                 lyx::pos_type par_pos;
145                 ///
146                 Position() : par_id(0), par_pos(0) {}
147                 ///
148                 Position(string const & f, int id, lyx::pos_type pos)
149                         : filename(f), par_id(id), par_pos(pos) {}
150         };
151         ///
152         std::vector<Position> saved_positions;
153         /// Get next inset of this class from current cursor position
154         Inset * getInsetByCode(Inset::Code code);
155         ///
156         void MenuInsertLyXFile(string const & filen);
157         /// our workarea
158         WorkArea & workarea() const;
159 };
160 #endif // BUFFERVIEW_PIMPL_H