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();
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;
163 ViewMetricsInfo metrics_info_;
165 void updateMetrics(bool singlepar = false);
174 /// Estimated average par height for scrollbar
177 Timeout cursor_timeout;
179 bool using_xterm_cursor;
184 std::string filename;
185 /// Cursor paragraph Id
188 lyx::pos_type par_pos;
190 Position() : par_id(0), par_pos(0) {}
192 Position(std::string const & f, int id, lyx::pos_type pos)
193 : filename(f), par_id(id), par_pos(pos) {}
196 std::vector<Position> saved_positions;
198 void menuInsertLyXFile(std::string const & filen);
200 /// this is used to handle XSelection events in the right manner
209 bool multiparsel_cache_;
211 lyx::pit_type anchor_ref_;
215 #endif // BUFFERVIEW_PIMPL_H