]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
more changes, read the Changelog
[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         ///
157         void toggleFloat();
158         ///
159         void openStuff();
160         ///
161         void insertNote();
162         ///
163         void allFloats(char flag, char figmar);
164         /// removes all autodeletable insets
165         bool removeAutoInsets();
166         ///
167         void insertErrors(TeXErrors & terr);
168         ///
169         void setCursorFromRow(int row);
170         /** Insert an inset into the buffer
171             Insert inset into buffer, placing it in a layout of lout,
172             if no_table make sure that it doesn't end up in a table. */
173         bool insertInset(Inset * inset, string const & lout = string(),
174                          bool no_table = false);
175         /// open and lock an updatable inset
176         void open_new_inset(UpdatableInset * new_inset);
177         /// Inserts a lyx file at cursor position. Returns false if it fails.
178         bool insertLyXFile(string const & file);
179         ///
180         bool lockInset(UpdatableInset * inset);
181         ///
182         void showLockedInsetCursor(long x, long y, int asc, int desc);
183         ///
184         void hideLockedInsetCursor();
185         ///
186         void fitLockedInsetCursor(long x, long y, int asc, int desc);
187         ///
188         int unlockInset(UpdatableInset * inset);
189         ///
190         void lockedInsetStoreUndo(Undo::undo_kind kind);
191         ///
192         void showCursor();
193         ///
194         void hideCursor();
195         ///
196         void toggleSelection(bool = true);
197         ///
198         void toggleToggle();
199         ///
200         void center();
201         
202         ///
203         bool focus() const;
204         ///
205         void focus(bool);
206         ///
207         bool active() const;
208         ///
209         bool belowMouse() const;
210         /// A callback for the slider in the scrollbar.
211         void scrollCB(double);
212
213         ///
214         void setState();
215
216         ///
217         void pushIntoUpdateList(Inset * i);
218         ///
219         void workAreaExpose();
220         ///
221         void workAreaButtonPress(int x, int y, unsigned int button);
222         ///
223         void workAreaButtonRelease(int x, int y, unsigned int button);
224         ///
225         void workAreaMotionNotify(int x, int y, unsigned int state);
226         ///
227         void doubleClick(int x, int y, unsigned int button);
228         ///
229         void tripleClick(int x, int y, unsigned int button);
230         ///
231         void enterView();
232         ///
233         void leaveView();
234         ///
235         bool ChangeRefs(string const & from, string const & to);
236         ///
237         void pasteClipboard(bool asPara);
238         ///
239         void stuffClipboard(string const &) const;
240 private:
241         struct Pimpl;
242         friend struct BufferView::Pimpl;
243         Pimpl * pimpl_;
244 };
245
246
247 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
248                                   BufferView::UpdateCodes uc2);
249
250 #endif