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 "frontends/Timeout.h"
15 #include "frontends/key_state.h"
16 #include "frontends/mouse_state.h"
17 #include "frontends/LyXKeySym.h"
19 #include "insets/insetspecialchar.h"
20 #include "support/types.h"
22 #include <boost/scoped_ptr.hpp>
23 #include <boost/signals/trackable.hpp>
34 struct BufferView::Pimpl : public boost::signals::trackable {
36 Pimpl(BufferView * i, LyXView * o,
37 int xpos, int ypos, int width, int height);
39 Painter & painter() const;
40 /// return the work area for this bview
41 WorkArea & workarea() const;
42 /// return the screen for this bview
43 LyXScreen & screen() const;
45 void buffer(Buffer *);
46 /// Return true if the cursor was fitted.
49 void redoCurrentBuffer();
51 int resizeCurrentBuffer();
55 void update(LyXText *, BufferView::UpdateCodes);
57 * Repaint pixmap. Used for when we've made a visible
58 * change but don't need the full update() logic
62 void workAreaResize();
64 void updateScrollbar();
66 void scrollDocView(int value);
68 * Returns an inset if inset was hit, or 0 if not.
70 * If hit, the coordinates are changed relative to the inset.
72 Inset * checkInsetHit(LyXText *, int & x, int & y);
73 /// wheel mouse scroll
74 int scroll(long time);
76 void workAreaKeyPress(LyXKeySymPtr key,
77 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();
95 void cursorPrevious(LyXText *);
97 void cursorNext(LyXText *);
99 bool available() const;
101 void beforeChange(LyXText *);
103 void finishChange(bool fitcur);
105 void savePosition(unsigned int i);
107 void restorePosition(unsigned int i);
109 bool isSavedPosition(unsigned int i);
119 void toggleSelection(bool = true);
125 bool insertInset(Inset * inset, string const & lout = string());
127 void updateInset(Inset * inset, bool mark_dirty);
129 bool dispatch(FuncRequest const & ev);
132 * Return the on-screen dimensions of the inset at the cursor.
133 * Pre-condition: the cursor must be at an inset.
135 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
137 * check if the given co-ordinates are inside an inset at the
138 * given cursor, if one exists. If so, the inset is returned,
139 * and the co-ordinates are made relative. Otherwise, 0 is returned.
141 Inset * checkInset(LyXText const & text, LyXCursor const & cursor,
142 int & x, int & y) const;
144 friend class BufferView;
145 /// open and lock an updatable inset
146 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
152 void insertAndEditInset(Inset *);
154 void gotoInset(std::vector<Inset::Code> const & codes,
157 void gotoInset(Inset::Code codes, bool same_content);
165 boost::scoped_ptr<LyXScreen> screen_;
167 boost::scoped_ptr<WorkArea> workarea_;
169 Timeout cursor_timeout;
171 void stuffClipboard(string const &) const;
173 bool using_xterm_cursor;
178 /// Cursor paragraph Id
181 lyx::pos_type par_pos;
183 Position() : par_id(0), par_pos(0) {}
185 Position(string const & f, int id, lyx::pos_type pos)
186 : filename(f), par_id(id), par_pos(pos) {}
189 std::vector<Position> saved_positions;
191 void moveCursorUpdate(bool selecting, bool fitcur = true);
192 /// Get next inset of this class from current cursor position
193 Inset * getInsetByCode(Inset::Code code);
195 void MenuInsertLyXFile(string const & filen);
197 #endif // BUFFERVIEW_PIMPL_H