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 "BufferView.h"
23 #include "errorlist.h"
25 #include "frontends/LyXKeySym.h"
26 #include "frontends/Timeout.h"
28 #include "support/types.h"
30 #include <boost/signals/trackable.hpp>
37 class ViewMetricsInfo;
49 class BufferView::Pimpl : public boost::signals::trackable {
52 Pimpl(BufferView & bv, LyXView * owner, lyx::frontend::WorkArea * workArea);
54 lyx::frontend::Painter & painter() const;
56 void setBuffer(Buffer * buf);
58 void resizeCurrentBuffer();
64 void update(Update::flags flags = Update::Force);
66 void newFile(std::string const &, std::string const &, bool);
68 bool loadLyXFile(std::string const &, bool);
70 void workAreaResize(int width, int height);
72 void updateScrollbar();
74 ScrollbarParameters const & scrollbarParameters() const;
76 void scrollDocView(int value);
77 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
78 void scroll(int lines);
80 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
82 void selectionRequested();
88 bool available() const;
89 /// get the change at the cursor position
90 Change const getCurrentChange();
92 void savePosition(unsigned int i);
94 void restorePosition(unsigned int i);
96 bool isSavedPosition(unsigned int i);
97 /// save bookmarks to .lyx/session
98 void saveSavedPositions();
103 /// a function should be executed from the workarea
104 bool workAreaDispatch(FuncRequest const & ev);
105 /// return true for events that will handle
106 FuncStatus getStatus(FuncRequest const & cmd);
107 /// a function should be executed
108 bool dispatch(FuncRequest const & ev);
109 /// Flag: do a full redraw of inside text of inset
110 bool repaintAll() { return refresh_inside_; }
112 void repaintAll(bool r) {refresh_inside_ = r; }
115 lyx::frontend::Gui & gui() const;
117 /// Width and height of the BufferView in Pixels
119 This is set externally by the workAreaResize method.
122 /// Height of the BufferView in Pixels
124 This is set externally by the workAreaResize method.
134 ScrollbarParameters scrollbarParameters_;
136 /// An error list (replaces the error insets)
137 ErrorList errorlist_;
138 /// add an error to the list
139 void addError(ErrorItem const &);
140 /// buffer errors signal connection
141 boost::signals::connection errorConnection_;
142 /// buffer messages signal connection
143 boost::signals::connection messageConnection_;
144 /// buffer busy status signal connection
145 boost::signals::connection busyConnection_;
146 /// buffer title changed signal connection
147 boost::signals::connection titleConnection_;
148 /// buffer reset timers signal connection
149 boost::signals::connection timerConnection_;
150 /// buffer readonly status changed signal connection
151 boost::signals::connection readonlyConnection_;
152 /// buffer closing signal connection
153 boost::signals::connection closingConnection_;
154 /// connect to signals in the given buffer
155 void connectBuffer(Buffer & buf);
156 /// disconnect from signals in the given buffer
157 void disconnectBuffer();
158 /// track changes for the document
160 /// notify readonly status
161 void showReadonly(bool);
165 friend class BufferView;
174 /// Estimated average par height for scrollbar
177 Timeout cursor_timeout;
179 void stuffClipboard(std::string const &) const;
181 bool using_xterm_cursor;
186 std::string filename;
187 /// Cursor paragraph Id
190 lyx::pos_type par_pos;
192 Position() : par_id(0), par_pos(0) {}
194 Position(std::string const & f, int id, lyx::pos_type pos)
195 : filename(f), par_id(id), par_pos(pos) {}
198 std::vector<Position> saved_positions;
200 void menuInsertLyXFile(std::string const & filen);
202 lyx::frontend::WorkArea * workArea_;
204 /// this is used to handle XSelection events in the right manner
213 bool multiparsel_cache_;
215 lyx::pit_type anchor_ref_;
219 ViewMetricsInfo metrics(bool singlepar = false);
220 /// Working variable indicating a full screen refresh
221 mutable bool refresh_inside_;
224 #endif // BUFFERVIEW_PIMPL_H