]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
2ec4f88575b3d429ccb059b3d87840a9fce95ea9
[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 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 { return owner_; }
68         ///
69         LyXScreen * getScreen() {
70                 fl_set_timer(timer_cursor, 0.4);
71                 return screen;
72         }
73         ///
74         void savePosition();
75         ///
76         void restorePosition();
77         /** This holds the mapping between buffer paragraphs and screen rows.
78             This should be private...but not yet. (Lgb)
79         */
80         LyXText * text;
81 private:
82         /// Update pixmap of screen
83         void updateScreen();
84         ///
85         int workAreaExpose();
86         ///
87         void create_view(int, int, int, int);
88         ///
89         Inset * checkInsetHit(int & x, int & y);
90         /// 
91         int ScrollUp(long time);
92         ///
93         int ScrollDown(long time);
94         ///
95         void ScrollUpOnePage(long /*time*/);
96         ///
97         void ScrollDownOnePage(long /*time*/);
98
99 public:
100         /// A callback for the up arrow in the scrollbar.
101         static void UpCB(FL_OBJECT * ob, long);
102
103         /// A callback for the slider in the scrollbar.
104         static void ScrollCB(FL_OBJECT * ob, long);
105
106         /// A callback for the down arrow in the scrollbar.
107         static void DownCB(FL_OBJECT * ob, long);
108
109         ///
110         static void CursorToggleCB(FL_OBJECT * ob, long);
111         /** Work area free object handler
112          */
113         static int work_area_handler(FL_OBJECT *, int event,
114                                      FL_Coord, FL_Coord, int key, void *xev);
115 private:
116         ///
117         int WorkAreaMotionNotify(FL_OBJECT * ob,
118                                  Window win,
119                                  int w, int h,
120                                  XEvent * ev, void * d);
121         ///
122         int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
123                                     int /*w*/, int /*h*/,
124                                     XEvent * event, void * /*d*/);
125         ///
126         int WorkAreaButtonPress(FL_OBJECT * ob,
127                                 Window win,
128                                 int w, int h,
129                                 XEvent * ev, void * d);
130         ///
131         int WorkAreaButtonRelease(FL_OBJECT * ob,
132                                   Window win,
133                                   int w, int h,
134                                   XEvent * ev, void * d);
135         ///
136         LyXView * owner_;
137         ///
138         Buffer * buffer_;
139         ///
140         LyXScreen * screen;
141         ///
142         long current_scrollbar_value;
143         ///
144         bool lyx_focus;
145         ///
146         bool work_area_focus;
147         ///
148         FL_OBJECT * work_area;
149         ///
150         FL_OBJECT * figinset_canvas;
151         ///
152         FL_OBJECT * scrollbar;
153         ///
154         FL_OBJECT * button_down;
155         ///
156         FL_OBJECT * button_up;
157         ///
158         FL_OBJECT * timer_cursor;
159         ///
160         BackStack backstack;
161         ///
162         int last_click_x, last_click_y;
163 };
164
165 #endif