]> git.lyx.org Git - features.git/blob - src/lyxscreen.h
remove the old painter, remove support for mono_video, reverse_video, fast selection...
[features.git] / src / lyxscreen.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 LYXSCREEN_H
13 #define LYXSCREEN_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include FORMS_H_LOCATION
20 #include <X11/Xlib.h>
21
22 class LyXText;
23 struct Row;
24 typedef unsigned short Dimension;
25
26 class BufferView;
27
28 /** The class LyXScreen is used for the main Textbody.
29     Concretely, the screen is held in a pixmap.  This pixmap is kept up to
30     date and used to optimize drawing on the screen.
31     This class also handles the drawing of the cursor and partly the selection.
32  */
33 class LyXScreen {
34 public:
35         ///
36         LyXScreen(BufferView *, Window window,
37                   Pixmap p,
38                   Dimension width, 
39                   Dimension height,
40                   Dimension offset_x,
41                   Dimension offset_y,
42                   LyXText * text_ptr);
43         ///
44         ~LyXScreen();
45
46         /** Draws the screen form textposition y. Uses as much of
47             the already printed pixmap as possible */
48         void Draw(long y );
49
50         /// Redraws the screen, without using existing pixmap
51         void Redraw();
52    
53         /// Returns a new top so that the cursor is visible
54         long TopCursorVisible();
55         /// Redraws the screen such that the cursor is visible
56         int FitCursor();
57         ///
58         void ShowCursor();
59         ///
60         void HideCursor();
61         ///
62         void CursorToggle();
63         ///
64         void ShowManualCursor(long x, long y, int asc, int desc);
65         ///
66         void HideManualCursor();
67         /// returns 1 if first has changed, otherwise 0
68         int  FitManualCursor(long, long, int, int);
69         ///
70         void ToggleSelection(bool = true);
71         ///
72         void ToggleToggle();
73         
74         /** Updates part of the screen. If text->status is
75             LyXText::NEED_MORE_REFRESH, we update from the
76             point of change and to the end of the screen.
77             If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
78             we only update the current row. */
79         void Update();
80
81         /** Updates part of the screen. Updates till row with cursor,
82             or only current row */
83         void SmallUpdate();
84
85         /// first visible pixel-row
86         long first;
87
88         ///
89         bool cursor_visible;
90 private:
91         /// Copies specified area of pixmap to screen
92         void expose(int x, int y, int exp_width, int exp_height); 
93
94         /// y1 and y2 are coordinates of the screen
95         void DrawFromTo(int y1, int y2);
96    
97         /// y is a coordinate of the text
98         void DrawOneRow(Row * row, long & y_text);
99
100         ///
101         BufferView * owner;
102         
103         ///
104         LyXText * text;
105
106         ///
107         Pixmap foreground;
108         ///
109         Pixmap cursor_pixmap;
110         ///
111         int cursor_pixmap_x;
112         ///
113         int cursor_pixmap_y;
114         ///
115         int cursor_pixmap_w;
116         ///
117         int cursor_pixmap_h;
118         ///
119         Window _window;
120         ///
121         Dimension _width;
122         ///
123         Dimension _height;
124         ///
125         Dimension _offset_x;
126         ///
127         Dimension _offset_y;
128         ///
129         long screen_refresh_y;
130         ///
131         Row * screen_refresh_row;
132
133         ///
134         GC gc_copy;
135 };
136
137 #endif