]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
Remove const, set language of surronding paragraph (point 19 Dekel ;)
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2000 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef BUFFER_VIEW_H
13 #define BUFFER_VIEW_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20 #include "undo.h"
21 #include <boost/utility.hpp>
22
23 class LyXView;
24 class LyXText;
25 class TeXErrors;
26 class Buffer;
27 class LyXScreen;
28 class WorkArea;
29
30 ///
31 class BufferView : public noncopyable {
32 public:
33         ///
34         enum UpdateCodes {
35                 ///
36                 UPDATE = 0,
37                 ///
38                 SELECT = 1,
39                 ///
40                 FITCUR = 2,
41                 ///
42                 CHANGE = 4
43         };
44                                             
45         ///
46         BufferView(LyXView * owner, int , int , int, int);
47         ///
48         ~BufferView();
49         ///
50         Buffer * buffer() const;
51         ///
52         Painter & painter();
53         ///
54         LyXScreen * screen() const;
55         ///
56         WorkArea * workarea() const;
57         ///
58         void buffer(Buffer * b);
59         ///
60         void resize(int, int, int, int);
61         ///
62         void resize();
63         ///
64         void redraw();
65         ///
66         void fitCursor(LyXText *);
67         ///
68         void update();
69         //
70         void update(UpdateCodes uc);
71         ///
72         void updateScrollbar();
73         ///
74         Inset * checkInsetHit(LyXText *, int & x, int & y,
75                               unsigned int button);
76         /// 
77         void redoCurrentBuffer();
78         ///
79         int resizeCurrentBuffer();
80         ///
81         void gotoError();
82         ///
83         void cursorPrevious();
84         ///
85         void cursorNext();
86         /// 
87         bool available() const;
88         ///
89         LyXView * owner() const;
90         ///
91         void beforeChange();
92         ///
93         void savePosition();
94         ///
95         void restorePosition();
96         ///
97         bool NoSavedPositions();
98         /** This holds the mapping between buffer paragraphs and screen rows.
99             This should be private...but not yet. (Lgb)
100         */
101         LyXText * text;
102         ///
103         int workWidth() const;
104         ///
105         UpdatableInset * theLockingInset() const;
106         void theLockingInset(UpdatableInset * inset); 
107         ///
108         void updateInset(Inset * inset, bool mark_dirty);
109         ///
110         bool inset_slept;
111         ///
112         int slx;
113         ///
114         int sly;
115         ///
116         void insetUnlock();
117         ///
118         void insetSleep();
119         ///
120         void insetWakeup();
121         ///
122         void replaceWord(string const & replacestring);
123         ///
124         void endOfSpellCheck();
125         ///
126         void selectLastWord();
127         ///
128         string const nextWord(float & value);
129         ///
130         void insertCorrectQuote();
131         ///
132         void gotoNote();
133         ///
134         bool gotoLabel(string const & label);
135         ///
136         void paste();
137         ///
138         void cut();
139         ///
140         void copy();
141         ///
142         void pasteEnvironment();
143         ///
144         void copyEnvironment();
145         ///
146         void hfill();
147         ///
148         void protectedBlank();
149         ///
150         void newline();
151         ///
152         void menuSeparator();
153         ///
154         void endOfSentenceDot();
155         ///
156         void ldots();
157         ///
158         void hyphenationPoint();
159         ///
160         void menuUndo();
161         ///
162         void menuRedo();
163 #ifndef NEW_INSETS
164         ///
165         void toggleFloat();
166         ///
167         void openStuff();
168 #endif
169         ///
170         void insertNote();
171 #ifndef NEW_INSETS
172         ///
173         void allFloats(char flag, char figmar);
174 #endif
175         /// removes all autodeletable insets
176         bool removeAutoInsets();
177         ///
178         void insertErrors(TeXErrors & terr);
179         ///
180         void setCursorFromRow(int row);
181         /** Insert an inset into the buffer.
182             Placie it in a layout of lout,
183             if no_table make sure that it doesn't end up in a table.
184         */
185         bool insertInset(Inset * inset, string const & lout = string(),
186                          bool no_table = false);
187         /// open and lock an updatable inset
188         bool open_new_inset(UpdatableInset * new_inset);
189         /** Inserts a lyx file at cursor position.
190             @return #false# if it fails.
191         */
192         bool insertLyXFile(string const & file);
193         ///
194         bool lockInset(UpdatableInset * inset);
195         ///
196         void showLockedInsetCursor(int x, int y, int asc, int desc);
197         ///
198         void hideLockedInsetCursor();
199         ///
200         void fitLockedInsetCursor(int x, int y, int asc, int desc);
201         ///
202         int unlockInset(UpdatableInset * inset);
203         ///
204         void lockedInsetStoreUndo(Undo::undo_kind kind);
205         ///
206         void showCursor();
207         ///
208         void hideCursor();
209         ///
210         void toggleSelection(bool = true);
211         ///
212         void toggleToggle();
213         ///
214         void center();
215         
216         ///
217         bool focus() const;
218         ///
219         void focus(bool);
220         ///
221         bool active() const;
222         ///
223         bool belowMouse() const;
224         /// A callback for the slider in the scrollbar.
225         void scrollCB(double);
226
227         ///
228         void setState();
229
230         ///
231         void pushIntoUpdateList(Inset * i);
232         ///
233         void workAreaExpose();
234         ///
235         void workAreaButtonPress(int x, int y, unsigned int button);
236         ///
237         void workAreaButtonRelease(int x, int y, unsigned int button);
238         ///
239         void workAreaMotionNotify(int x, int y, unsigned int state);
240         ///
241         void doubleClick(int x, int y, unsigned int button);
242         ///
243         void tripleClick(int x, int y, unsigned int button);
244         ///
245         void enterView();
246         ///
247         void leaveView();
248         ///
249         bool ChangeRefs(string const & from, string const & to);
250         ///
251         void pasteClipboard(bool asPara);
252         ///
253         void stuffClipboard(string const &) const;
254 private:
255         struct Pimpl;
256         ///
257         friend struct BufferView::Pimpl;
258         ///
259         Pimpl * pimpl_;
260 };
261
262
263 ///
264 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
265                                   BufferView::UpdateCodes uc2);
266
267 #endif