]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
Small fixes
[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(LyXText *);
84         ///
85         void cursorNext(LyXText *);
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         ///
107         void theLockingInset(UpdatableInset * inset); 
108         ///
109         void updateInset(Inset * inset, bool mark_dirty);
110         ///
111         bool inset_slept;
112         ///
113         int slx;
114         ///
115         int sly;
116         ///
117         void insetUnlock();
118         ///
119         void insetSleep();
120         ///
121         void insetWakeup();
122         ///
123         void replaceWord(string const & replacestring);
124         ///
125         void endOfSpellCheck();
126         ///
127         void selectLastWord();
128         ///
129         string const nextWord(float & value);
130         ///
131         void insertCorrectQuote();
132         ///
133         void gotoNote();
134         ///
135         bool gotoLabel(string const & label);
136         ///
137         void paste();
138         ///
139         void cut();
140         ///
141         void copy();
142         ///
143         void pasteEnvironment();
144         ///
145         void copyEnvironment();
146         ///
147         void hfill();
148         ///
149         void protectedBlank();
150         ///
151         void newline();
152         ///
153         void menuSeparator();
154         ///
155         void endOfSentenceDot();
156         ///
157         void ldots();
158         ///
159         void hyphenationPoint();
160         ///
161         void menuUndo();
162         ///
163         void menuRedo();
164 #ifndef NEW_INSETS
165         ///
166         void toggleFloat();
167         ///
168         void openStuff();
169 #endif
170         ///
171         void insertNote();
172 #ifndef NEW_INSETS
173         ///
174         void allFloats(char flag, char figmar);
175 #endif
176         /// removes all autodeletable insets
177         bool removeAutoInsets();
178         ///
179         void insertErrors(TeXErrors & terr);
180         ///
181         void setCursorFromRow(int row);
182         /** Insert an inset into the buffer.
183             Placie it in a layout of lout,
184             if no_table make sure that it doesn't end up in a table.
185         */
186         bool insertInset(Inset * inset, string const & lout = string(),
187                          bool no_table = false);
188         /// open and lock an updatable inset
189         bool open_new_inset(UpdatableInset * new_inset);
190         /** Inserts a lyx file at cursor position.
191             @return #false# if it fails.
192         */
193         bool insertLyXFile(string const & file);
194         ///
195         bool lockInset(UpdatableInset * inset);
196         ///
197         void showLockedInsetCursor(int x, int y, int asc, int desc);
198         ///
199         void hideLockedInsetCursor();
200         ///
201         void fitLockedInsetCursor(int x, int y, int asc, int desc);
202         ///
203         int unlockInset(UpdatableInset * inset);
204         ///
205         void lockedInsetStoreUndo(Undo::undo_kind kind);
206         ///
207         void showCursor();
208         ///
209         void hideCursor();
210         ///
211         void toggleSelection(bool = true);
212         ///
213         void toggleToggle();
214         ///
215         void center();
216         
217         ///
218         bool focus() const;
219         ///
220         void focus(bool);
221         ///
222         bool active() const;
223         ///
224         bool belowMouse() const;
225         /// A callback for the slider in the scrollbar.
226         void scrollCB(double);
227
228         ///
229         void setState();
230
231         ///
232         void pushIntoUpdateList(Inset * i);
233         ///
234         void workAreaExpose();
235         ///
236         void workAreaButtonPress(int x, int y, unsigned int button);
237         ///
238         void workAreaButtonRelease(int x, int y, unsigned int button);
239         ///
240         void workAreaMotionNotify(int x, int y, unsigned int state);
241         ///
242         void doubleClick(int x, int y, unsigned int button);
243         ///
244         void tripleClick(int x, int y, unsigned int button);
245         ///
246         void enterView();
247         ///
248         void leaveView();
249         ///
250         bool ChangeRefs(string const & from, string const & to);
251         ///
252         void pasteClipboard(bool asPara);
253         ///
254         void stuffClipboard(string const &) const;
255 private:
256         struct Pimpl;
257         ///
258         friend struct BufferView::Pimpl;
259         ///
260         Pimpl * pimpl_;
261 };
262
263
264 ///
265 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
266                                   BufferView::UpdateCodes uc2);
267
268 #endif