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;
48 class BufferView::Pimpl : public boost::signals::trackable {
51 Pimpl(BufferView & bv, LyXView * owner);
53 lyx::frontend::Painter & painter() const;
55 void setBuffer(Buffer * buf);
57 void resizeCurrentBuffer();
63 void update(Update::flags flags = Update::Force);
65 void newFile(std::string const &, std::string const &, bool);
67 bool loadLyXFile(std::string const &, bool);
69 void workAreaResize(int width, int height);
71 void updateScrollbar();
73 ScrollbarParameters const & scrollbarParameters() const;
75 void scrollDocView(int value);
76 /// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
77 void scroll(int lines);
79 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
81 void selectionRequested();
87 bool available() const;
88 /// get the change at the cursor position
89 Change const getCurrentChange();
91 void savePosition(unsigned int i);
93 void restorePosition(unsigned int i);
95 bool isSavedPosition(unsigned int i);
96 /// save bookmarks to .lyx/session
97 void saveSavedPositions();
102 /// a function should be executed from the workarea
103 bool workAreaDispatch(FuncRequest const & ev);
104 /// return true for events that will handle
105 FuncStatus getStatus(FuncRequest const & cmd);
106 /// a function should be executed
107 bool dispatch(FuncRequest const & ev);
110 lyx::frontend::Gui & gui() const;
112 /// Width and height of the BufferView in Pixels
114 This is set externally by the workAreaResize method.
117 /// Height of the BufferView in Pixels
119 This is set externally by the workAreaResize method.
129 ScrollbarParameters scrollbarParameters_;
131 /// An error list (replaces the error insets)
132 ErrorList errorlist_;
133 /// add an error to the list
134 void addError(ErrorItem const &);
135 /// buffer errors signal connection
136 boost::signals::connection errorConnection_;
137 /// buffer messages signal connection
138 boost::signals::connection messageConnection_;
139 /// buffer busy status signal connection
140 boost::signals::connection busyConnection_;
141 /// buffer title changed signal connection
142 boost::signals::connection titleConnection_;
143 /// buffer reset timers signal connection
144 boost::signals::connection timerConnection_;
145 /// buffer readonly status changed signal connection
146 boost::signals::connection readonlyConnection_;
147 /// buffer closing signal connection
148 boost::signals::connection closingConnection_;
149 /// connect to signals in the given buffer
150 void connectBuffer(Buffer & buf);
151 /// disconnect from signals in the given buffer
152 void disconnectBuffer();
153 /// track changes for the document
155 /// notify readonly status
156 void showReadonly(bool);
160 friend class BufferView;
169 /// Estimated average par height for scrollbar
172 Timeout cursor_timeout;
174 bool using_xterm_cursor;
179 std::string filename;
180 /// Cursor paragraph Id
183 lyx::pos_type par_pos;
185 Position() : par_id(0), par_pos(0) {}
187 Position(std::string const & f, int id, lyx::pos_type pos)
188 : filename(f), par_id(id), par_pos(pos) {}
191 std::vector<Position> saved_positions;
193 void menuInsertLyXFile(std::string const & filen);
195 /// this is used to handle XSelection events in the right manner
204 bool multiparsel_cache_;
206 lyx::pit_type anchor_ref_;
210 ViewMetricsInfo metrics(bool singlepar = false);
212 #endif // BUFFERVIEW_PIMPL_H