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 *);
47 /// Return true if the cursor was fitted.
50 void redoCurrentBuffer();
52 int resizeCurrentBuffer();
56 void update(LyXText *, BufferView::UpdateCodes);
58 * Repaint pixmap. Used for when we've made a visible
59 * change but don't need the full update() logic
63 void workAreaResize();
65 void updateScrollbar();
67 void scrollDocView(int value);
69 * Returns an inset if inset was hit, or 0 if not.
71 * If hit, the coordinates are changed relative to the inset.
73 Inset * checkInsetHit(LyXText *, int & x, int & y);
74 /// wheel mouse scroll
75 int scroll(long time);
77 void workAreaKeyPress(LyXKeySymPtr key,
78 key_modifier::state state);
80 void workAreaMotionNotify(int x, int y, mouse_button::state state);
82 void workAreaButtonPress(int x, int y, mouse_button::state button);
84 void workAreaButtonRelease(int x, int y, mouse_button::state button);
86 void doubleClick(int x, int y, mouse_button::state button);
88 void tripleClick(int x, int y, mouse_button::state button);
90 void selectionRequested();
96 void cursorPrevious(LyXText *);
98 void cursorNext(LyXText *);
100 bool available() const;
102 void beforeChange(LyXText *);
104 void savePosition(unsigned int i);
106 void restorePosition(unsigned int i);
108 bool isSavedPosition(unsigned int i);
118 void toggleSelection(bool = true);
124 bool insertInset(Inset * inset, string const & lout = string());
126 void updateInset(Inset * inset, bool mark_dirty);
128 bool dispatch(kb_action action, string const & argument);
131 * Return the on-screen dimensions of the inset at the cursor.
132 * Pre-condition: the cursor must be at an inset.
134 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
136 * check if the given co-ordinates are inside an inset at the
137 * given cursor, if one exists. If so, the inset is returned,
138 * and the co-ordinates are made relative. Otherwise, 0 is returned.
140 Inset * checkInset(LyXText const & text, LyXCursor const & cursor,
141 int & x, int & y) const;
143 friend class BufferView;
144 /// open and lock an updatable inset
145 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
147 void specialChar(InsetSpecialChar::Kind);
155 void insertAndEditInset(Inset *);
157 void gotoInset(std::vector<Inset::Code> const & codes,
160 void gotoInset(Inset::Code codes, bool same_content);
168 boost::scoped_ptr<LyXScreen> screen_;
170 boost::scoped_ptr<WorkArea> workarea_;
172 Timeout cursor_timeout;
174 void pasteClipboard(bool asPara);
176 void stuffClipboard(string const &) const;
178 bool using_xterm_cursor;
183 /// Cursor paragraph Id
186 lyx::pos_type par_pos;
188 Position() : par_id(0), par_pos(0) {}
190 Position(string const & f, int id, lyx::pos_type pos)
191 : filename(f), par_id(id), par_pos(pos) {}
194 std::vector<Position> saved_positions;
196 void moveCursorUpdate(bool selecting, bool fitcur = true);
197 /// Get next inset of this class from current cursor position
198 Inset * getInsetByCode(Inset::Code code);
200 void MenuInsertLyXFile(string const & filen);
202 #endif // BUFFERVIEW_PIMPL_H