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