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