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"
19 #include "insets/insetspecialchar.h"
20 #include "support/types.h"
22 #include <boost/scoped_ptr.hpp>
23 #include <boost/signals/trackable.hpp>
37 struct BufferView::Pimpl : public boost::signals::trackable {
39 Pimpl(BufferView * i, LyXView * o,
40 int xpos, int ypos, int width, int height);
42 Painter & painter() const;
43 /// return the work area for this bview
44 WorkArea & workarea() const;
45 /// return the screen for this bview
46 LScreen & screen() const;
48 void buffer(Buffer *);
50 void resize(int xpos, int ypos, int width, int height);
55 /// Return true if the cursor was fitted.
58 void redoCurrentBuffer();
60 int resizeCurrentBuffer();
64 void update(LyXText *, BufferView::UpdateCodes);
65 /// Update pixmap of screen
68 void workAreaExpose();
70 void updateScrollbar();
72 void scrollDocView(int value);
74 * Returns an inset if inset was hit, or 0 if not.
76 * If hit, the coordinates are changed relative to the inset.
78 Inset * checkInsetHit(LyXText *, int & x, int & y);
79 /// wheel mouse scroll
80 int scroll(long time);
82 void workAreaKeyPress(KeySym key, key_modifier::state state);
84 void workAreaMotionNotify(int x, int y, mouse_button::state state);
86 void workAreaButtonPress(int x, int y, mouse_button::state button);
88 void workAreaButtonRelease(int x, int y, mouse_button::state button);
90 void doubleClick(int x, int y, mouse_button::state button);
92 void tripleClick(int x, int y, mouse_button::state button);
94 void selectionRequested();
100 void cursorPrevious(LyXText *);
102 void cursorNext(LyXText *);
104 bool available() const;
106 void beforeChange(LyXText *);
108 void savePosition(unsigned int i);
110 void restorePosition(unsigned int i);
112 bool isSavedPosition(unsigned int i);
126 void toggleSelection(bool = true);
132 bool insertInset(Inset * inset, string const & lout = string());
134 void updateInset(Inset * inset, bool mark_dirty);
136 bool Dispatch(kb_action action, string const & argument);
139 * Return the on-screen dimensions of the inset at the cursor.
140 * Pre-condition: the cursor must be at an inset.
142 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
144 * check if the given co-ordinates are inside an inset at the given cursor,
145 * if one exists. If so, the inset is returned, and the co-ordinates are
146 * made relative. Otherwise, 0 is returned.
148 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
150 friend class BufferView;
151 /// open and lock an updatable inset
152 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
154 void specialChar(InsetSpecialChar::Kind);
162 void insertAndEditInset(Inset *);
164 void gotoInset(std::vector<Inset::Code> const & codes,
167 void gotoInset(Inset::Code codes, bool same_content);
175 boost::scoped_ptr<LScreen> screen_;
177 boost::scoped_ptr<WorkArea> workarea_;
179 Timeout cursor_timeout;
181 void pasteClipboard(bool asPara);
183 void stuffClipboard(string const &) const;
185 bool using_xterm_cursor;
190 /// Cursor paragraph Id
193 lyx::pos_type par_pos;
195 Position() : par_id(0), par_pos(0) {}
197 Position(string const & f, int id, lyx::pos_type pos)
198 : filename(f), par_id(id), par_pos(pos) {}
201 std::vector<Position> saved_positions;
203 void moveCursorUpdate(bool selecting, bool fitcur = true);
204 /// Get next inset of this class from current cursor position
205 Inset * getInsetByCode(Inset::Code code);
207 void MenuInsertLyXFile(string const & filen);
209 #endif // BUFFERVIEW_PIMPL_H