]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
white-space changes, removed definitions.h several enum changes because of this,...
[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
22 class LyXView;
23 class Buffer;
24 class LyXScreen;
25 class Inset;
26
27 ///
28 class BufferView {
29 public:
30         ///
31         BufferView(LyXView *owner, int , int , int, int);
32         ///
33         Buffer * buffer() const { return buffer_; }
34         ///
35         FL_OBJECT * getWorkArea() { return work_area; }
36         ///
37         void buffer(Buffer * b);
38         ///
39         void resize();
40         ///
41         void redraw();
42         ///
43         void fitCursor();
44         ///
45         void update();
46         ///
47         void updateScrollbar();
48         ///
49         void redoCurrentBuffer();
50         ///
51         int resizeCurrentBuffer();
52         ///
53         void gotoError();
54         ///
55         void cursorPrevious();
56         ///
57         void cursorNext();
58         /// 
59         bool available() const;
60         ///
61         LyXView * owner() const { return owner_; }
62         ///
63         LyXScreen * getScreen()
64         {
65                 fl_set_timer(timer_cursor, 0.4);
66                 return screen;
67         }
68         ///
69         void savePosition();
70         ///
71         void restorePosition();
72 private:
73         /// Update pixmap of screen
74         void updateScreen();
75         ///
76         int workAreaExpose();
77         ///
78         void create_view(int, int, int, int);
79         ///
80         Inset * checkInsetHit(int & x, int & y);
81         /// 
82         int ScrollUp(long time);
83         ///
84         int ScrollDown(long time);
85         ///
86         void ScrollUpOnePage(long /*time*/);
87         ///
88         void ScrollDownOnePage(long /*time*/);
89
90 public:
91         /// A callback for the up arrow in the scrollbar.
92         static void UpCB(FL_OBJECT * ob, long);
93
94         /// A callback for the slider in the scrollbar.
95         static void ScrollCB(FL_OBJECT * ob, long);
96
97         /// A callback for the down arrow in the scrollbar.
98         static void DownCB(FL_OBJECT * ob, long);
99
100         ///
101         static void CursorToggleCB(FL_OBJECT * ob, long);
102         /** Work area free object handler
103          */
104         static int work_area_handler(FL_OBJECT *, int event,
105                                      FL_Coord, FL_Coord, int key, void *xev);
106 private:
107         ///
108         int WorkAreaMotionNotify(FL_OBJECT * ob,
109                                  Window win,
110                                  int w, int h,
111                                  XEvent * ev, void * d);
112         ///
113         int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
114                                     int /*w*/, int /*h*/,
115                                     XEvent * event, void * /*d*/);
116         ///
117         int WorkAreaButtonPress(FL_OBJECT * ob,
118                                 Window win,
119                                 int w, int h,
120                                 XEvent * ev, void * d);
121         ///
122         int WorkAreaButtonRelease(FL_OBJECT * ob,
123                                   Window win,
124                                   int w, int h,
125                                   XEvent * ev, void * d);
126         ///
127         LyXView * owner_;
128         ///
129         Buffer * buffer_;
130         ///
131         LyXScreen * screen;
132         ///
133         long current_scrollbar_value;
134         ///
135         int work_area_width;
136         ///
137         bool lyx_focus;
138         ///
139         bool work_area_focus;
140         ///
141         FL_OBJECT * work_area;
142         ///
143         FL_OBJECT * figinset_canvas;
144         ///
145         FL_OBJECT * scrollbar;
146         ///
147         FL_OBJECT * button_down;
148         ///
149         FL_OBJECT * button_up;
150         ///
151         FL_OBJECT * timer_cursor;
152         ///
153         BackStack backstack;
154         ///
155         int last_click_x, last_click_y;
156 };
157
158 #endif