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