3 #ifndef BUFFERVIEW_PIMPL_H
4 #define BUFFERVIEW_PIMPL_H
6 #include "BufferView.h"
7 #include "commandtags.h"
8 #include "frontends/mouse_state.h"
9 #include "frontends/key_state.h"
10 #include "frontends/Timeout.h"
12 #include "frontends/WorkArea.h"
14 #include "insets/insetspecialchar.h"
15 #include "support/types.h"
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/signals/trackable.hpp>
29 struct BufferView::Pimpl : public boost::signals::trackable {
31 Pimpl(BufferView * i, LyXView * o,
32 int xpos, int ypos, int width, int height);
36 void buffer(Buffer *);
38 void resize(int xpos, int ypos, int width, int height);
43 /// Return true if the cursor was fitted.
46 void redoCurrentBuffer();
48 int resizeCurrentBuffer();
52 void update(LyXText *, BufferView::UpdateCodes);
53 /// Update pixmap of screen
56 void workAreaExpose();
58 void updateScrollbar();
60 void scrollCB(double value);
62 * Returns an inset if inset was hit, or 0 if not.
64 * If hit, the coordinates are changed relative to the inset.
66 Inset * checkInsetHit(LyXText *, int & x, int & y);
68 int scrollUp(long time);
70 int scrollDown(long time);
72 void workAreaKeyPress(KeySym, key_modifier::state state);
74 void workAreaMotionNotify(int x, int y, mouse_button::state state);
76 void workAreaButtonPress(int x, int y, mouse_button::state button);
78 void workAreaButtonRelease(int x, int y, mouse_button::state button);
80 void doubleClick(int x, int y, mouse_button::state button);
82 void tripleClick(int x, int y, mouse_button::state button);
84 void selectionRequested();
94 void cursorPrevious(LyXText *);
96 void cursorNext(LyXText *);
98 bool available() const;
100 void beforeChange(LyXText *);
102 void savePosition(unsigned int i);
104 void restorePosition(unsigned int i);
106 bool isSavedPosition(unsigned int i);
124 bool belowMouse() const;
130 void toggleSelection(bool = true);
136 bool insertInset(Inset * inset, string const & lout = string());
138 void updateInset(Inset * inset, bool mark_dirty);
140 bool Dispatch(kb_action action, string const & argument);
143 * Return the on-screen dimensions of the inset at the cursor.
144 * Pre-condition: the cursor must be at an inset.
146 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
148 * check if the given co-ordinates are inside an inset at the given cursor,
149 * if one exists. If so, the inset is returned, and the co-ordinates are
150 * made relative. Otherwise, 0 is returned.
152 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
154 friend class BufferView;
155 /// open and lock an updatable inset
156 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
158 void specialChar(InsetSpecialChar::Kind);
166 void insertAndEditInset(Inset *);
168 void gotoInset(std::vector<Inset::Code> const & codes,
171 void gotoInset(Inset::Code codes, bool same_content);
179 boost::scoped_ptr<LyXScreen> screen_;
181 long current_scrollbar_value;
183 Timeout cursor_timeout;
187 void pasteClipboard(bool asPara);
189 void stuffClipboard(string const &) const;
191 bool using_xterm_cursor;
196 /// Cursor paragraph Id
199 lyx::pos_type par_pos;
201 Position() : par_id(0), par_pos(0) {}
203 Position(string const & f, int id, lyx::pos_type pos)
204 : filename(f), par_id(id), par_pos(pos) {}
207 std::vector<Position> saved_positions;
209 void moveCursorUpdate(bool selecting, bool fitcur = true);
210 /// Get next inset of this class from current cursor position
211 Inset * getInsetByCode(Inset::Code code);
213 void MenuInsertLyXFile(string const & filen);