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 void resizeCurrentBuffer();
50 * Repaint pixmap. Used for when we've made a visible
51 * change but don't need the full update() logic
54 bool newFile(string const &, string const &, bool);
56 bool loadLyXFile(string const &, bool);
58 void workAreaResize();
60 void updateScrollbar();
62 void scrollDocView(int value);
64 * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
66 void scroll(int lines);
68 void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
70 void selectionRequested();
76 bool available() const;
77 /// get the change at the cursor position
78 Change const getCurrentChange();
80 void beforeChange(LyXText *);
82 void savePosition(unsigned int i);
84 void restorePosition(unsigned int i);
86 bool isSavedPosition(unsigned int i);
94 bool insertInset(InsetOld * inset, string const & lout = string());
97 /// a function should be executed from the workarea
98 bool workAreaDispatch(FuncRequest const & ev);
99 /// a function should be executed
100 bool dispatch(FuncRequest const & ev);
102 /// An error list (replaces the error insets)
103 ErrorList errorlist_;
104 /// add an error to the list
105 void addError(ErrorItem const &);
106 /// buffer errors signal connection
107 boost::signals::connection errorConnection_;
108 /// buffer messages signal connection
109 boost::signals::connection messageConnection_;
110 /// buffer busy status signal connection
111 boost::signals::connection busyConnection_;
112 /// buffer title changed signal connection
113 boost::signals::connection titleConnection_;
114 /// buffer reset timers signal connection
115 boost::signals::connection timerConnection_;
116 /// buffer readonly status changed signal connection
117 boost::signals::connection readonlyConnection_;
118 /// buffer closing signal connection
119 boost::signals::connection closingConnection_;
120 /// connect to signals in the given buffer
121 void connectBuffer(Buffer & buf);
122 /// disconnect from signals in the given buffer
123 void disconnectBuffer();
124 /// track changes for the document
126 /// notify readonly status
127 void showReadonly(bool);
130 friend class BufferView;
139 boost::scoped_ptr<LyXScreen> screen_;
141 boost::scoped_ptr<WorkArea> workarea_;
143 Timeout cursor_timeout;
145 void stuffClipboard(string const &) const;
147 bool using_xterm_cursor;
152 /// Cursor paragraph Id
155 lyx::pos_type par_pos;
157 Position() : par_id(0), par_pos(0) {}
159 Position(string const & f, int id, lyx::pos_type pos)
160 : filename(f), par_id(id), par_pos(pos) {}
163 std::vector<Position> saved_positions;
164 /// Get next inset of this class from current cursor position
165 InsetOld * getInsetByCode(InsetOld::Code code);
167 void MenuInsertLyXFile(string const & filen);
169 WorkArea & workarea() const;
171 #endif // BUFFERVIEW_PIMPL_H