]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
Add In nsetOld * argument to updateInset to rebreak the correct par.
[lyx.git] / src / BufferView_pimpl.h
1 // -*- C++ -*-
2 /**
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.
6  *
7  * \author Asger Alstrup
8  * \author Alfredo Braustein
9  * \author Lars Gullik Bjønnes
10  * \author John Levon
11  * \author André Pönitz
12  * \author Dekel Tsur
13  * \author Jürgen Vigna
14  *
15  * Full author contact details are available in file CREDITS.
16  */
17
18 #ifndef BUFFERVIEW_PIMPL_H
19 #define BUFFERVIEW_PIMPL_H
20
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"
27
28 #include <boost/scoped_ptr.hpp>
29 #include <boost/signals/trackable.hpp>
30
31
32 class Change;
33 class LyXView;
34 class WorkArea;
35 class LyXScreen;
36 class FuncRequest;
37
38 ///
39 struct BufferView::Pimpl : public boost::signals::trackable {
40         ///
41         Pimpl(BufferView * i, LyXView * o,
42               int xpos, int ypos, int width, int height);
43         ///
44         Painter & painter() const;
45         /// return the screen for this bview
46         LyXScreen & screen() const;
47         ///
48         void buffer(Buffer *);
49         /// Return true if the cursor was fitted.
50         bool fitCursor();
51         ///
52         void redoCurrentBuffer();
53         ///
54         void resizeCurrentBuffer();
55         ///
56         void update();
57         /**
58          * Repaint pixmap. Used for when we've made a visible
59          * change but don't need the full update() logic
60          */
61         ///
62         bool newFile(string const &, string const &, bool);
63         ///
64         bool loadLyXFile(string const &, bool);
65         ///
66         void workAreaResize();
67         ///
68         void updateScrollbar();
69         ///
70         void scrollDocView(int value);
71         /**
72          * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
73          */
74         void scroll(int lines);
75         ///
76         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
77         ///
78         void selectionRequested();
79         ///
80         void selectionLost();
81         ///
82         void cursorToggle();
83         ///
84         bool available() const;
85         /// get the change at the cursor position
86         Change const getCurrentChange();
87         ///
88         void beforeChange(LyXText *);
89         ///
90         void savePosition(unsigned int i);
91         ///
92         void restorePosition(unsigned int i);
93         ///
94         bool isSavedPosition(unsigned int i);
95         ///
96         void switchKeyMap();
97         ///
98         void insetUnlock();
99         ///
100         void center();
101         ///
102         bool insertInset(InsetOld * inset, string const & lout = string());
103         ///
104         void updateInset(InsetOld const * inset);
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);
109 private:
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
133         void trackChanges();
134         /// notify readonly status
135         void showReadonly(bool);
136
137         ///
138         friend class BufferView;
139
140         ///
141         BufferView * bv_;
142         ///
143         LyXView * owner_;
144         ///
145         Buffer * buffer_;
146         ///
147         boost::scoped_ptr<LyXScreen> screen_;
148         ///
149         boost::scoped_ptr<WorkArea> workarea_;
150         ///
151         Timeout cursor_timeout;
152         ///
153         void stuffClipboard(string const &) const;
154         ///
155         bool using_xterm_cursor;
156         ///
157         struct Position {
158                 /// Filename
159                 string filename;
160                 /// Cursor paragraph Id
161                 int par_id;
162                 /// Cursor position
163                 lyx::pos_type par_pos;
164                 ///
165                 Position() : par_id(0), par_pos(0) {}
166                 ///
167                 Position(string const & f, int id, lyx::pos_type pos)
168                         : filename(f), par_id(id), par_pos(pos) {}
169         };
170         ///
171         std::vector<Position> saved_positions;
172         /// Get next inset of this class from current cursor position
173         InsetOld * getInsetByCode(InsetOld::Code code);
174         ///
175         void MenuInsertLyXFile(string const & filen);
176         /// our workarea
177         WorkArea & workarea() const;
178 };
179 #endif // BUFFERVIEW_PIMPL_H