]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
fix typo that put too many include paths for most people
[lyx.git] / src / BufferView_pimpl.h
1 // -*- C++ -*-
2
3 #ifndef BUFFERVIEW_PIMPL_H
4 #define BUFFERVIEW_PIMPL_H
5
6 #include <boost/smart_ptr.hpp>
7
8 #include "BufferView.h"
9 #include "commandtags.h"
10 #include "frontends/Timeout.h"
11 #include "WorkArea.h"
12 #include "box.h"
13 #include "insets/insetspecialchar.h"
14 #include "support/types.h"
15
16 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 class LyXView;
21 class WorkArea;
22 class LyXScreen;
23
24 ///
25 struct BufferView::Pimpl : public SigC::Object {
26         ///
27         Pimpl(BufferView * i, LyXView * o,
28               int xpos, int ypos, int width, int height);
29         ///
30         Painter & painter();
31         ///
32         void buffer(Buffer *);
33         ///
34         void resize(int xpos, int ypos, int width, int height);
35         ///
36         void resize();
37         ///
38         void redraw();
39         /// Return true if the cursor was fitted.
40         bool fitCursor();
41         ///
42         void redoCurrentBuffer();
43         ///
44         int resizeCurrentBuffer();
45         ///
46         void update();
47         //
48         void update(LyXText *, BufferView::UpdateCodes);
49         /// Update pixmap of screen
50         void updateScreen();
51         ///
52         void workAreaExpose();
53         ///
54         void updateScrollbar();
55         ///
56         void scrollCB(double value);
57         /**
58          * Returns an inset if inset was hit, or 0 if not.
59          *
60          * If hit, the coordinates are changed relative to the inset.
61          */
62         Inset * checkInsetHit(LyXText *, int & x, int & y);
63         ///
64         int scrollUp(long time);
65         ///
66         int scrollDown(long time);
67         ///
68         void workAreaKeyPress(KeySym, unsigned int state);
69         ///
70         void workAreaMotionNotify(int x, int y, unsigned int state);
71         ///
72         void workAreaButtonPress(int x, int y, unsigned int button);
73         ///
74         void workAreaButtonRelease(int x, int y, unsigned int button);
75         ///
76         void doubleClick(int x, int y, unsigned int button);
77         ///
78         void tripleClick(int x, int y, unsigned int button);
79         ///
80         void selectionRequested();
81         ///
82         void selectionLost();
83         ///
84         void enterView();
85         ///
86         void leaveView();
87         ///
88         void cursorToggle();
89         ///
90         void cursorPrevious(LyXText *);
91         ///
92         void cursorNext(LyXText *);
93         ///
94         bool available() const;
95         ///
96         void beforeChange(LyXText *);
97         ///
98         void savePosition(unsigned int i);
99         ///
100         void restorePosition(unsigned int i);
101         ///
102         bool isSavedPosition(unsigned int i);
103         ///
104         void setState();
105         ///
106         void insetSleep();
107         ///
108         void insetWakeup();
109         ///
110         void insetUnlock();
111         ///
112         bool focus() const;
113         ///
114         void focus(bool);
115         ///
116         bool active() const;
117         ///
118         bool belowMouse() const;
119         ///
120         void showCursor();
121         ///
122         void hideCursor();
123         ///
124         void toggleSelection(bool = true);
125         ///
126         void toggleToggle();
127         ///
128         void center();
129         ///
130         bool insertInset(Inset * inset, string const & lout = string());
131         ///
132         void updateInset(Inset * inset, bool mark_dirty);
133         ///
134         bool Dispatch(kb_action action, string const & argument);
135 private:
136         /**
137          * Return the on-screen dimensions of the inset at the cursor.
138          * Pre-condition: the cursor must be at an inset.
139          */
140         Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
141         /**
142          * check if the given co-ordinates are inside an inset at the given cursor,
143          * if one exists. If so, the inset is returned, and the co-ordinates are
144          * made relative. Otherwise, 0 is returned.
145          */
146         Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
147         ///
148         friend class BufferView;
149         /// open and lock an updatable inset
150         bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
151         ///
152         void specialChar(InsetSpecialChar::Kind);
153         ///
154         void newline();
155         ///
156         void hfill();
157         ///
158         void smartQuote();
159         ///
160         void insertAndEditInset(Inset *);
161         ///
162         void gotoInset(std::vector<Inset::Code> const & codes,
163                        bool same_content);
164         ///
165         void gotoInset(Inset::Code codes, bool same_content);
166         ///
167         BufferView * bv_;
168         ///
169         LyXView * owner_;
170         ///
171         Buffer * buffer_;
172         ///
173         boost::scoped_ptr<LyXScreen> screen_;
174         ///
175         long current_scrollbar_value;
176         ///
177         Timeout cursor_timeout;
178         ///
179         WorkArea workarea_;
180         ///
181         void pasteClipboard(bool asPara);
182         ///
183         void stuffClipboard(string const &) const;
184         ///
185         bool using_xterm_cursor;
186         ///
187         struct Position {
188                 /// Filename
189                 string filename;
190                 /// Cursor paragraph Id
191                 int par_id;
192                 /// Cursor position
193                 lyx::pos_type par_pos;
194                 ///
195                 Position() : par_id(0), par_pos(0) {}
196                 ///
197                 Position(string const & f, int id, lyx::pos_type pos)
198                         : filename(f), par_id(id), par_pos(pos) {}
199         };
200         ///
201         std::vector<Position> saved_positions;
202         ///
203         void moveCursorUpdate(bool selecting);
204         /// Get next inset of this class from current cursor position
205         Inset * getInsetByCode(Inset::Code code);
206         ///
207         void MenuInsertLyXFile(string const & filen);
208         ///
209         bool inset_slept;
210 };
211 #endif