]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
f1234753cf994ca39185ffb3adf664ef7614f5e4
[lyx.git] / src / BufferView_pimpl.h
1 // -*- C++ -*-
2
3 #ifndef BUFFERVIEW_PIMPL_H
4 #define BUFFERVIEW_PIMPL_H
5
6 #include <boost/smart_ptr.hpp>
7
8 #include "BufferView.h"
9 #include "UpdateInset.h"
10 #include "commandtags.h"
11 #include "frontends/Timeout.h"
12 #include "WorkArea.h"
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 class LyXView;
19 class WorkArea;
20 class LyXScreen;
21
22 ///
23 struct BufferView::Pimpl : public SigC::Object {
24         ///
25         Pimpl(BufferView * i, LyXView * o,
26               int xpos, int ypos, int width, int height);
27         ///
28         Painter & painter();
29         ///
30         void buffer(Buffer *);
31         ///
32         void resize(int xpos, int ypos, int width, int height);
33         ///
34         void resize();
35         ///
36         void redraw();
37         /// Return true if the cursor was fitted.
38         bool fitCursor(LyXText *);
39         ///
40         void redoCurrentBuffer();
41         ///
42         int resizeCurrentBuffer();
43         ///
44         void update();
45         //
46         void update(LyXText *, BufferView::UpdateCodes);
47         /// Update pixmap of screen
48         void updateScreen();
49         ///
50         void workAreaExpose();
51         ///
52         void updateScrollbar();
53         ///
54         void scrollCB(double value);
55         ///
56         Inset * checkInsetHit(LyXText *, int & x, int & y,
57                               unsigned int button);
58         /// 
59         int scrollUp(long time);
60         ///
61         int scrollDown(long time);
62         ///
63         void workAreaKeyPress(KeySym, unsigned int state);
64         ///
65         void workAreaMotionNotify(int x, int y, unsigned int state);
66         ///
67         void workAreaButtonPress(int x, int y, unsigned int button);
68         ///
69         void workAreaButtonRelease(int x, int y, unsigned int button);
70         ///
71         void doubleClick(int x, int y, unsigned int button);
72         ///
73         void tripleClick(int x, int y, unsigned int button);
74         ///
75         void enterView();
76         ///
77         void leaveView();
78         ///
79         void cursorToggle();
80         ///
81         void cursorPrevious(LyXText *);
82         ///
83         void cursorNext(LyXText *);
84         ///
85         bool available() const;
86         ///
87         void beforeChange(LyXText *);
88         ///
89         void savePosition(unsigned int i);
90         ///
91         void restorePosition(unsigned int i);
92         ///
93         bool isSavedPosition(unsigned int i);
94         ///
95         void setState();
96         ///
97         void insetSleep();
98         ///
99         void insetWakeup();
100         ///
101         void insetUnlock();
102         ///
103         bool focus() const;
104         ///
105         void focus(bool);
106         ///
107         bool active() const;
108         ///
109         bool belowMouse() const;
110         ///
111         void showCursor();
112         ///
113         void hideCursor();
114         ///
115         void toggleSelection(bool = true);
116         ///
117         void toggleToggle();
118         ///
119         void center();
120         ///
121         bool insertInset(Inset * inset, string const & lout = string());
122         ///
123         void updateInset(Inset * inset, bool mark_dirty);
124         ///
125         bool Dispatch(kb_action action, string const & argument);
126 private:
127         ///
128         friend class BufferView;
129         /// open and lock an updatable inset
130         bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
131         ///
132         void protectedBlank(LyXText * lt);
133         ///
134         void newline();
135         ///
136         void hfill();
137         ///
138         void menuSeparator();
139         ///
140         void endOfSentenceDot();
141         ///
142         void ldots();
143         ///
144         void hyphenationPoint();
145         ///
146         void insertNote();
147         ///
148         void gotoInset(std::vector<Inset::Code> const & codes,
149                        bool same_content);
150         ///
151         void gotoInset(Inset::Code codes, bool same_content);
152         ///
153         BufferView * bv_;
154         ///
155         LyXView * owner_;
156         ///
157         Buffer * buffer_;
158         ///
159         boost::scoped_ptr<LyXScreen> screen_;
160         ///
161         long current_scrollbar_value;
162         ///
163         Timeout cursor_timeout;
164         ///
165         WorkArea workarea_;
166         ///
167         UpdateInset updatelist;
168         ///
169         void pasteClipboard(bool asPara);
170         ///
171         void stuffClipboard(string const &) const;
172         ///
173         bool using_xterm_cursor;
174         ///
175         struct Position {
176                 /// Filename
177                 string filename;
178                 /// Cursor paragraph Id
179                 int par_id;
180                 /// Cursor position
181                 LyXParagraph::size_type par_pos;
182                 ///
183                 Position() : par_id(0), par_pos(0) {}
184                 ///
185                 Position(string const & f, int id, LyXParagraph::size_type pos)
186                         : filename(f), par_id(id), par_pos(pos) {}
187         };
188         ///
189         std::vector<Position> saved_positions;
190         ///
191         void moveCursorUpdate(bool selecting);
192         /// Get next inset of this class from current cursor position  
193         Inset * getInsetByCode(Inset::Code code);
194         ///
195         void MenuInsertLyXFile(string const & filen);
196         ///
197         bool inset_slept;
198 };
199 #endif