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 scrollCB(double 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);
80 int scrollUp(long time);
82 int scrollDown(long time);
84 void workAreaKeyPress(KeySym, key_modifier::state state);
86 void workAreaMotionNotify(int x, int y, mouse_button::state state);
88 void workAreaButtonPress(int x, int y, mouse_button::state button);
90 void workAreaButtonRelease(int x, int y, mouse_button::state button);
92 void doubleClick(int x, int y, mouse_button::state button);
94 void tripleClick(int x, int y, mouse_button::state button);
96 void selectionRequested();
102 void cursorPrevious(LyXText *);
104 void cursorNext(LyXText *);
106 bool available() const;
108 void beforeChange(LyXText *);
110 void savePosition(unsigned int i);
112 void restorePosition(unsigned int i);
114 bool isSavedPosition(unsigned int i);
128 void toggleSelection(bool = true);
134 bool insertInset(Inset * inset, string const & lout = string());
136 void updateInset(Inset * inset, bool mark_dirty);
138 bool Dispatch(kb_action action, string const & argument);
141 * Return the on-screen dimensions of the inset at the cursor.
142 * Pre-condition: the cursor must be at an inset.
144 Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
146 * check if the given co-ordinates are inside an inset at the given cursor,
147 * if one exists. If so, the inset is returned, and the co-ordinates are
148 * made relative. Otherwise, 0 is returned.
150 Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
152 friend class BufferView;
153 /// open and lock an updatable inset
154 bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
156 void specialChar(InsetSpecialChar::Kind);
164 void insertAndEditInset(Inset *);
166 void gotoInset(std::vector<Inset::Code> const & codes,
169 void gotoInset(Inset::Code codes, bool same_content);
177 boost::scoped_ptr<LScreen> screen_;
179 boost::scoped_ptr<WorkArea> workarea_;
181 long current_scrollbar_value;
183 Timeout cursor_timeout;
185 void pasteClipboard(bool asPara);
187 void stuffClipboard(string const &) const;
189 bool using_xterm_cursor;
194 /// Cursor paragraph Id
197 lyx::pos_type par_pos;
199 Position() : par_id(0), par_pos(0) {}
201 Position(string const & f, int id, lyx::pos_type pos)
202 : filename(f), par_id(id), par_pos(pos) {}
205 std::vector<Position> saved_positions;
207 void moveCursorUpdate(bool selecting, bool fitcur = true);
208 /// Get next inset of this class from current cursor position
209 Inset * getInsetByCode(Inset::Code code);
211 void MenuInsertLyXFile(string const & filen);