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