]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
64a2c0d550cc5f72540a22ae17689c85bb9e8665
[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
21 class LyXView;
22 class Buffer;
23 class LyXScreen;
24 class BackStack;
25 class Inset;
26
27 ///
28 class BufferView {
29 public:
30         ///
31         BufferView(LyXView *owner, int ,int ,int, int);
32         ///
33         ~BufferView();
34         ///
35         Buffer *currentBuffer() { return _buffer; }
36         ///
37         FL_OBJECT *getWorkArea() { return work_area; }
38         ///
39         void setBuffer(Buffer *b);
40         ///
41         void resize();
42         ///
43         void redraw();
44         ///
45         void fitCursor();
46         ///
47         void update();
48         ///
49         void updateScrollbar();
50         ///
51         void redoCurrentBuffer();
52         ///
53         int resizeCurrentBuffer();
54         ///
55         void gotoError();
56         ///
57         void cursorPrevious();
58         ///
59         void cursorNext();
60         /// 
61         bool available() const;
62         ///
63         LyXView *getOwner() { return _owner; }
64         ///
65         LyXScreen *getScreen()
66         {
67                 fl_set_timer(timer_cursor, 0.4);
68                 return screen;
69         }
70         ///
71         void savePosition();
72         ///
73         void restorePosition();
74 private:
75         /// Update pixmap of screen
76         void updateScreen();
77         ///
78         int workAreaExpose();
79         ///
80         void create_view(int, int, int, int);
81         ///
82         Inset * checkInsetHit(int &x, int &y);
83         /// 
84         int ScrollUp(long time);
85         ///
86         int ScrollDown(long time);
87         ///
88         void ScrollUpOnePage(long /*time*/);
89         ///
90         void ScrollDownOnePage(long /*time*/);
91
92         /// A callback for the up arrow in the scrollbar.
93         static void UpCB(FL_OBJECT *ob, long);
94
95         /// A callback for the slider in the scrollbar.
96         static void ScrollCB(FL_OBJECT *ob, long);
97
98         /// A callback for the down arrow in the scrollbar.
99         static void DownCB(FL_OBJECT *ob, long);
100
101         /** Work area free object handler
102          */
103         static int work_area_handler(FL_OBJECT *, int event,
104                                      FL_Coord, FL_Coord, int key, void *xev);
105         ///
106         int WorkAreaMotionNotify(FL_OBJECT *ob,
107                                  Window win,
108                                  int w, int h,
109                                  XEvent *ev, void *d);
110         ///
111         int WorkAreaSelectionNotify(FL_OBJECT *, Window win,
112                                     int /*w*/, int /*h*/,
113                                     XEvent *event, void */*d*/);
114         ///
115         int WorkAreaButtonPress(FL_OBJECT *ob,
116                                 Window win,
117                                 int w, int h,
118                                 XEvent *ev, void *d);
119         ///
120         int WorkAreaButtonRelease(FL_OBJECT *ob,
121                                   Window win,
122                                   int w, int h,
123                                   XEvent *ev, void *d);
124         ///
125         static void CursorToggleCB(FL_OBJECT *ob, long);
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