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