]> git.lyx.org Git - lyx.git/blob - src/lyxscreen.h
fix the resize bug, make some more inset funcs const, cleanup in lyxscreen, painter...
[lyx.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 WorkArea;
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(WorkArea &, LyXText * text_ptr);
37
38         /** Draws the screen form textposition y. Uses as much of
39             the already printed pixmap as possible */
40         void Draw(long y );
41
42         /// Redraws the screen, without using existing pixmap
43         void Redraw();
44    
45         /// Returns a new top so that the cursor is visible
46         long TopCursorVisible();
47         /// Redraws the screen such that the cursor is visible
48         int FitCursor();
49         ///
50         void ShowCursor();
51         ///
52         void HideCursor();
53         ///
54         void CursorToggle();
55         ///
56         void ShowManualCursor(long x, long y, int asc, int desc);
57         /// returns 1 if first has changed, otherwise 0
58         int  FitManualCursor(long, long, int, int);
59         ///
60         void ToggleSelection(bool = true);
61         ///
62         void ToggleToggle();
63         
64         /** Updates part of the screen. If text->status is
65             LyXText::NEED_MORE_REFRESH, we update from the
66             point of change and to the end of the screen.
67             If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
68             we only update the current row. */
69         void Update();
70
71         /** Updates part of the screen. Updates till row with cursor,
72             or only current row */
73         void SmallUpdate();
74
75         /// first visible pixel-row
76         long first;
77
78         ///
79         bool cursor_visible;
80 private:
81         /// Copies specified area of pixmap to screen
82         void expose(int x, int y, int exp_width, int exp_height); 
83
84         /// y1 and y2 are coordinates of the screen
85         void DrawFromTo(int y1, int y2);
86    
87         /// y is a coordinate of the text
88         void DrawOneRow(Row * row, long & y_text);
89
90         ///
91         WorkArea & owner;
92         
93         ///
94         LyXText * text;
95
96         ///
97         Pixmap cursor_pixmap;
98         ///
99         int cursor_pixmap_x;
100         ///
101         int cursor_pixmap_y;
102         ///
103         int cursor_pixmap_w;
104         ///
105         int cursor_pixmap_h;
106         ///
107         long screen_refresh_y;
108         ///
109         Row * screen_refresh_row;
110
111         ///
112         GC gc_copy;
113 };
114
115 #endif