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