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