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"
22 #include "errorlist.h"
24 #include "insets/inset.h"
26 #include "frontends/key_state.h"
27 #include "frontends/Timeout.h"
29 #include "support/types.h"
31 #include <boost/scoped_ptr.hpp>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/signals/trackable.hpp>
44 struct BufferView::Pimpl : public boost::signals::trackable {
46 Pimpl(BufferView * i, LyXView * o,
47 int xpos, int ypos, int width, int height);
49 Painter & painter() const;
50 /// return the screen for this bview
51 LyXScreen & screen() const;
53 void buffer(Buffer *);
54 /// Return true if the cursor was fitted.
57 void redoCurrentBuffer();
59 void resizeCurrentBuffer();
63 * Repaint pixmap. Used for when we've made a visible
64 * change but don't need the full update() logic
67 bool newFile(std::string const &, std::string const &, bool);
69 bool loadLyXFile(std::string const &, bool);
71 void workAreaResize();
73 void updateScrollbar();
75 void scrollDocView(int value);
77 * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
79 void scroll(int lines);
81 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
83 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
85 void selectionRequested();
91 bool available() const;
92 /// get the change at the cursor position
93 Change const getCurrentChange();
95 void beforeChange(LyXText *);
97 void savePosition(unsigned int i);
99 void restorePosition(unsigned int i);
101 bool isSavedPosition(unsigned int i);
109 bool insertInset(InsetOld * inset, std::string const & lout = std::string());
111 void updateInset(InsetOld const * inset);
112 /// a function should be executed from the workarea
113 bool workAreaDispatch(FuncRequest const & ev);
114 /// a function should be executed
115 bool dispatch(FuncRequest const & ev);
121 /// the y coordinate of the top of the screen
123 /// An error list (replaces the error insets)
124 ErrorList errorlist_;
125 /// add an error to the list
126 void addError(ErrorItem const &);
127 /// buffer errors signal connection
128 boost::signals::connection errorConnection_;
129 /// buffer messages signal connection
130 boost::signals::connection messageConnection_;
131 /// buffer busy status signal connection
132 boost::signals::connection busyConnection_;
133 /// buffer title changed signal connection
134 boost::signals::connection titleConnection_;
135 /// buffer reset timers signal connection
136 boost::signals::connection timerConnection_;
137 /// buffer readonly status changed signal connection
138 boost::signals::connection readonlyConnection_;
139 /// buffer closing signal connection
140 boost::signals::connection closingConnection_;
141 /// connect to signals in the given buffer
142 void connectBuffer(Buffer & buf);
143 /// disconnect from signals in the given buffer
144 void disconnectBuffer();
145 /// track changes for the document
147 /// notify readonly status
148 void showReadonly(bool);
151 * Change all insets with the given code's contents to a new
152 * string. May only be used with InsetCommand-derived insets
153 * Returns true if a screen update is needed.
155 bool ChangeInsets(InsetOld::Code code, std::string const & from,
156 std::string const & to);
159 friend class BufferView;
168 boost::scoped_ptr<LyXScreen> screen_;
170 boost::scoped_ptr<WorkArea> workarea_;
172 Timeout cursor_timeout;
174 void stuffClipboard(std::string const &) const;
176 bool using_xterm_cursor;
180 std::string filename;
181 /// Cursor paragraph Id
184 lyx::pos_type par_pos;
186 Position() : par_id(0), par_pos(0) {}
188 Position(std::string const & f, int id, lyx::pos_type pos)
189 : filename(f), par_id(id), par_pos(pos) {}
192 std::vector<Position> saved_positions;
193 /// Get next inset of this class from current cursor position
194 InsetOld * getInsetByCode(InsetOld::Code code);
196 void MenuInsertLyXFile(std::string const & filen);
198 WorkArea & workarea() const;
200 #endif // BUFFERVIEW_PIMPL_H