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