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