1 /* Redisplay data structures.
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3 Copyright (C) 1996 Chuck Thompson.
4 Copyright (C) 1995, 1996 Ben Wing.
6 This file is part of SXEmacs
8 SXEmacs is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 SXEmacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* Synched up with: Not in FSF. */
24 #ifndef INCLUDED_redisplay_h_
25 #define INCLUDED_redisplay_h_
27 /* Redisplay DASSERT types */
29 #define DB_DISP_TEXT_LAYOUT 2
30 #define DB_DISP_REDISPLAY 4
32 /* These are the possible return values from pixel_to_glyph_translation. */
33 #define OVER_MODELINE 0
35 #define OVER_OUTSIDE 2
36 #define OVER_NOTHING 3
38 #define OVER_TOOLBAR 5
39 #define OVER_V_DIVIDER 6
43 /* Imagine that the text in the buffer is displayed on a piece of paper
44 the width of the frame and very very tall. The line start cache is
45 an array of struct line_start_cache's, describing the start and
46 end buffer positions for a contiguous set of lines on that piece
49 typedef struct line_start_cache line_start_cache;
50 struct line_start_cache {
56 Dynarr_declare(line_start_cache);
57 } line_start_cache_dynarr;
59 /* The possible types of runes.
61 #### The Lisp_Glyph type is broken. There should instead be a pixmap
62 type. Currently the device-specific output routines have to worry
63 about whether the glyph is textual or not, etc. For Mule this is
64 a big problem because you might need multiple fonts to display the
65 text. It also eliminates optimizations that could come from glumping
66 the text of multiple text glyphs together -- this makes displaying
67 binary files (with lots of control chars, etc.) very very slow. */
79 #define IGNORE_CURSOR 4
81 #define DEFAULT_INDEX (face_index) 0
82 #define MODELINE_INDEX (face_index) 1
84 /* A rune is a single display element, such as a printable character
85 or pixmap. Any single character in a buffer has one or more runes
86 (or zero, if the character is invisible) corresponding to it.
87 (Printable characters typically have one rune associated with them,
88 but control characters have two -- a ^ and a letter -- and other
89 non-printing characters (those displayed in octal) have four. */
91 /* WARNING! In compare_runes (one of the most heavily used functions)
92 two runes are compared. So please be careful with changes to this
93 structure. See comments in compare_runes.
95 #### This should really be made smaller.
98 typedef struct rune rune;
100 face_index findex; /* face rune is displayed with. The
101 face_index is an index into a
102 window-specific array of face cache
103 elements. Each face cache element
104 corresponds to one "merged face"
105 (the result of merging all the
106 faces that overlap the rune) and
107 contains the instance values for
108 each of the face properties in this
109 particular window. */
111 Bufpos bufpos; /* buffer position this rune is displaying;
112 for the modeline, the value here is a
113 Charcount, but who's looking? */
114 Bufpos endpos; /* if set this rune covers a range of pos */
115 /* #### Chuck, what does it mean for a rune
116 to cover a range of pos? I don't get
118 /* #### This isn't used as an rvalue anywhere!
121 short xpos; /* horizontal starting position in pixels */
122 short width; /* pixel width of rune */
124 unsigned char cursor_type; /* is this rune covered by the cursor? */
125 unsigned char type; /* type of rune object */
126 /* We used to do bitfields here, but if I
127 (JV) count correctly that doesn't matter
128 for the size of the structure. All the bit
129 fiddling _does_ slow down redisplay by
130 about 10%. So don't do that */
132 union { /* Information specific to the type of rune */
133 /* #### Glyphs are rare. Is it really necessary to waste 8 bytes on every
138 Lisp_Object extent; /* extent rune is attached to, if any.
139 If this is a rune in the modeline
140 then this might be nil. */
142 int ascent; /* Ascent of this glyph, in pixels. */
143 int descent; /* Descent of this glyph, in pixels. */
144 int yoffset; /* Offset from line top to reach glyph top */
145 int xoffset; /* Number of pixels that need to be
146 chopped off the left of the glyph.
147 This has the effect of shifting the
148 glyph to the left while still clipping
154 Emchar ch; /* Character of this rune. */
159 short thickness; /* how thick to make hline */
160 short yoffset; /* how far down from top of line to put top */
162 } object; /* actual rune object */
166 Dynarr_declare(rune);
169 /* These must have distinct values. Note that the ordering actually
170 represents priority levels. TEXT has the lowest priority level. */
176 RIGHT_OUTSIDE_MARGIN,
180 /* A display block represents a run of text on a single line.
181 Apparently there is only one display block per line for each
182 of the types listed in `enum display_type'.
184 A display block consists mostly of an array of runes, one per
185 atomic display element (printable character, pixmap, etc.). */
187 /* #### Yuckity yuckity yuck yuck yuck yuck yuck!!
189 Chuck, I think you should redo this. It should not be the
190 responsibility of the device-specific code to worry about
191 the different faces. The generic stuff in redisplay-output.c
192 should glump things up into sub-blocks, each of which
193 corresponds to a single pixmap or a single run of text in
196 It might still make sense for the device-specific output routine
197 to get passed an entire display line. That way, it can make
198 calls to XDrawText() (which draws multiple runs of single-font
199 data) instead of XDrawString(). The reason for this is to
200 reduce the amount of X traffic, which will help things significantly
203 typedef struct display_block display_block;
204 struct display_block {
205 enum display_type type; /* type of display block */
207 int start_pos; /* starting pixel position of block */
208 int end_pos; /* ending pixel position of block */
210 rune_dynarr *runes; /* Dynamic array of runes */
214 Dynarr_declare(display_block);
215 } display_block_dynarr;
217 typedef struct layout_bounds_type {
226 typedef struct glyph_block glyph_block;
231 face_index findex; /* Only used by margin routines. */
232 int active; /* For begin/end glyph indicates type,
233 otherwise for margin routines. */
234 int width; /* Only used by margin routines. */
238 Dynarr_declare(glyph_block);
239 } glyph_block_dynarr;
241 /*************************************************************************/