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/Timeout.h"
11 #include "frontends/WorkArea.h"
13 #include "insets/insetspecialchar.h"
14 #include "support/types.h"
16 #include <boost/scoped_ptr.hpp>
27 struct BufferView::Pimpl : public SigC::Object {
29 Pimpl(BufferView * i, LyXView * o,
30 int xpos, int ypos, int width, int height);
34 void buffer(Buffer *);
36 void resize(int xpos, int ypos, int width, int height);
41 /// Return true if the cursor was fitted.
44 void redoCurrentBuffer();
46 int resizeCurrentBuffer();
50 void update(LyXText *, BufferView::UpdateCodes);
51 /// Update pixmap of screen
54 void workAreaExpose();
56 void updateScrollbar();
58 void scrollCB(double value);
60 * Returns an inset if inset was hit, or 0 if not.
62 * If hit, the coordinates are changed relative to the inset.
64 Inset * checkInsetHit(LyXText *, int & x, int & y);
66 int scrollUp(long time);
68 int scrollDown(long time);
70 void workAreaKeyPress(KeySym, key_modifier::state state);
72 void workAreaMotionNotify(int x, int y, mouse_button::state state);
74 void workAreaButtonPress(int x, int y, mouse_button::state button);
76 void workAreaButtonRelease(int x, int y, mouse_button::state button);
78 void doubleClick(int x, int y, mouse_button::state button);
80 void tripleClick(int x, int y, mouse_button::state button);
82 void selectionRequested();
92 void cursorPrevious(LyXText *);
94 void cursorNext(LyXText *);
96 bool available() const;
98 void beforeChange(LyXText *);
100 void savePosition(unsigned int i);
102 void restorePosition(unsigned int i);
104 bool isSavedPosition(unsigned int i);
122 bool belowMouse() const;
128 void toggleSelection(bool = true);
134 bool insertInset(Inset * inset, string const & lout = string());
136 void updateInset(Inset * inset, bool mark_dirty);
138 bool Dispatch(kb_action action, string const & argument);
141 * Return the on-screen dimensions of the inset at the cursor.
142 * Pre-condition: the cursor must be at an inset.
144 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
146 * check if the given co-ordinates are inside an inset at the given cursor,
147 * if one exists. If so, the inset is returned, and the co-ordinates are
148 * made relative. Otherwise, 0 is returned.
150 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
152 friend class BufferView;
153 /// open and lock an updatable inset
154 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
156 void specialChar(InsetSpecialChar::Kind);
164 void insertAndEditInset(Inset *);
166 void gotoInset(std::vector<Inset::Code> const & codes,
169 void gotoInset(Inset::Code codes, bool same_content);
177 boost::scoped_ptr<LyXScreen> screen_;
179 long current_scrollbar_value;
181 Timeout cursor_timeout;
185 void pasteClipboard(bool asPara);
187 void stuffClipboard(string const &) const;
189 bool using_xterm_cursor;
194 /// Cursor paragraph Id
197 lyx::pos_type par_pos;
199 Position() : par_id(0), par_pos(0) {}
201 Position(string const & f, int id, lyx::pos_type pos)
202 : filename(f), par_id(id), par_pos(pos) {}
205 std::vector<Position> saved_positions;
207 void moveCursorUpdate(bool selecting, bool fitcur = true);
208 /// Get next inset of this class from current cursor position
209 Inset * getInsetByCode(Inset::Code code);
211 void MenuInsertLyXFile(string const & filen);