3 * \file BufferView_pimpl.h
4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
10 #ifndef BUFFERVIEW_PIMPL_H
11 #define BUFFERVIEW_PIMPL_H
13 #include "BufferView.h"
14 #include "commandtags.h"
15 #include "frontends/Timeout.h"
16 #include "frontends/key_state.h"
17 #include "frontends/mouse_state.h"
18 #include "frontends/LyXKeySym.h"
20 #include "insets/insetspecialchar.h"
21 #include "support/types.h"
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/signals/trackable.hpp>
35 struct BufferView::Pimpl : public boost::signals::trackable {
37 Pimpl(BufferView * i, LyXView * o,
38 int xpos, int ypos, int width, int height);
40 Painter & painter() const;
41 /// return the work area for this bview
42 WorkArea & workarea() const;
43 /// return the screen for this bview
44 LyXScreen & screen() const;
46 void buffer(Buffer *);
48 void resize(int xpos, int ypos, int width, int height);
53 /// Return true if the cursor was fitted.
56 void redoCurrentBuffer();
58 int resizeCurrentBuffer();
62 void update(LyXText *, BufferView::UpdateCodes);
63 /// Update pixmap of screen
66 void workAreaExpose();
68 void updateScrollbar();
70 void scrollDocView(int value);
72 * Returns an inset if inset was hit, or 0 if not.
74 * If hit, the coordinates are changed relative to the inset.
76 Inset * checkInsetHit(LyXText *, int & x, int & y);
77 /// wheel mouse scroll
78 int scroll(long time);
80 void workAreaKeyPress(LyXKeySymPtr key,
81 key_modifier::state state);
83 void workAreaMotionNotify(int x, int y, mouse_button::state state);
85 void workAreaButtonPress(int x, int y, mouse_button::state button);
87 void workAreaButtonRelease(int x, int y, mouse_button::state button);
89 void doubleClick(int x, int y, mouse_button::state button);
91 void tripleClick(int x, int y, mouse_button::state button);
93 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);
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 specialChar(InsetSpecialChar::Kind);
161 void insertAndEditInset(Inset *);
163 void gotoInset(std::vector<Inset::Code> const & codes,
166 void gotoInset(Inset::Code codes, bool same_content);
174 boost::scoped_ptr<LyXScreen> screen_;
176 boost::scoped_ptr<WorkArea> workarea_;
178 Timeout cursor_timeout;
180 void pasteClipboard(bool asPara);
182 void stuffClipboard(string const &) const;
184 bool using_xterm_cursor;
189 /// Cursor paragraph Id
192 lyx::pos_type par_pos;
194 Position() : par_id(0), par_pos(0) {}
196 Position(string const & f, int id, lyx::pos_type pos)
197 : filename(f), par_id(id), par_pos(pos) {}
200 std::vector<Position> saved_positions;
202 void moveCursorUpdate(bool selecting, bool fitcur = true);
203 /// Get next inset of this class from current cursor position
204 Inset * getInsetByCode(Inset::Code code);
206 void MenuInsertLyXFile(string const & filen);
208 #endif // BUFFERVIEW_PIMPL_H