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());
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);
110 /// An error list (replaces the error insets)
111 ErrorList errorlist_;
112 /// add an error to the list
113 void addError(ErrorItem const &);
114 /// buffer errors signal connection
115 boost::signals::connection errorConnection_;
116 /// buffer messages signal connection
117 boost::signals::connection messageConnection_;
118 /// buffer busy status signal connection
119 boost::signals::connection busyConnection_;
120 /// buffer title changed signal connection
121 boost::signals::connection titleConnection_;
122 /// buffer reset timers signal connection
123 boost::signals::connection timerConnection_;
124 /// buffer readonly status changed signal connection
125 boost::signals::connection readonlyConnection_;
126 /// buffer closing signal connection
127 boost::signals::connection closingConnection_;
128 /// connect to signals in the given buffer
129 void connectBuffer(Buffer & buf);
130 /// disconnect from signals in the given buffer
131 void disconnectBuffer();
132 /// track changes for the document
134 /// notify readonly status
135 void showReadonly(bool);
138 friend class BufferView;
147 boost::scoped_ptr<LyXScreen> screen_;
149 boost::scoped_ptr<WorkArea> workarea_;
151 Timeout cursor_timeout;
153 void stuffClipboard(string const &) const;
155 bool using_xterm_cursor;
160 /// Cursor paragraph Id
163 lyx::pos_type par_pos;
165 Position() : par_id(0), par_pos(0) {}
167 Position(string const & f, int id, lyx::pos_type pos)
168 : filename(f), par_id(id), par_pos(pos) {}
171 std::vector<Position> saved_positions;
172 /// Get next inset of this class from current cursor position
173 InsetOld * getInsetByCode(InsetOld::Code code);
175 void MenuInsertLyXFile(string const & filen);
177 WorkArea & workarea() const;
179 #endif // BUFFERVIEW_PIMPL_H