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