]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
Point fix, earlier forgotten
[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         ///
110         int top_y() const;
111         ///
112         void top_y(int y);
113 private:
114         /// the y coordinate of the top of the screen
115         int top_y_;
116         /// An error list (replaces the error insets)
117         ErrorList errorlist_;
118         /// add an error to the list
119         void addError(ErrorItem const &);
120         /// buffer errors signal connection
121         boost::signals::connection errorConnection_;
122         /// buffer messages signal connection
123         boost::signals::connection messageConnection_;
124         /// buffer busy status signal connection
125         boost::signals::connection busyConnection_;
126         /// buffer title changed signal connection
127         boost::signals::connection titleConnection_;
128         /// buffer reset timers signal connection
129         boost::signals::connection timerConnection_;
130         /// buffer readonly status changed signal connection
131         boost::signals::connection readonlyConnection_;
132         /// buffer closing signal connection
133         boost::signals::connection closingConnection_;
134         /// connect to signals in the given buffer
135         void connectBuffer(Buffer & buf);
136         /// disconnect from signals in the given buffer
137         void disconnectBuffer();
138         /// track changes for the document
139         void trackChanges();
140         /// notify readonly status
141         void showReadonly(bool);
142
143         ///
144         friend class BufferView;
145
146         ///
147         BufferView * bv_;
148         ///
149         LyXView * owner_;
150         ///
151         Buffer * buffer_;
152         ///
153         boost::scoped_ptr<LyXScreen> screen_;
154         ///
155         boost::scoped_ptr<WorkArea> workarea_;
156         ///
157         Timeout cursor_timeout;
158         ///
159         void stuffClipboard(string const &) const;
160         ///
161         bool using_xterm_cursor;
162         ///
163         struct Position {
164                 /// Filename
165                 string filename;
166                 /// Cursor paragraph Id
167                 int par_id;
168                 /// Cursor position
169                 lyx::pos_type par_pos;
170                 ///
171                 Position() : par_id(0), par_pos(0) {}
172                 ///
173                 Position(string const & f, int id, lyx::pos_type pos)
174                         : filename(f), par_id(id), par_pos(pos) {}
175         };
176         ///
177         std::vector<Position> saved_positions;
178         /// Get next inset of this class from current cursor position
179         InsetOld * getInsetByCode(InsetOld::Code code);
180         ///
181         void MenuInsertLyXFile(string const & filen);
182         /// our workarea
183         WorkArea & workarea() const;
184 };
185 #endif // BUFFERVIEW_PIMPL_H