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