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