3 * \file BufferView_pimpl.h
4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
8 * \author Alfredo Braustein
9 * \author Lars Gullik Bjønnes
11 * \author André Pönitz
13 * \author Jürgen Vigna
15 * Full author contact details are available in file CREDITS.
18 #ifndef BUFFERVIEW_PIMPL_H
19 #define BUFFERVIEW_PIMPL_H
21 #include "errorlist.h"
22 #include "BufferView.h"
23 #include "frontends/Timeout.h"
24 #include "frontends/key_state.h"
25 #include "frontends/LyXKeySym.h"
26 #include "support/types.h"
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/signals/trackable.hpp>
39 struct BufferView::Pimpl : public boost::signals::trackable {
41 Pimpl(BufferView * i, LyXView * o,
42 int xpos, int ypos, int width, int height);
44 Painter & painter() const;
45 /// return the screen for this bview
46 LyXScreen & screen() const;
48 void buffer(Buffer *);
49 /// Return true if the cursor was fitted.
52 void redoCurrentBuffer();
54 void resizeCurrentBuffer();
58 * Repaint pixmap. Used for when we've made a visible
59 * change but don't need the full update() logic
62 bool newFile(string const &, string const &, bool);
64 bool loadLyXFile(string const &, bool);
66 void workAreaResize();
68 void updateScrollbar();
70 void scrollDocView(int value);
72 * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
74 void scroll(int lines);
76 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
78 void selectionRequested();
84 bool available() const;
85 /// get the change at the cursor position
86 Change const getCurrentChange();
88 void beforeChange(LyXText *);
90 void savePosition(unsigned int i);
92 void restorePosition(unsigned int i);
94 bool isSavedPosition(unsigned int i);
102 bool insertInset(InsetOld * inset, string const & lout = string());
104 void updateInset(InsetOld const * inset);
105 /// a function should be executed from the workarea
106 bool workAreaDispatch(FuncRequest const & ev);
107 /// a function should be executed
108 bool dispatch(FuncRequest const & ev);
114 /// the y coordinate of the top of the screen
116 /// An error list (replaces the error insets)
117 ErrorList errorlist_;
118 /// add an error to the list
119 void addError(ErrorItem const &);
120 /// buffer errors signal connection
121 boost::signals::connection errorConnection_;
122 /// buffer messages signal connection
123 boost::signals::connection messageConnection_;
124 /// buffer busy status signal connection
125 boost::signals::connection busyConnection_;
126 /// buffer title changed signal connection
127 boost::signals::connection titleConnection_;
128 /// buffer reset timers signal connection
129 boost::signals::connection timerConnection_;
130 /// buffer readonly status changed signal connection
131 boost::signals::connection readonlyConnection_;
132 /// buffer closing signal connection
133 boost::signals::connection closingConnection_;
134 /// connect to signals in the given buffer
135 void connectBuffer(Buffer & buf);
136 /// disconnect from signals in the given buffer
137 void disconnectBuffer();
138 /// track changes for the document
140 /// notify readonly status
141 void showReadonly(bool);
144 friend class BufferView;
153 boost::scoped_ptr<LyXScreen> screen_;
155 boost::scoped_ptr<WorkArea> workarea_;
157 Timeout cursor_timeout;
159 void stuffClipboard(string const &) const;
161 bool using_xterm_cursor;
166 /// Cursor paragraph Id
169 lyx::pos_type par_pos;
171 Position() : par_id(0), par_pos(0) {}
173 Position(string const & f, int id, lyx::pos_type pos)
174 : filename(f), par_id(id), par_pos(pos) {}
177 std::vector<Position> saved_positions;
178 /// Get next inset of this class from current cursor position
179 InsetOld * getInsetByCode(InsetOld::Code code);
181 void MenuInsertLyXFile(string const & filen);
183 WorkArea & workarea() const;
185 #endif // BUFFERVIEW_PIMPL_H