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;
38 /// return the screen for this bview
39 LScreen & screen() const;
41 void buffer(Buffer *);
43 void resize(int xpos, int ypos, int width, int height);
48 /// Return true if the cursor was fitted.
51 void redoCurrentBuffer();
53 int resizeCurrentBuffer();
57 void update(LyXText *, BufferView::UpdateCodes);
58 /// Update pixmap of screen
61 void workAreaExpose();
63 void updateScrollbar();
65 void scrollCB(double value);
67 * Returns an inset if inset was hit, or 0 if not.
69 * If hit, the coordinates are changed relative to the inset.
71 Inset * checkInsetHit(LyXText *, int & x, int & y);
73 int scrollUp(long time);
75 int scrollDown(long time);
77 void workAreaKeyPress(KeySym, key_modifier::state state);
79 void workAreaMotionNotify(int x, int y, mouse_button::state state);
81 void workAreaButtonPress(int x, int y, mouse_button::state button);
83 void workAreaButtonRelease(int x, int y, mouse_button::state button);
85 void doubleClick(int x, int y, mouse_button::state button);
87 void tripleClick(int x, int y, mouse_button::state button);
89 void selectionRequested();
99 void cursorPrevious(LyXText *);
101 void cursorNext(LyXText *);
103 bool available() const;
105 void beforeChange(LyXText *);
107 void savePosition(unsigned int i);
109 void restorePosition(unsigned int i);
111 bool isSavedPosition(unsigned int i);
131 void toggleSelection(bool = true);
137 bool insertInset(Inset * inset, string const & lout = string());
139 void updateInset(Inset * inset, bool mark_dirty);
141 bool Dispatch(kb_action action, string const & argument);
144 * Return the on-screen dimensions of the inset at the cursor.
145 * Pre-condition: the cursor must be at an inset.
147 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
149 * check if the given co-ordinates are inside an inset at the given cursor,
150 * if one exists. If so, the inset is returned, and the co-ordinates are
151 * made relative. Otherwise, 0 is returned.
153 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
155 friend class BufferView;
156 /// open and lock an updatable inset
157 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
159 void specialChar(InsetSpecialChar::Kind);
167 void insertAndEditInset(Inset *);
169 void gotoInset(std::vector<Inset::Code> const & codes,
172 void gotoInset(Inset::Code codes, bool same_content);
180 boost::scoped_ptr<LScreen> screen_;
182 boost::scoped_ptr<WorkArea> workarea_;
184 long current_scrollbar_value;
186 Timeout cursor_timeout;
188 void pasteClipboard(bool asPara);
190 void stuffClipboard(string const &) const;
192 bool using_xterm_cursor;
197 /// Cursor paragraph Id
200 lyx::pos_type par_pos;
202 Position() : par_id(0), par_pos(0) {}
204 Position(string const & f, int id, lyx::pos_type pos)
205 : filename(f), par_id(id), par_pos(pos) {}
208 std::vector<Position> saved_positions;
210 void moveCursorUpdate(bool selecting, bool fitcur = true);
211 /// Get next inset of this class from current cursor position
212 Inset * getInsetByCode(Inset::Code code);
214 void MenuInsertLyXFile(string const & filen);