3 #ifndef BUFFERVIEW_PIMPL_H
4 #define BUFFERVIEW_PIMPL_H
6 #include <boost/smart_ptr.hpp>
8 #include "BufferView.h"
9 #include "commandtags.h"
10 #include "frontends/Timeout.h"
13 #include "insets/insetspecialchar.h"
14 #include "support/types.h"
25 struct BufferView::Pimpl : public SigC::Object {
27 Pimpl(BufferView * i, LyXView * o,
28 int xpos, int ypos, int width, int height);
32 void buffer(Buffer *);
34 void resize(int xpos, int ypos, int width, int height);
39 /// Return true if the cursor was fitted.
42 void redoCurrentBuffer();
44 int resizeCurrentBuffer();
48 void update(LyXText *, BufferView::UpdateCodes);
49 /// Update pixmap of screen
52 void workAreaExpose();
54 void updateScrollbar();
56 void scrollCB(double value);
58 * Returns an inset if inset was hit, or 0 if not.
60 * If hit, the coordinates are changed relative to the inset.
62 Inset * checkInsetHit(LyXText *, int & x, int & y);
64 int scrollUp(long time);
66 int scrollDown(long time);
68 void workAreaKeyPress(KeySym, unsigned int state);
70 void workAreaMotionNotify(int x, int y, unsigned int state);
72 void workAreaButtonPress(int x, int y, unsigned int button);
74 void workAreaButtonRelease(int x, int y, unsigned int button);
76 void doubleClick(int x, int y, unsigned int button);
78 void tripleClick(int x, int y, unsigned int button);
80 void selectionRequested();
90 void cursorPrevious(LyXText *);
92 void cursorNext(LyXText *);
94 bool available() const;
96 void beforeChange(LyXText *);
98 void savePosition(unsigned int i);
100 void restorePosition(unsigned int i);
102 bool isSavedPosition(unsigned int i);
120 bool belowMouse() const;
126 void toggleSelection(bool = true);
132 bool insertInset(Inset * inset, string const & lout = string());
134 void updateInset(Inset * inset, bool mark_dirty);
136 bool Dispatch(kb_action action, string const & argument);
139 * Return the on-screen dimensions of the inset at the cursor.
140 * Pre-condition: the cursor must be at an inset.
142 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
144 * check if the given co-ordinates are inside an inset at the given cursor,
145 * if one exists. If so, the inset is returned, and the co-ordinates are
146 * made relative. Otherwise, 0 is returned.
148 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
150 friend class BufferView;
151 /// open and lock an updatable inset
152 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
154 void specialChar(InsetSpecialChar::Kind);
162 void insertAndEditInset(Inset *);
164 void gotoInset(std::vector<Inset::Code> const & codes,
167 void gotoInset(Inset::Code codes, bool same_content);
175 boost::scoped_ptr<LyXScreen> screen_;
177 long current_scrollbar_value;
179 Timeout cursor_timeout;
183 void pasteClipboard(bool asPara);
185 void stuffClipboard(string const &) const;
187 bool using_xterm_cursor;
192 /// Cursor paragraph Id
195 lyx::pos_type par_pos;
197 Position() : par_id(0), par_pos(0) {}
199 Position(string const & f, int id, lyx::pos_type pos)
200 : filename(f), par_id(id), par_pos(pos) {}
203 std::vector<Position> saved_positions;
205 void moveCursorUpdate(bool selecting, bool fitcur = true);
206 /// Get next inset of this class from current cursor position
207 Inset * getInsetByCode(Inset::Code code);
209 void MenuInsertLyXFile(string const & filen);