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"
24 #include "metricsinfo.h"
26 #include "frontends/LyXKeySym.h"
27 #include "frontends/Timeout.h"
29 #include "support/types.h"
31 #include <boost/signals/trackable.hpp>
38 class ViewMetricsInfo;
48 class BufferView::Pimpl : public boost::signals::trackable {
51 Pimpl(BufferView & bv, LyXView * owner);
53 void setBuffer(Buffer * buf);
55 void resizeCurrentBuffer();
61 void update(Update::flags flags = Update::Force);
63 void newFile(std::string const &, std::string const &, bool);
65 bool loadLyXFile(std::string const &, bool);
67 void workAreaResize(int width, int height);
69 void updateScrollbar();
71 ScrollbarParameters const & scrollbarParameters() const;
73 void scrollDocView(int value);
74 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
75 void scroll(int lines);
77 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
79 void selectionRequested();
85 bool available() const;
86 /// get the change at the cursor position
87 Change const getCurrentChange();
89 void savePosition(unsigned int i);
91 void restorePosition(unsigned int i);
93 bool isSavedPosition(unsigned int i);
94 /// save bookmarks to .lyx/session
95 void saveSavedPositions();
100 /// a function should be executed from the workarea
101 bool workAreaDispatch(FuncRequest const & ev);
102 /// return true for events that will handle
103 FuncStatus getStatus(FuncRequest const & cmd);
104 /// a function should be executed
105 bool dispatch(FuncRequest const & ev);
108 lyx::frontend::Gui & gui() const;
110 /// Width and height of the BufferView in Pixels
112 This is set externally by the workAreaResize method.
115 /// Height of the BufferView in Pixels
117 This is set externally by the workAreaResize method.
122 ViewMetricsInfo const & viewMetricsInfo();
124 bool needsRedraw() const
126 return needs_redraw_;
128 void needsRedraw(bool redraw_needed)
130 needs_redraw_ = redraw_needed;
138 ScrollbarParameters scrollbarParameters_;
142 /// An error list (replaces the error insets)
143 ErrorList errorlist_;
144 /// add an error to the list
145 void addError(ErrorItem const &);
146 /// buffer errors signal connection
147 boost::signals::connection errorConnection_;
148 /// buffer messages signal connection
149 boost::signals::connection messageConnection_;
150 /// buffer busy status signal connection
151 boost::signals::connection busyConnection_;
152 /// buffer title changed signal connection
153 boost::signals::connection titleConnection_;
154 /// buffer reset timers signal connection
155 boost::signals::connection timerConnection_;
156 /// buffer readonly status changed signal connection
157 boost::signals::connection readonlyConnection_;
158 /// buffer closing signal connection
159 boost::signals::connection closingConnection_;
160 /// connect to signals in the given buffer
161 void connectBuffer(Buffer & buf);
162 /// disconnect from signals in the given buffer
163 void disconnectBuffer();
164 /// track changes for the document
166 /// notify readonly status
167 void showReadonly(bool);
171 friend class BufferView;
174 ViewMetricsInfo metrics_info_;
176 void updateMetrics(bool singlepar = false);
185 /// Estimated average par height for scrollbar
188 Timeout cursor_timeout;
190 bool using_xterm_cursor;
195 std::string filename;
196 /// Cursor paragraph Id
199 lyx::pos_type par_pos;
201 Position() : par_id(0), par_pos(0) {}
203 Position(std::string const & f, int id, lyx::pos_type pos)
204 : filename(f), par_id(id), par_pos(pos) {}
207 std::vector<Position> saved_positions;
209 void menuInsertLyXFile(std::string const & filen);
211 /// this is used to handle XSelection events in the right manner
220 bool multiparsel_cache_;
222 lyx::pit_type anchor_ref_;
226 #endif // BUFFERVIEW_PIMPL_H