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 "insets/insetspecialchar.h"
13 #include "support/types.h"
15 #include <boost/scoped_ptr.hpp>
16 #include <boost/signals/trackable.hpp>
30 struct BufferView::Pimpl : public boost::signals::trackable {
32 Pimpl(BufferView * i, LyXView * o,
33 int xpos, int ypos, int width, int height);
36 /// return the work area for this bview
37 WorkArea & workarea() const;
39 void buffer(Buffer *);
41 void resize(int xpos, int ypos, int width, int height);
46 /// Return true if the cursor was fitted.
49 void redoCurrentBuffer();
51 int resizeCurrentBuffer();
55 void update(LyXText *, BufferView::UpdateCodes);
56 /// Update pixmap of screen
59 void workAreaExpose();
61 void updateScrollbar();
63 void scrollCB(double value);
65 * Returns an inset if inset was hit, or 0 if not.
67 * If hit, the coordinates are changed relative to the inset.
69 Inset * checkInsetHit(LyXText *, int & x, int & y);
71 int scrollUp(long time);
73 int scrollDown(long time);
75 void workAreaKeyPress(KeySym, key_modifier::state state);
77 void workAreaMotionNotify(int x, int y, mouse_button::state state);
79 void workAreaButtonPress(int x, int y, mouse_button::state button);
81 void workAreaButtonRelease(int x, int y, mouse_button::state button);
83 void doubleClick(int x, int y, mouse_button::state button);
85 void tripleClick(int x, int y, mouse_button::state button);
87 void selectionRequested();
97 void cursorPrevious(LyXText *);
99 void cursorNext(LyXText *);
101 bool available() const;
103 void beforeChange(LyXText *);
105 void savePosition(unsigned int i);
107 void restorePosition(unsigned int i);
109 bool isSavedPosition(unsigned int i);
129 void toggleSelection(bool = true);
135 bool insertInset(Inset * inset, string const & lout = string());
137 void updateInset(Inset * inset, bool mark_dirty);
139 bool Dispatch(kb_action action, string const & argument);
142 * Return the on-screen dimensions of the inset at the cursor.
143 * Pre-condition: the cursor must be at an inset.
145 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
147 * check if the given co-ordinates are inside an inset at the given cursor,
148 * if one exists. If so, the inset is returned, and the co-ordinates are
149 * made relative. Otherwise, 0 is returned.
151 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
153 friend class BufferView;
154 /// open and lock an updatable inset
155 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
157 void specialChar(InsetSpecialChar::Kind);
165 void insertAndEditInset(Inset *);
167 void gotoInset(std::vector<Inset::Code> const & codes,
170 void gotoInset(Inset::Code codes, bool same_content);
178 boost::scoped_ptr<LyXScreen> screen_;
180 boost::scoped_ptr<WorkArea> workarea_;
182 long current_scrollbar_value;
184 Timeout cursor_timeout;
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, bool fitcur = true);
209 /// Get next inset of this class from current cursor position
210 Inset * getInsetByCode(Inset::Code code);
212 void MenuInsertLyXFile(string const & filen);