4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
10 * Full author contact details are available in file CREDITS
24 * LyXScreen - document rendering management
26 * This class is used to manage the on-screen rendering inside the
27 * work area; it is responsible for deciding which LyXText rows
30 * This class will arrange for LyXText to paint onto a pixmap
31 * provided by the WorkArea widget.
33 * The blinking cursor is also handled here.
37 /// types of cursor in work area
41 /// L-shape for locked insets of a different language
43 /// reverse L-shape for RTL text
52 * draw the screen from a given position
53 * @param y the text position to draw from
55 * Uses as much of the already printed pixmap as possible
57 virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
60 * showManualCursor - display the cursor on the work area
61 * @param text the lyx text containing the cursor
62 * @param x the x position of the cursor
63 * @param y the y position of the row's baseline
64 * @param asc ascent of the row
65 * @param desc descent of the row
66 * @param shape the current shape
68 virtual void showManualCursor(LyXText const *, int x, int y,
70 Cursor_Shape shape) = 0;
72 /// unpaint the cursor painted by showManualCursor()
73 virtual void hideCursor() = 0;
76 * fit the cursor onto the visible work area, scrolling if necessary
77 * @param bv the buffer view
78 * @param vheight the height of the visible region
79 * @param base_y the top of the lyxtext to look at
80 * @param x the new x position
81 * @param y the new y position
82 * @param a ascent of the cursor's row
83 * @param d descent of the cursor's row
84 * @return true if the work area needs scrolling as a result
86 bool fitManualCursor(BufferView * bv, LyXText * text,
87 int x, int y, int a, int d);
89 /// redraw the screen, without using existing pixmap
90 virtual void redraw(LyXText *, BufferView *);
92 /// draw the cursor if it's not already shown
93 virtual void showCursor(LyXText const *, BufferView const *);
96 * topCursorVisible - get a new "top" to make the cursor visible
98 * @param top_y the current y location of the containing region
100 * This helper function calculates a new y co-ordinate for
101 * the top of the containing region such that the cursor contained
102 * within the LyXText is "nicely" visible.
104 virtual unsigned int topCursorVisible(LyXCursor const & c, int top_y);
107 * fitCursor - fit the cursor onto the work area
108 * @param text the text containing the cursor
109 * @param bv the bufferview
110 * @return true if a change was necessary
112 * Scrolls the screen so that the cursor is visible
114 virtual bool fitCursor(LyXText *, BufferView *);
116 /// show the cursor if it's not, and vice versa
117 virtual void cursorToggle(BufferView *) const;
120 * update - update part of the screen rendering
121 * @param bv the bufferview
122 * @param xo the x offset into the text
123 * @param yo the x offset into the text
125 * Updates part of the screen. If bv->text->status is
126 * LyXText::NEED_MORE_REFRESH, we update from the
127 * point of change and to the end of the screen.
128 * If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
129 * we only update the current row.
131 virtual void update(BufferView & bv, int yo = 0, int xo = 0);
134 virtual void toggleSelection(LyXText *, BufferView *, bool = true,
135 int y_offset = 0, int x_offset = 0);
137 /// FIXME - at least change the name !!
138 virtual void toggleToggle(LyXText *, BufferView *,
139 int y_offset = 0, int x_offset = 0);
142 /// cause the display of the given area of the work area
143 virtual void expose(int x, int y, int w, int h) = 0;
145 /// get the work area
146 virtual WorkArea & workarea() const = 0;
148 /// y1 and y2 are coordinates of the screen
149 void drawFromTo(LyXText *, BufferView *, int y1, int y2,
150 int y_offset = 0, int x_offset = 0);
152 /// y is a coordinate of the text
153 void drawOneRow(LyXText *, BufferView *, Row * row,
154 int y_text, int y_offset = 0, int x_offset = 0);
156 /// is the blinking cursor currently drawn
157 bool cursor_visible_;
160 /// grey out (no buffer)
163 /// is the screen displaying text or the splash screen?