3 * \file BufferView_pimpl.h
4 * Copyright 2002 the LyX Team
5 * Read the file COPYING
10 #ifndef BUFFERVIEW_PIMPL_H
11 #define BUFFERVIEW_PIMPL_H
13 #include "errorlist.h"
14 #include "BufferView.h"
15 #include "frontends/Timeout.h"
16 #include "frontends/key_state.h"
17 #include "frontends/LyXKeySym.h"
18 #include "support/types.h"
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/signals/trackable.hpp>
31 struct BufferView::Pimpl : public boost::signals::trackable {
33 Pimpl(BufferView * i, LyXView * o,
34 int xpos, int ypos, int width, int height);
36 Painter & painter() const;
37 /// return the screen for this bview
38 LyXScreen & screen() const;
40 void buffer(Buffer *);
41 /// Return true if the cursor was fitted.
44 void redoCurrentBuffer();
46 int resizeCurrentBuffer();
50 void update(LyXText *, BufferView::UpdateCodes);
51 /// update the toplevel lyx text
52 void update(BufferView::UpdateCodes);
54 * Repaint pixmap. Used for when we've made a visible
55 * change but don't need the full update() logic
58 bool newFile(string const &, string const &, bool);
60 bool loadLyXFile(string const &, bool);
64 void workAreaResize();
66 void updateScrollbar();
68 void scrollDocView(int value);
70 * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
72 void scroll(int lines);
74 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
76 void selectionRequested();
82 bool available() const;
83 /// get the change at the cursor position
84 Change const getCurrentChange();
86 void beforeChange(LyXText *);
88 void savePosition(unsigned int i);
90 void restorePosition(unsigned int i);
92 bool isSavedPosition(unsigned int i);
98 void toggleSelection(bool = true);
104 bool insertInset(Inset * inset, string const & lout = string());
106 void updateInset(Inset * inset);
107 /// a function should be executed from the workarea
108 bool workAreaDispatch(FuncRequest const & ev);
109 /// a function should be executed
110 bool dispatch(FuncRequest const & ev);
112 /// An error list (replaces the error insets)
113 ErrorList errorlist_;
114 /// add an error to the list
115 void addError(ErrorItem const &);
116 /// buffer errors signal connection
117 boost::signals::connection errorConnection_;
118 /// buffer messages signal connection
119 boost::signals::connection messageConnection_;
120 /// buffer busy status signal connection
121 boost::signals::connection busyConnection_;
122 /// buffer title changed signal connection
123 boost::signals::connection titleConnection_;
124 /// buffer reset timers signal connection
125 boost::signals::connection timerConnection_;
126 /// buffer readonly status changed signal connection
127 boost::signals::connection readonlyConnection_;
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 Inset * getInsetByCode(Inset::Code code);
175 void MenuInsertLyXFile(string const & filen);
177 WorkArea & workarea() const;
179 #endif // BUFFERVIEW_PIMPL_H