]> git.lyx.org Git - lyx.git/blob - src/BufferView.C
move mouse click handling to LyXText::dispatch
[lyx.git] / src / BufferView.C
1 /**
2  * \file BufferView.C
3  * Copyright 1995-2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "BufferView.h"
17 #include "BufferView_pimpl.h"
18 #include "lyxtext.h"
19 #include "frontends/screen.h"
20 #include "frontends/WorkArea.h"
21 #include "frontends/LyXView.h"
22
23
24 BufferView::BufferView(LyXView * owner, int xpos, int ypos,
25                        int width, int height)
26         : pimpl_(new Pimpl(this, owner, xpos, ypos, width, height))
27 {
28         text = 0;
29 }
30
31
32 BufferView::~BufferView()
33 {
34         delete text;
35         delete pimpl_;
36 }
37
38
39 Buffer * BufferView::buffer() const
40 {
41         return pimpl_->buffer_;
42 }
43
44
45 LyXScreen & BufferView::screen() const
46 {
47         return pimpl_->screen();
48 }
49
50
51 WorkArea & BufferView::workarea() const
52 {
53         return pimpl_->workarea();
54 }
55
56
57 LyXView * BufferView::owner() const
58 {
59         return pimpl_->owner_;
60 }
61
62
63 Painter & BufferView::painter() const
64 {
65         return pimpl_->painter();
66 }
67
68
69 void BufferView::buffer(Buffer * b)
70 {
71         pimpl_->buffer(b);
72 }
73
74
75 void BufferView::resize()
76 {
77         if (pimpl_->buffer_) {
78                 pimpl_->resizeCurrentBuffer();
79         }
80 }
81
82
83 void BufferView::repaint()
84 {
85         pimpl_->repaint();
86 }
87
88
89 bool BufferView::fitCursor()
90 {
91         return pimpl_->fitCursor();
92 }
93
94
95 void BufferView::update()
96 {
97         pimpl_->update();
98 }
99
100
101 void BufferView::updateScrollbar()
102 {
103         pimpl_->updateScrollbar();
104 }
105
106
107 void BufferView::scrollDocView(int value)
108 {
109         pimpl_->scrollDocView(value);
110 }
111
112
113 Inset * BufferView::checkInsetHit(LyXText * text, int & x, int & y)
114 {
115         return pimpl_->checkInsetHit(text, x, y);
116 }
117
118
119 void BufferView::redoCurrentBuffer()
120 {
121         pimpl_->redoCurrentBuffer();
122 }
123
124
125 bool BufferView::available() const
126 {
127         return pimpl_->available();
128 }
129
130
131 void BufferView::beforeChange(LyXText * text)
132 {
133         pimpl_->beforeChange(text);
134 }
135
136
137 void BufferView::savePosition(unsigned int i)
138 {
139         pimpl_->savePosition(i);
140 }
141
142
143 void BufferView::restorePosition(unsigned int i)
144 {
145         pimpl_->restorePosition(i);
146 }
147
148
149 bool BufferView::isSavedPosition(unsigned int i)
150 {
151         return pimpl_->isSavedPosition(i);
152 }
153
154
155 void BufferView::update(LyXText * text, UpdateCodes f)
156 {
157         pimpl_->update(text, f);
158 }
159
160
161 void BufferView::switchKeyMap()
162 {
163         pimpl_->switchKeyMap();
164 }
165
166
167 void BufferView::insetUnlock()
168 {
169         pimpl_->insetUnlock();
170 }
171
172
173 int BufferView::workWidth() const
174 {
175         return pimpl_->workarea().workWidth();
176 }
177
178
179 void BufferView::showCursor()
180 {
181         pimpl_->showCursor();
182 }
183
184
185 void BufferView::hideCursor()
186 {
187         pimpl_->hideCursor();
188 }
189
190
191 void BufferView::toggleSelection(bool b)
192 {
193         pimpl_->toggleSelection(b);
194 }
195
196
197 void BufferView::toggleToggle()
198 {
199         pimpl_->toggleToggle();
200 }
201
202
203 void BufferView::center()
204 {
205         pimpl_->center();
206 }
207
208
209 string const BufferView::getClipboard() const
210 {
211         return pimpl_->workarea().getClipboard();
212 }
213
214
215 void BufferView::stuffClipboard(string const & stuff) const
216 {
217         pimpl_->stuffClipboard(stuff);
218 }
219
220
221 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
222                                   BufferView::UpdateCodes uc2)
223 {
224         return static_cast<BufferView::UpdateCodes>
225                 (static_cast<int>(uc1) | static_cast<int>(uc2));
226 }
227
228
229 bool BufferView::dispatch(FuncRequest const & ev)
230 {
231         return pimpl_->dispatch(ev);
232 }
233
234
235 int BufferView::scroll(long time)
236 {
237         return pimpl_->scroll(time);
238 }