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