annotate src/redisplay-msw.c @ 647:b39c14581166

[xemacs-hg @ 2001-08-13 04:45:47 by ben] removal of unsigned, size_t, etc.
author ben
date Mon, 13 Aug 2001 04:46:48 +0000
parents 5fd7ba8b56e7
children 943eaba38521
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* mswindows output and frame manipulation routines.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1994 Lucid, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* Authorship:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 Chuck Thompson
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 Lots of work done by Ben Wing for Mule
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
29
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
30 Partially rewritten for mswindows by Jonathan Harris, November 1997
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
31 for 21.0. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "console-msw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "objects-msw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "buffer.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "debug.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "events.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "faces.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "glyphs-msw.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include "gutter.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #include "sysdep.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #include "mule-ccl.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 #include "mule-charset.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #define MSWINDOWS_EOL_CURSOR_WIDTH 5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 * Random forward declarations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
60 static void mswindows_update_dc (HDC hdc, Lisp_Object fg, Lisp_Object bg,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
61 Lisp_Object bg_pmap);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
62 static void mswindows_set_dc_font (HDC hdc, Lisp_Object font,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
63 int under, int strike);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 static void mswindows_output_vertical_divider (struct window *w, int clear);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 static void mswindows_redraw_exposed_windows (Lisp_Object window, int x,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 int y, int width, int height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 static void mswindows_output_dibitmap (struct frame *f,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
68 Lisp_Image_Instance *p,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 struct display_glyph_area* dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 typedef struct textual_run
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 unsigned char *ptr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 int len;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 int dimension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 } textual_run;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 /* Separate out the text in DYN into a series of textual runs of a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 particular charset. Also convert the characters as necessary into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 the format needed by XDrawImageString(), XDrawImageString16(), et
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 al. (This means converting to one or two byte format, possibly
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 tweaking the high bits, and possibly running a CCL program.) You
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 must pre-allocate the space used and pass it in. (This is done so
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 you can alloca() the space.) You need to allocate (2 * len) bytes
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 of TEXT_STORAGE and (len * sizeof (textual_run)) bytes of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 RUN_STORAGE, where LEN is the length of the dynarr.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 Returns the number of runs actually used. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 separate_textual_runs (unsigned char *text_storage,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 textual_run *run_storage,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
95 const Emchar *str, Charcount len)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Lisp_Object prev_charset = Qunbound; /* not Qnil because that is a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 possible valid charset when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 MULE is not defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 int runs_so_far = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 struct ccl_program char_converter;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 int need_ccl_conversion = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 for (i = 0; i < len; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 Emchar ch = str[i];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 Lisp_Object charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 int byte1, byte2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 int dimension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 int graphic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 BREAKUP_CHAR (ch, charset, byte1, byte2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 dimension = XCHARSET_DIMENSION (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 graphic = XCHARSET_GRAPHIC (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 if (!EQ (charset, prev_charset))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 run_storage[runs_so_far].ptr = text_storage;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 run_storage[runs_so_far].charset = charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 run_storage[runs_so_far].dimension = dimension;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 if (runs_so_far)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 run_storage[runs_so_far - 1].len =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 text_storage - run_storage[runs_so_far - 1].ptr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 if (run_storage[runs_so_far - 1].dimension == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 run_storage[runs_so_far - 1].len >>= 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 runs_so_far++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 prev_charset = charset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 Lisp_Object ccl_prog = XCHARSET_CCL_PROGRAM (charset);
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
137 if ((!NILP (ccl_prog))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
138 && (setup_ccl_program (&char_converter, ccl_prog) >= 0))
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
139 need_ccl_conversion = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 if (graphic == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 byte1 &= 0x7F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 byte2 &= 0x7F;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 else if (graphic == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 byte1 |= 0x80;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 byte2 |= 0x80;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 #ifdef MULE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 if (need_ccl_conversion)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 char_converter.reg[0] = XCHARSET_ID (charset);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 char_converter.reg[1] = byte1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 char_converter.reg[2] = byte2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 char_converter.ic = 0; /* start at beginning each time */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 ccl_driver (&char_converter, 0, 0, 0, 0, CCL_MODE_ENCODING);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 byte1 = char_converter.reg[1];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 byte2 = char_converter.reg[2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 *text_storage++ = (unsigned char) byte1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 if (dimension == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 *text_storage++ = (unsigned char) byte2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 if (runs_so_far)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 run_storage[runs_so_far - 1].len =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 text_storage - run_storage[runs_so_far - 1].ptr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 if (run_storage[runs_so_far - 1].dimension == 2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 run_storage[runs_so_far - 1].len >>= 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 return runs_so_far;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 mswindows_text_width_single_run (HDC hdc, struct face_cachel *cachel,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 textual_run *run)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 Lisp_Object font_inst = FACE_CACHEL_FONT (cachel, run->charset);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
188 Lisp_Font_Instance *fi = XFONT_INSTANCE (font_inst);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 SIZE size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 if (!fi->proportional_p || !hdc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 return (fi->width * run->len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 assert(run->dimension == 1); /* #### FIXME! */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
196 mswindows_set_dc_font (hdc, font_inst,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
197 cachel->underline, cachel->strikethru);
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 444
diff changeset
198 /* !!#### more mule bogosity */
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 444
diff changeset
199 GetTextExtentPoint32 (hdc, (char *) run->ptr, run->len, &size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 return(size.cx);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
204 /*
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
205 * Given F, retrieve device context. F can be a display frame, or
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
206 * a print job. For a print job, page is also started when printer's
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
207 * device context is first time requested.
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
208 */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
209 static HDC
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
210 get_frame_dc (struct frame *f, int start_page_p)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
211 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
212 if (FRAME_MSWINDOWS_P (f))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
213 return FRAME_MSWINDOWS_DC (f);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
214 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
215 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
216 if (start_page_p && !FRAME_MSPRINTER_PAGE_STARTED (f))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
217 msprinter_start_page (f);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
218 return DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
219 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
220 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
221
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
222 /*
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
223 * Given F, retrieve compatible device context. F can be a display
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
224 * frame, or a print job.
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
225 */
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
226 static HDC
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
227 get_frame_compdc (struct frame *f)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
228 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
229 struct device *d = XDEVICE (FRAME_DEVICE (f));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
230 if (DEVICE_MSWINDOWS_P (d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
231 return DEVICE_MSWINDOWS_HCDC (d);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
232 else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
233 return DEVICE_MSPRINTER_HCDC (d);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
234 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 mswindows_update_dc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 Given a number of parameters munge the DC so it has those properties.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
242 mswindows_update_dc (HDC hdc, Lisp_Object fg, Lisp_Object bg,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
243 Lisp_Object bg_pmap)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 if (!NILP (fg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 SetTextColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 (XCOLOR_INSTANCE (fg)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 }
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
250
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 if (!NILP (bg))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 SetBkMode (hdc, OPAQUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 SetBkColor (hdc, COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (bg)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 SetBkMode (hdc, TRANSPARENT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
262 static void mswindows_set_dc_font (HDC hdc, Lisp_Object font,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
263 int under, int strike)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
265 SelectObject(hdc, mswindows_get_hfont (XFONT_INSTANCE (font),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
266 under, strike));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 mswindows_output_hline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 Output a horizontal line in the foreground of its face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 mswindows_output_hline (struct window *w, struct display_line *dl, struct rune *rb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 { /* XXX Implement me */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 mswindows_output_blank
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 Output a blank by clearing the area it covers in the background color
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 of its face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 mswindows_output_blank (struct window *w, struct display_line *dl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 struct rune *rb, int start_pixpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 struct frame *f = XFRAME (w->frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
291 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 RECT rect = { rb->xpos, DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 rb->xpos+rb->width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 DISPLAY_LINE_YEND (dl) };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, rb->findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 Lisp_Object bg_pmap = WINDOW_FACE_CACHEL_BACKGROUND_PIXMAP (w, rb->findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 /* Unmap all subwindows in the area we are going to blank. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 redisplay_unmap_subwindows_maybe (f, rb->xpos, DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 rb->width, DISPLAY_LINE_HEIGHT (dl));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 if (!IMAGE_INSTANCEP (bg_pmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 bg_pmap = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 if (!NILP(bg_pmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 struct display_box db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 struct display_glyph_area dga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 redisplay_calculate_display_boxes (dl, rb->xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 /*rb->object.dglyph.xoffset*/ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 start_pixpos, rb->width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 &db, &dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 /* blank the background in the appropriate color */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
316 mswindows_update_dc (hdc, cachel->foreground,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 cachel->background, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 redisplay_output_pixmap (w, bg_pmap, &db, &dga, rb->findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 0, 0, 0, TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
323 mswindows_update_dc (hdc, Qnil, cachel->background, Qnil);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
324 ExtTextOut (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 mswindows_output_cursor
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 Draw a normal or end-of-line cursor. The end-of-line cursor is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 narrower than the normal cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 mswindows_output_cursor (struct window *w, struct display_line *dl, int xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 int width, face_index findex, Emchar ch, int image_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 struct device *d = XDEVICE (f->device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 struct face_cachel *cachel=0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 Lisp_Object font = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 int focus = EQ (w->frame, DEVICE_FRAME_WITH_FOCUS_REAL (d));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
344 HDC hdc = get_frame_dc (f, 1);
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 593
diff changeset
345 int local_face_index = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 char *p_char = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 int n_char = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 RECT rect = { xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 xpos + width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 DISPLAY_LINE_YEND (dl) };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 Lisp_Object bar = symbol_value_in_buffer (Qbar_cursor,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 WINDOW_BUFFER (w));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 int bar_p = image_p || !NILP (bar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 int cursor_p = !NILP (w->text_cursor_visible_p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 int real_char_p = ch != 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 /* Unmap all subwindows in the area we are going to blank. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 redisplay_unmap_subwindows_maybe (f, xpos, DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 width, DISPLAY_LINE_HEIGHT (dl));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 if (real_char_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 /* Use the font from the underlying character */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 cachel = WINDOW_FACE_CACHEL (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 /* #### MULE: Need to know the charset! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 font = FACE_CACHEL_FONT (cachel, Vcharset_ascii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 if ((focus || bar_p) && real_char_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 p_char = (char*) &ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 n_char = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 if (!image_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 struct face_cachel *color_cachel;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 /* Use cursor fg/bg for block cursor, or character fg/bg for the bar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 or when we need to erase the cursor. Output nothing at eol if bar
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 cursor */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
384 local_face_index = get_builtin_face_cache_index (w, Vtext_cursor_face);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 color_cachel = WINDOW_FACE_CACHEL (w, ((!cursor_p || bar_p) ?
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
386 findex : local_face_index));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
387 mswindows_update_dc (hdc, color_cachel->foreground,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 color_cachel->background, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
389 if (real_char_p)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
390 mswindows_set_dc_font (hdc, font,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
391 cachel->underline, cachel->strikethru);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
392
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 ExtTextOut (hdc, xpos, dl->ypos, ETO_OPAQUE|ETO_CLIPPED, &rect, p_char, n_char, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 if (!cursor_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 if (focus && bar_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 rect.right = rect.left + (EQ (bar, Qt) ? 1 : min (2, width));
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
402 local_face_index = get_builtin_face_cache_index (w, Vtext_cursor_face);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
403 cachel = WINDOW_FACE_CACHEL (w, local_face_index);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
404 mswindows_update_dc (hdc, Qnil, cachel->background, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 ExtTextOut (hdc, xpos, dl->ypos, ETO_OPAQUE, &rect, NULL, 0, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 else if (!focus)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 /* Now have real character drawn in its own color. We deflate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 the rectangle so character cell will be bounded by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 previously drawn cursor shape */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 InflateRect (&rect, -1, -1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 if (real_char_p)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 p_char = (char*) &ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 n_char = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
420 local_face_index = get_builtin_face_cache_index (w, Vdefault_face);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
421 cachel = WINDOW_FACE_CACHEL (w, (real_char_p ? findex : local_face_index));
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
422 mswindows_update_dc (hdc,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
423 cachel->foreground, cachel->background, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 ExtTextOut (hdc, xpos, dl->ypos, ETO_OPAQUE | ETO_CLIPPED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 &rect, p_char, n_char, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 mswindows_output_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 Given a string and a starting position, output that string in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 given face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 Correctly handles multiple charsets in the string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 The meaning of the parameters is something like this:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 W Window that the text is to be displayed in.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 DL Display line that this text is on. The values in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 structure are used to determine the vertical position and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 clipping range of the text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 BUF Dynamic array of Emchars specifying what is actually to be
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 drawn.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 XPOS X position in pixels where the text should start being drawn.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 XOFFSET Number of pixels to be chopped off the left side of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 text. The effect is as if the text were shifted to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 left this many pixels and clipped at XPOS.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 CLIP_START Clip everything left of this X position.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 WIDTH Clip everything right of XPOS + WIDTH.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 FINDEX Index for the face cache element describing how to display
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 the text.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 ****************************************************************************/
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
454 static void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 mswindows_output_string (struct window *w, struct display_line *dl,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 Emchar_dynarr *buf, int xpos, int xoffset, int clip_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 int width, face_index findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 int cursor, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 /* struct device *d = XDEVICE (f->device);*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 Lisp_Object window;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
464 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 int clip_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 Lisp_Object bg_pmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 int len = Dynarr_length (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 textual_run *runs = alloca_array (textual_run, len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 int nruns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 int i, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 RECT rect;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 struct face_cachel *cachel = WINDOW_FACE_CACHEL (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 #if 0 /* #### FIXME? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 /* We can't work out the width before we've set the font in the DC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 if (width < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 width = mswindows_text_width (cachel, Dynarr_atp (buf, 0), Dynarr_length (buf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 assert(width>=0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 /* Regularize the variables passed in. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 if (clip_start < xpos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 clip_start = xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 clip_end = xpos + width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 if (clip_start >= clip_end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 /* It's all clipped out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 xpos -= xoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 /* sort out the destination rectangle */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 height = DISPLAY_LINE_HEIGHT (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 rect.left = clip_start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 rect.top = DISPLAY_LINE_YPOS (dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 rect.right = clip_end;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 rect.bottom = rect.top + height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 /* make sure the area we are about to display is subwindow free. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 redisplay_unmap_subwindows_maybe (f, clip_start, DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 clip_end - clip_start, DISPLAY_LINE_HEIGHT (dl));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 /* output the background pixmap if there is one */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 bg_pmap = cachel->background_pixmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 if (!IMAGE_INSTANCEP (bg_pmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 || !IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (bg_pmap)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 bg_pmap = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512 if (!NILP(bg_pmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 struct display_box db;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 struct display_glyph_area dga;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 redisplay_calculate_display_boxes (dl, xpos + xoffset, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 clip_start, width, &db, &dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 /* blank the background in the appropriate color */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
519 mswindows_update_dc (hdc,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
520 cachel->foreground, cachel->background, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 redisplay_output_pixmap (w, bg_pmap, &db, &dga, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 0, 0, 0, TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 /* output pixmap calls this so we have to recall to get correct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 references */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 cachel = WINDOW_FACE_CACHEL (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 nruns = separate_textual_runs (text_storage, runs, Dynarr_atp (buf, 0),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 Dynarr_length (buf));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 for (i = 0; i < nruns; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 Lisp_Object font = FACE_CACHEL_FONT (cachel, runs[i].charset);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
534 Lisp_Font_Instance *fi = XFONT_INSTANCE (font);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 int this_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 if (EQ (font, Vthe_null_font_instance))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
540 mswindows_update_dc (hdc, cachel->foreground,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 NILP(bg_pmap) ? cachel->background : Qnil, Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
542 mswindows_set_dc_font (hdc, font, cachel->underline, cachel->strikethru);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 this_width = mswindows_text_width_single_run (hdc, cachel, runs + i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 /* cope with fonts taller than lines */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 if ((int) fi->height < (int) (height + dl->clip + dl->top_clip))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 int clear_start = max (xpos, clip_start);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 int clear_end = min (xpos + this_width, clip_end);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 redisplay_clear_region (window, findex, clear_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 clear_end - clear_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 /* output pixmap calls this so we have to recall to get correct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 references */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 cachel = WINDOW_FACE_CACHEL (w, findex);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 assert (runs[i].dimension == 1); /* #### FIXME: Broken when Mule? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 ExtTextOut (hdc, xpos, dl->ypos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 NILP(bg_pmap) ? ETO_CLIPPED | ETO_OPAQUE : ETO_CLIPPED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 &rect, (char *) runs[i].ptr, runs[i].len, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 xpos += this_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
573 mswindows_output_dibitmap (struct frame *f, Lisp_Image_Instance *p,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 struct display_box* db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 struct display_glyph_area* dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
577 HDC hdc = get_frame_dc (f, 1);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
578 HDC hcompdc = get_frame_compdc (f);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 HGDIOBJ old=NULL;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
580 const int real_x = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
581 const int real_y = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
582 const int surface_x = IMAGE_INSTANCE_PIXMAP_WIDTH (p);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
583 const int surface_y = IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
585 /* first blit the mask */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
588 RGBQUAD bg;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
589 COLORREF bgcolor;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
591 old = SelectObject (hcompdc, IMAGE_INSTANCE_MSWINDOWS_MASK (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
593 if (IMAGE_INSTANCE_TYPE (p) == IMAGE_MONO_PIXMAP)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
594 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
595 COLORREF fgcolor;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
596 RGBQUAD fg;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
597
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
598 fgcolor = GetTextColor (hdc);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
599 fg.rgbBlue = GetBValue (fgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
600 fg.rgbRed = GetRValue (fgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
601 fg.rgbGreen = GetGValue (fgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
602 fg.rgbReserved = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
603 SetDIBColorTable (hcompdc, 0, 1, &fg);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
604 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
606 bgcolor = GetBkColor (hdc);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
607 bg.rgbBlue = GetBValue (bgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
608 bg.rgbRed = GetRValue (bgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
609 bg.rgbGreen = GetGValue (bgcolor);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
610 bg.rgbReserved = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
611 SetDIBColorTable (hcompdc, 1, 1, &bg);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
612
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
613 StretchBlt (hdc,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
614 db->xpos, db->ypos,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
615 dga->width, dga->height,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
616 hcompdc,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
617 MulDiv (dga->xoffset, real_x, surface_x),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
618 MulDiv (dga->yoffset, real_y, surface_y),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
619 MulDiv (dga->width, real_x, surface_x),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
620 MulDiv (dga->height, real_y, surface_y),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
621 SRCCOPY);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
623 SelectObject (hcompdc, old);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
626 /* Now blit the bitmap itself, or one of its slices. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
627 old = SelectObject (hcompdc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 (p, IMAGE_INSTANCE_PIXMAP_SLICE (p)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 StretchBlt (hdc,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
632 db->xpos, db->ypos,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
633 dga->width, dga->height,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
634 hcompdc,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
635 MulDiv (dga->xoffset, real_x, surface_x),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
636 MulDiv (dga->yoffset, real_y, surface_y),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
637 MulDiv (dga->width, real_x, surface_x),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
638 MulDiv (dga->height, real_y, surface_y),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 IMAGE_INSTANCE_MSWINDOWS_MASK (p) ? SRCINVERT : SRCCOPY);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
641 SelectObject (hcompdc, old);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 /* X gc's have this nice property that setting the bg pixmap will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 * output it offset relative to the window. Windows doesn't have this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 * feature so we have to emulate this by outputting multiple pixmaps.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647 * This is only used for background pixmaps. Normal pixmaps are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 * outputted once and are scrollable */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 mswindows_output_dibitmap_region (struct frame *f,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
651 Lisp_Image_Instance *p,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 struct display_box *db,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 struct display_glyph_area *dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 struct display_box xdb = { db->xpos, db->ypos, db->width, db->height };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 struct display_glyph_area xdga
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 = { 0, 0, IMAGE_INSTANCE_PIXMAP_WIDTH (p),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 IMAGE_INSTANCE_PIXMAP_HEIGHT (p) };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 int pxoffset = 0, pyoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 if (dga)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 xdga.width = dga->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 xdga.height = dga->height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 else if (!redisplay_normalize_glyph_area (&xdb, &xdga))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 /* when doing a bg pixmap do a partial pixmap first so that we
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 blt whole pixmaps thereafter */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 xdga.height = min (xdga.height, IMAGE_INSTANCE_PIXMAP_HEIGHT (p) -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 db->ypos % IMAGE_INSTANCE_PIXMAP_HEIGHT (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 while (xdga.height > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
676 xdga.width = min (min (db->width, IMAGE_INSTANCE_PIXMAP_WIDTH (p)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
677 IMAGE_INSTANCE_PIXMAP_WIDTH (p) -
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 db->xpos % IMAGE_INSTANCE_PIXMAP_WIDTH (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 pxoffset = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 while (xdga.width > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 xdb.xpos = db->xpos + pxoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 xdb.ypos = db->ypos + pyoffset;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 /* do we need to offset the pixmap vertically? this is necessary
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
685 for background pixmaps. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
686 xdga.yoffset = xdb.ypos % IMAGE_INSTANCE_PIXMAP_HEIGHT (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
687 xdga.xoffset = xdb.xpos % IMAGE_INSTANCE_PIXMAP_WIDTH (p);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
688 /* the width is handled by mswindows_output_pixmap_region */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
689 mswindows_output_dibitmap (f, p, &xdb, &xdga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
690 pxoffset += xdga.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
691 xdga.width = min ((db->width - pxoffset),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
692 IMAGE_INSTANCE_PIXMAP_WIDTH (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
694 pyoffset += xdga.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
695 xdga.height = min ((db->height - pyoffset),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 IMAGE_INSTANCE_PIXMAP_HEIGHT (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700 /* Output a pixmap at the desired location.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 DB normalized display_box.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 DGA normalized display_glyph_area. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
703 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 mswindows_output_pixmap (struct window *w, Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 struct display_box *db, struct display_glyph_area *dga,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 face_index findex, int cursor_start, int cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 int cursor_height, int bg_pixmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 struct frame *f = XFRAME (w->frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
710 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
712 Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 /* Output the pixmap. Have to do this as many times as is required
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 to fill the given area */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
719 mswindows_update_dc (hdc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 WINDOW_FACE_CACHEL_FOREGROUND (w, findex),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 WINDOW_FACE_CACHEL_BACKGROUND (w, findex), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 if (bg_pixmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 mswindows_output_dibitmap_region (f, p, db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726 mswindows_output_dibitmap (f, p, db, dga);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
730 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 * This function paints window's deadbox, a rectangle between window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 * borders and two short edges of both scrollbars.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
734 * Function checks whether deadbox intersects with the rectangle pointed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 * to by PRC, and paints only the intersection
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
738 mswindows_redisplay_deadbox_maybe (struct window *w, const RECT* prc)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 int sbh = window_scrollbar_height (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 int sbw = window_scrollbar_width (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 RECT rect_dead, rect_paint;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 if (sbh == 0 || sbw == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
744 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 if (!NILP (w->scrollbar_on_left_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 rect_dead.left = WINDOW_LEFT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 rect_dead.left = WINDOW_TEXT_RIGHT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
750 rect_dead.right = rect_dead.left + sbw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 if (!NILP (w->scrollbar_on_top_p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 rect_dead.top = WINDOW_TOP (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 rect_dead.top = WINDOW_TEXT_BOTTOM (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 rect_dead.bottom = rect_dead.top + sbh;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 if (IntersectRect (&rect_paint, &rect_dead, prc))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
759 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 struct frame *f = XFRAME (WINDOW_FRAME (w));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
761 FillRect (get_frame_dc (f, 1), &rect_paint,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 (HBRUSH) (COLOR_BTNFACE+1));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 #endif /* HAVE_SCROLLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 mswindows_redraw_exposed_window
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771 Given a bounding box for an area that needs to be redrawn, determine
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
772 what parts of what lines are contained within and re-output their
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 contents.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
774 Copied from redisplay-x.c
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
775 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 mswindows_redraw_exposed_window (struct window *w, int x, int y, int width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 int line;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 int orig_windows_structure_changed;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 RECT rect_window = { WINDOW_LEFT (w), WINDOW_TOP (w),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 WINDOW_RIGHT (w), WINDOW_BOTTOM (w) };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 RECT rect_expose = { x, y, x + width, y + height };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 RECT rect_draw;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 display_line_dynarr *cdla = window_display_lines (w, CURRENT_DISP);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 if (!NILP (w->vchild))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 mswindows_redraw_exposed_windows (w->vchild, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 else if (!NILP (w->hchild))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 mswindows_redraw_exposed_windows (w->hchild, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 /* If the window doesn't intersect the exposed region, we're done here. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 if (!IntersectRect (&rect_draw, &rect_window, &rect_expose))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 /* We do this to make sure that the 3D modelines get redrawn if
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 they are in the exposed region. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 orig_windows_structure_changed = f->windows_structure_changed;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 f->windows_structure_changed = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 if (window_needs_vertical_divider (w))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812 mswindows_output_vertical_divider (w, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 for (line = 0; line < Dynarr_length (cdla); line++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 struct display_line *cdl = Dynarr_atp (cdla, line);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 if (DISPLAY_LINE_YPOS (cdl) + DISPLAY_LINE_HEIGHT (cdl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 >= rect_draw.top)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 if (DISPLAY_LINE_YPOS (cdl) > rect_draw.bottom)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 if (line == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 output_display_line (w, 0, cdla, line,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 rect_draw.left, rect_draw.right);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 f->windows_structure_changed = orig_windows_structure_changed;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 /* If there have never been any face cache_elements created, then this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 expose event doesn't actually have anything to do. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841 if (Dynarr_largest (w->face_cachels))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 redisplay_clear_bottom_of_window (w, cdla, rect_draw.top, rect_draw.bottom);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 mswindows_redisplay_deadbox_maybe (w, &rect_expose);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 mswindows_redraw_exposed_windows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 For each window beneath the given window in the window hierarchy,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 ensure that it is redrawn if necessary after an Expose event.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 mswindows_redraw_exposed_windows (Lisp_Object window, int x, int y, int width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 for (; !NILP (window); window = XWINDOW (window)->next)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 mswindows_redraw_exposed_window (XWINDOW (window), x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 mswindows_redraw_exposed_area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 For each window on the given frame, ensure that any area in the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 Exposed area is redrawn.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 mswindows_redraw_exposed_area (struct frame *f, int x, int y, int width, int height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
871 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 /* If any window on the frame has had its face cache reset then the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 redisplay structures are effectively invalid. If we attempt to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 use them we'll blow up. We mark the frame as changed to ensure
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 that redisplay will do a full update. This probably isn't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 necessary but it can't hurt. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 /* #### We would rather put these off as well but there is currently
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 no combination of flags which will force an unchanged toolbar to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 redraw anyhow. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 MAYBE_FRAMEMETH (f, redraw_exposed_toolbars, (f, x, y, width, height));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 redraw_exposed_gutters (f, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 if (!f->window_face_cache_reset)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 mswindows_redraw_exposed_windows (f->root_window, x, y, width, height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 GdiFlush();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 MARK_FRAME_CHANGED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
894
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
896 mswindows_bevel_area
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 Draw a 3d border around the specified area on window W.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 mswindows_bevel_area (struct window *w, face_index findex, int x, int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 int width, int height, int thickness,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 int edges, enum edge_style style)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
905 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
906 UINT edge;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 UINT border = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 if (style == EDGE_ETCHED_IN)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 edge = EDGE_ETCHED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
911 else if (style == EDGE_ETCHED_OUT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 edge = EDGE_BUMP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 else if (style == EDGE_BEVEL_IN)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 if (thickness == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 edge = BDR_SUNKENINNER;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 edge = EDGE_SUNKEN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 else /* EDGE_BEVEL_OUT */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
921 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
922 if (thickness == 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 edge = BDR_RAISEDINNER;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
924 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
925 edge = EDGE_RAISED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
926 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
927
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 if (edges & EDGE_TOP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 border |= BF_TOP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 if (edges & EDGE_LEFT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
931 border |= BF_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
932 if (edges & EDGE_BOTTOM)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
933 border |= BF_BOTTOM;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
934 if (edges & EDGE_RIGHT)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935 border |= BF_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 RECT rect = { x, y, x + width, y + height };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 Lisp_Object color = WINDOW_FACE_CACHEL_BACKGROUND (w, findex);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
940 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
942 mswindows_update_dc (hdc, Qnil, color, Qnil);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
943 DrawEdge (hdc, &rect, edge, border);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 Display methods
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 *****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 mswindows_divider_height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 Return the height of the horizontal divider.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 mswindows_divider_height (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 return 1; /* XXX Copied from redisplay-X.c. What is this? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
964 mswindows_eol_cursor_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
965
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
966 Return the width of the end-of-line cursor.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
967 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
969 mswindows_eol_cursor_width (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 return MSWINDOWS_EOL_CURSOR_WIDTH;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 /*****************************************************************************
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
975 mswindows_frame_output_begin
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 Perform any necessary initialization prior to an update.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
979 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
980 mswindows_frame_output_begin (struct frame *f)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
982 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 /*****************************************************************************
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
985 mswindows_frame_output_end
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 Perform any necessary flushing of queues when an update has completed.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
990 mswindows_frame_output_end (struct frame *f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
991 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
992 #ifdef DEFER_WINDOW_POS
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
993 HDWP hdwp = FRAME_MSWINDOWS_DATA (f)->hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
994
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
995 if (hdwp != 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
996 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
997 EndDeferWindowPos (hdwp);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
998 FRAME_MSWINDOWS_DATA (f)->hdwp = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
999 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1000 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1001 GdiFlush();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1002 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1003
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1004 /* Printer version is more lightweight. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1005 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1006 msprinter_frame_output_end (struct frame *f)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 GdiFlush();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 mswindows_flash (struct device *d)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1014 struct frame *f = device_selected_frame (d);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1015 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 RECT rc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 GetClientRect (FRAME_MSWINDOWS_HANDLE (f), &rc);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1019 InvertRect (hdc, &rc);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 GdiFlush ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 Sleep (25);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1022 InvertRect (hdc, &rc);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1026
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1027 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 mswindows_ring_bell (struct device *d, int volume, int pitch, int duration)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 /* Beep does not work at all, anyways! -kkm */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 MessageBeep (MB_OK);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 mswindows_output_display_block
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 Given a display line, a block number for that start line, output all
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038 runes between start and end in the specified display block.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 Ripped off with minimal thought from the corresponding X routine.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 mswindows_output_display_block (struct window *w, struct display_line *dl, int block,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 int start, int end, int start_pixpos, int cursor_start,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044 int cursor_width, int cursor_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 struct frame *f = XFRAME (w->frame);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 Emchar_dynarr *buf = Dynarr_new (Emchar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 Lisp_Object window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 rune_dynarr *rba = db->runes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 struct rune *rb;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 int elt = start;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 face_index findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 int xpos, width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 Lisp_Object charset = Qunbound; /* Qnil is a valid charset when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 MULE is not defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 rb = Dynarr_atp (rba, start);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 if (!rb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 /* Nothing to do so don't do anything. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1064 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 findex = rb->findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 xpos = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 if (rb->type == RUNE_CHAR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 charset = CHAR_CHARSET (rb->object.chr.ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 if (end < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 end = Dynarr_length (rba);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 while (elt < end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 rb = Dynarr_atp (rba, elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1079
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 if (rb->findex == findex && rb->type == RUNE_CHAR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081 && rb->object.chr.ch != '\n' && rb->cursor_type != CURSOR_ON
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 && EQ (charset, CHAR_CHARSET (rb->object.chr.ch)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 Dynarr_add (buf, rb->object.chr.ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 width += rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1087 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1089 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 if (Dynarr_length (buf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 mswindows_output_string (w, dl, buf, xpos, 0, start_pixpos, width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 findex, 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 xpos = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095 width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1096 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 width = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 if (rb->type == RUNE_CHAR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 findex = rb->findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 xpos = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 charset = CHAR_CHARSET (rb->object.chr.ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 if (rb->cursor_type == CURSOR_ON)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 if (rb->object.chr.ch == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 mswindows_output_cursor (w, dl, xpos, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 findex, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 Dynarr_add (buf, rb->object.chr.ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 mswindows_output_cursor (w, dl, xpos, cursor_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 findex, rb->object.chr.ch, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 Dynarr_reset (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 xpos += rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 else if (rb->object.chr.ch == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 /* Clear in case a cursor was formerly here. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 redisplay_clear_region (window, findex, xpos,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 DISPLAY_LINE_YPOS (dl),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 rb->width, DISPLAY_LINE_HEIGHT (dl));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 if (rb->type == RUNE_BLANK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 mswindows_output_blank (w, dl, rb, start_pixpos);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 /* #### Our flagging of when we need to redraw the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 modeline shadows sucks. Since RUNE_HLINE is only used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 by the modeline at the moment it is a good bet
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 that if it gets redrawn then we should also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 redraw the shadows. This won't be true forever.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 We borrow the shadow_thickness_changed flag for
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 now. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 w->shadow_thickness_changed = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 mswindows_output_hline (w, dl, rb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 if (rb->cursor_type == CURSOR_ON)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 mswindows_output_cursor (w, dl, xpos, cursor_width, rb->findex, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 if (elt < end)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 rb = Dynarr_atp (rba, elt);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 findex = rb->findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 xpos = rb->xpos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 else if (rb->type == RUNE_DGLYPH)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 Lisp_Object instance;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1165 struct display_box dbox;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 struct display_glyph_area dga;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1167
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 redisplay_calculate_display_boxes (dl, rb->xpos, rb->object.dglyph.xoffset,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 start_pixpos, rb->width,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1170 &dbox, &dga);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 XSETWINDOW (window, w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1173 instance = glyph_image_instance (rb->object.dglyph.glyph,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1174 window, ERROR_ME_NOT, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1175 findex = rb->findex;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1177 if (IMAGE_INSTANCEP (instance))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1178 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1179 switch (XIMAGE_INSTANCE_TYPE (instance))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1181 case IMAGE_MONO_PIXMAP:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1182 case IMAGE_COLOR_PIXMAP:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1183 redisplay_output_pixmap (w, instance, &dbox, &dga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1184 cursor_start, cursor_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1185 cursor_height, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 if (rb->cursor_type == CURSOR_ON)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 mswindows_output_cursor (w, dl, xpos, cursor_width,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1188 findex, 0, 1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1189 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1190
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1191 case IMAGE_WIDGET:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1192 if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1193 Qlayout))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1194 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1195 redisplay_output_layout (window, instance, &dbox, &dga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1196 cursor_start, cursor_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1197 cursor_height);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1198 if (rb->cursor_type == CURSOR_ON)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1199 mswindows_output_cursor (w, dl, xpos, cursor_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1200 findex, 0, 1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1201 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1202 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1203 case IMAGE_SUBWINDOW:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1204 redisplay_output_subwindow (w, instance, &dbox, &dga, findex,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1205 cursor_start, cursor_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1206 cursor_height);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1207 if (rb->cursor_type == CURSOR_ON)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1208 mswindows_output_cursor (w, dl, xpos, cursor_width,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1209 findex, 0, 1);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1210 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1211
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1212 case IMAGE_NOTHING:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1213 /* nothing is as nothing does */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1214 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1216 case IMAGE_TEXT:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1217 case IMAGE_POINTER:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1218 default:
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1219 abort ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1220 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1221 IMAGE_INSTANCE_OPTIMIZE_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1222 (XIMAGE_INSTANCE (instance)) = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1223 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224 xpos += rb->width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 elt++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1226 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1227 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1231
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 if (Dynarr_length (buf))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 mswindows_output_string (w, dl, buf, xpos, 0, start_pixpos, width, findex,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234 0, 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 if (dl->modeline
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 && !EQ (Qzero, w->modeline_shadow_thickness)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1238 && (f->clear
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1239 || f->windows_structure_changed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1240 || w->shadow_thickness_changed))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1241 bevel_modeline (w, dl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1243 Dynarr_free (buf);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 /*****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1248 mswindows_output_vertical_divider
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 Draw a vertical divider down the right side of the given window.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1251 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 mswindows_output_vertical_divider (struct window *w, int clear_unused)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1255 struct frame *f = XFRAME (w->frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1256 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1257 RECT rect;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 int spacing = XINT (w->vertical_divider_spacing);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1259 int shadow = XINT (w->vertical_divider_shadow_thickness);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1260 int abs_shadow = abs (shadow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1261 int line_width = XINT (w->vertical_divider_line_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1262 int div_left = WINDOW_RIGHT (w) - window_divider_width (w);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1263 int y1 = WINDOW_TOP (w);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1264 int y2 = WINDOW_BOTTOM (w);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 /* Clear left and right spacing areas */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267 if (spacing)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269 rect.top = y1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 rect.bottom = y2;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1271 mswindows_update_dc (hdc, Qnil,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 WINDOW_FACE_CACHEL_BACKGROUND (w, DEFAULT_INDEX), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 rect.right = WINDOW_RIGHT (w);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 rect.left = rect.right - spacing;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1275 ExtTextOut (hdc, 0, 0, ETO_OPAQUE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 &rect, NULL, 0, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 rect.left = div_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 rect.right = div_left + spacing;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1279 ExtTextOut (hdc, 0, 0, ETO_OPAQUE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 &rect, NULL, 0, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 /* Clear divider face */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 rect.top = y1 + abs_shadow;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 rect.bottom = y2 - abs_shadow;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 rect.left = div_left + spacing + abs_shadow;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 rect.right = rect.left + line_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 if (rect.left < rect.right)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 face_index div_face
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 = get_builtin_face_cache_index (w, Vvertical_divider_face);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1292 mswindows_update_dc (hdc, Qnil,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 WINDOW_FACE_CACHEL_BACKGROUND (w, div_face), Qnil);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1294 ExtTextOut (hdc, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 /* Draw a shadow around the divider */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 if (shadow != 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 /* #### This will be fixed to support arbitrary thickness */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 InflateRect (&rect, abs_shadow, abs_shadow);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1302 DrawEdge (hdc, &rect,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 shadow > 0 ? EDGE_RAISED : EDGE_SUNKEN, BF_RECT);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 mswindows_text_width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1309
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 Given a string and a face, return the string's length in pixels when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 displayed in the font associated with the face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 mswindows_text_width (struct frame *f, struct face_cachel *cachel,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1315 const Emchar *str, Charcount len)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1317 HDC hdc = get_frame_dc (f, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318 int width_so_far = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 unsigned char *text_storage = (unsigned char *) alloca (2 * len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 textual_run *runs = alloca_array (textual_run, len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 int nruns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 nruns = separate_textual_runs (text_storage, runs, str, len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1326 for (i = 0; i < nruns; i++)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1327 width_so_far += mswindows_text_width_single_run (hdc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1328 cachel, runs + i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 return width_so_far;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 /****************************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 mswindows_clear_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1337 Clear the area in the box defined by the given parameters using the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338 given face.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 ****************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 mswindows_clear_region (Lisp_Object locale, struct device* d, struct frame* f,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 face_index findex, int x, int y,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 Lisp_Object background_pixmap)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1345 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 RECT rect = { x, y, x+width, y+height };
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1347 HDC hdc = get_frame_dc (f, 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 if (!NILP (background_pixmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 struct display_box db = { x, y, width, height };
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1352 mswindows_update_dc (hdc,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1353 fcolor, bcolor, background_pixmap);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 mswindows_output_dibitmap_region
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 ( f, XIMAGE_INSTANCE (background_pixmap), &db, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1359 mswindows_update_dc (hdc, Qnil, fcolor, Qnil);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1360 ExtTextOut (hdc, 0, 0, ETO_OPAQUE,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 &rect, NULL, 0, NULL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1364 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 if (WINDOWP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 mswindows_redisplay_deadbox_maybe (XWINDOW (locale), &rect);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 /* XXX Implement me! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 mswindows_clear_frame (struct frame *f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374 GdiFlush();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 console_type_create_redisplay_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1386 /* redisplay methods - display*/
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1387 CONSOLE_HAS_METHOD (mswindows, text_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1388 CONSOLE_HAS_METHOD (mswindows, output_display_block);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1389 CONSOLE_HAS_METHOD (mswindows, divider_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 CONSOLE_HAS_METHOD (mswindows, eol_cursor_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 CONSOLE_HAS_METHOD (mswindows, output_vertical_divider);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 CONSOLE_HAS_METHOD (mswindows, clear_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 CONSOLE_HAS_METHOD (mswindows, clear_frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1394 CONSOLE_HAS_METHOD (mswindows, frame_output_begin);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1395 CONSOLE_HAS_METHOD (mswindows, frame_output_end);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 CONSOLE_HAS_METHOD (mswindows, flash);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 CONSOLE_HAS_METHOD (mswindows, ring_bell);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 CONSOLE_HAS_METHOD (mswindows, bevel_area);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 CONSOLE_HAS_METHOD (mswindows, output_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 CONSOLE_HAS_METHOD (mswindows, output_pixmap);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1401
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1402 /* redisplay methods - printer */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1403 CONSOLE_HAS_METHOD (msprinter, frame_output_end);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1404 CONSOLE_INHERITS_METHOD (msprinter, mswindows, text_width);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1405 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_display_block);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1406 CONSOLE_INHERITS_METHOD (msprinter, mswindows, divider_height);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1407 CONSOLE_INHERITS_METHOD (msprinter, mswindows, eol_cursor_width);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1408 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_vertical_divider);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1409 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_region);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1410 CONSOLE_INHERITS_METHOD (msprinter, mswindows, clear_frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1411 CONSOLE_INHERITS_METHOD (msprinter, mswindows, frame_output_begin);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1412 CONSOLE_INHERITS_METHOD (msprinter, mswindows, bevel_area);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1413 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_string);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
1414 CONSOLE_INHERITS_METHOD (msprinter, mswindows, output_pixmap);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 }