3 #ifndef BUFFERVIEW_PIMPL_H
4 #define BUFFERVIEW_PIMPL_H
6 #include <boost/smart_ptr.hpp>
8 #include "BufferView.h"
9 #include "UpdateInset.h"
10 #include "commandtags.h"
11 #include "frontends/Timeout.h"
14 #include "insets/insetspecialchar.h"
15 #include "support/types.h"
26 struct BufferView::Pimpl : public SigC::Object {
28 Pimpl(BufferView * i, LyXView * o,
29 int xpos, int ypos, int width, int height);
33 void buffer(Buffer *);
35 void resize(int xpos, int ypos, int width, int height);
40 /// Return true if the cursor was fitted.
43 void redoCurrentBuffer();
45 int resizeCurrentBuffer();
49 void update(LyXText *, BufferView::UpdateCodes);
50 /// Update pixmap of screen
53 void workAreaExpose();
55 void updateScrollbar();
57 void scrollCB(double value);
59 * Returns an inset if inset was hit, or 0 if not.
61 * If hit, the coordinates are changed relative to the inset.
63 Inset * checkInsetHit(LyXText *, int & x, int & y);
65 int scrollUp(long time);
67 int scrollDown(long time);
69 void workAreaKeyPress(KeySym, unsigned int state);
71 void workAreaMotionNotify(int x, int y, unsigned int state);
73 void workAreaButtonPress(int x, int y, unsigned int button);
75 void workAreaButtonRelease(int x, int y, unsigned int button);
77 void doubleClick(int x, int y, unsigned int button);
79 void tripleClick(int x, int y, unsigned int button);
81 void selectionRequested();
91 void cursorPrevious(LyXText *);
93 void cursorNext(LyXText *);
95 bool available() const;
97 void beforeChange(LyXText *);
99 void savePosition(unsigned int i);
101 void restorePosition(unsigned int i);
103 bool isSavedPosition(unsigned int i);
119 bool belowMouse() const;
125 void toggleSelection(bool = true);
131 bool insertInset(Inset * inset, string const & lout = string());
133 void updateInset(Inset * inset, bool mark_dirty);
135 bool Dispatch(kb_action action, string const & argument);
138 * Return the on-screen dimensions of the inset at the cursor.
139 * Pre-condition: the cursor must be at an inset.
141 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
143 * check if the given co-ordinates are inside an inset at the given cursor,
144 * if one exists. If so, the inset is returned, and the co-ordinates are
145 * made relative. Otherwise, 0 is returned.
147 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
149 friend class BufferView;
150 /// open and lock an updatable inset
151 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
153 void protectedBlank(LyXText * lt);
155 void specialChar(InsetSpecialChar::Kind);
163 void insertAndEditInset(Inset *);
165 void gotoInset(std::vector<Inset::Code> const & codes,
168 void gotoInset(Inset::Code codes, bool same_content);
176 boost::scoped_ptr<LyXScreen> screen_;
178 long current_scrollbar_value;
180 Timeout cursor_timeout;
184 UpdateInset updatelist;
186 void pasteClipboard(bool asPara);
188 void stuffClipboard(string const &) const;
190 bool using_xterm_cursor;
195 /// Cursor paragraph Id
198 lyx::pos_type par_pos;
200 Position() : par_id(0), par_pos(0) {}
202 Position(string const & f, int id, lyx::pos_type pos)
203 : filename(f), par_id(id), par_pos(pos) {}
206 std::vector<Position> saved_positions;
208 void moveCursorUpdate(bool selecting);
209 /// Get next inset of this class from current cursor position
210 Inset * getInsetByCode(Inset::Code code);
212 void MenuInsertLyXFile(string const & filen);