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 "insets/inset.h"
27 #include "frontends/key_state.h"
28 #include "frontends/Timeout.h"
30 #include "support/types.h"
32 #include <boost/scoped_ptr.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/signals/trackable.hpp>
45 struct BufferView::Pimpl : public boost::signals::trackable {
47 Pimpl(BufferView * bv, LyXView * owner,
48 int xpos, int ypos, int width, int height);
50 Painter & painter() const;
51 /// return the screen for this bview
52 LyXScreen & screen() const;
54 void buffer(Buffer *);
55 /// Return true if the cursor was fitted.
58 void redoCurrentBuffer();
60 void resizeCurrentBuffer();
64 * Repaint pixmap. Used for when we've made a visible
65 * change but don't need the full update() logic
68 bool newFile(std::string const &, std::string const &, bool);
70 bool loadLyXFile(std::string const &, bool);
72 void workAreaResize();
74 void updateScrollbar();
76 void scrollDocView(int value);
78 * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
80 void scroll(int lines);
82 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
84 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
86 void selectionRequested();
92 bool available() const;
93 /// get the change at the cursor position
94 Change const getCurrentChange();
96 void savePosition(unsigned int i);
98 void restorePosition(unsigned int i);
100 bool isSavedPosition(unsigned int i);
106 bool insertInset(InsetOld * inset, std::string const & lout = std::string());
108 void updateInset(InsetOld const * inset);
109 /// a function should be executed from the workarea
110 bool workAreaDispatch(FuncRequest const & ev);
111 /// a function should be executed
112 bool dispatch(FuncRequest const & ev);
117 /// update paragraph dialogs
118 void updateParagraphDialog();
120 /// the y coordinate of the top of the screen
122 /// An error list (replaces the error insets)
123 ErrorList errorlist_;
124 /// add an error to the list
125 void addError(ErrorItem const &);
126 /// buffer errors signal connection
127 boost::signals::connection errorConnection_;
128 /// buffer messages signal connection
129 boost::signals::connection messageConnection_;
130 /// buffer busy status signal connection
131 boost::signals::connection busyConnection_;
132 /// buffer title changed signal connection
133 boost::signals::connection titleConnection_;
134 /// buffer reset timers signal connection
135 boost::signals::connection timerConnection_;
136 /// buffer readonly status changed signal connection
137 boost::signals::connection readonlyConnection_;
138 /// buffer closing signal connection
139 boost::signals::connection closingConnection_;
140 /// connect to signals in the given buffer
141 void connectBuffer(Buffer & buf);
142 /// disconnect from signals in the given buffer
143 void disconnectBuffer();
144 /// track changes for the document
146 /// notify readonly status
147 void showReadonly(bool);
150 * Change all insets with the given code's contents to a new
151 * string. May only be used with InsetCommand-derived insets
152 * Returns true if a screen update is needed.
154 bool ChangeInsets(InsetOld::Code code, std::string const & from,
155 std::string const & to);
158 friend class BufferView;
167 boost::scoped_ptr<LyXScreen> screen_;
169 boost::scoped_ptr<WorkArea> workarea_;
171 Timeout cursor_timeout;
173 void stuffClipboard(std::string const &) const;
175 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;
192 /// Get next inset of this class from current cursor position
193 InsetOld * getInsetByCode(InsetOld::Code code);
195 void MenuInsertLyXFile(std::string const & filen);
197 WorkArea & workarea() const;
201 #endif // BUFFERVIEW_PIMPL_H