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