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