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