]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
1f50cb981271a761f2982a760f032a4197e68a7b
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright (C) 1995 Matthias Ettrich
8  *           Copyright (C) 1995-1998 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 "lyxtext.h"
22
23
24 class LyXView;
25 class Buffer;
26 class LyXScreen;
27 class Inset;
28
29 ///
30 class BufferView {
31 public:
32         ///
33         BufferView(LyXView * owner, int , int , int, int);
34         ///
35         ~BufferView();
36         ///
37         Buffer * buffer() const { return buffer_; }
38         ///
39         FL_OBJECT * getWorkArea() { return work_area; }
40         ///
41         void buffer(Buffer * b);
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 smallUpdate(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 { return owner_; }
70         ///
71         LyXScreen * getScreen() {
72                 fl_set_timer(timer_cursor, 0.4);
73                 return screen;
74         }
75         ///
76         void beforeChange();
77         ///
78         void savePosition();
79         ///
80         void restorePosition();
81         /** This holds the mapping between buffer paragraphs and screen rows.
82             This should be private...but not yet. (Lgb)
83         */
84         LyXText * text;
85         ///
86         UpdatableInset * the_locking_inset;
87         ///
88         bool inset_slept;
89         ///
90         int slx;
91         ///
92         int sly;
93         ///
94         void insetUnlock();
95         ///
96         void insetSleep();
97         ///
98         void insetWakeup();
99 private:
100         /// Update pixmap of screen
101         void updateScreen();
102         ///
103         int workAreaExpose();
104         ///
105         void create_view(int, int, int, int);
106         ///
107         Inset * checkInsetHit(int & x, int & y);
108         /// 
109         int ScrollUp(long time);
110         ///
111         int ScrollDown(long time);
112         ///
113         void ScrollUpOnePage(long /*time*/);
114         ///
115         void ScrollDownOnePage(long /*time*/);
116
117 public:
118         /// A callback for the up arrow in the scrollbar.
119         static void UpCB(FL_OBJECT * ob, long);
120
121         /// A callback for the slider in the scrollbar.
122         static void ScrollCB(FL_OBJECT * ob, long);
123
124         /// A callback for the down arrow in the scrollbar.
125         static void DownCB(FL_OBJECT * ob, long);
126
127         ///
128         static void CursorToggleCB(FL_OBJECT * ob, long);
129         /** Work area free object handler
130          */
131         static int work_area_handler(FL_OBJECT *, int event,
132                                      FL_Coord, FL_Coord, int key, void *xev);
133 private:
134         ///
135         int WorkAreaMotionNotify(FL_OBJECT * ob,
136                                  Window win,
137                                  int w, int h,
138                                  XEvent * ev, void * d);
139         ///
140         int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
141                                     int /*w*/, int /*h*/,
142                                     XEvent * event, void * /*d*/);
143         ///
144         int WorkAreaButtonPress(FL_OBJECT * ob,
145                                 Window win,
146                                 int w, int h,
147                                 XEvent * ev, void * d);
148         ///
149         int WorkAreaButtonRelease(FL_OBJECT * ob,
150                                   Window win,
151                                   int w, int h,
152                                   XEvent * ev, void * d);
153         ///
154         LyXView * owner_;
155         ///
156         Buffer * buffer_;
157         ///
158         LyXScreen * screen;
159         ///
160         long current_scrollbar_value;
161         ///
162         bool lyx_focus;
163         ///
164         bool work_area_focus;
165         ///
166         FL_OBJECT * work_area;
167         ///
168         FL_OBJECT * figinset_canvas;
169         ///
170         FL_OBJECT * scrollbar;
171         ///
172         FL_OBJECT * button_down;
173         ///
174         FL_OBJECT * button_up;
175         ///
176         FL_OBJECT * timer_cursor;
177         ///
178         BackStack backstack;
179         ///
180         int last_click_x, last_click_y;
181 };
182
183 #endif