annotate src/redisplay-msw.c @ 398:74fd4e045ea6 r21-2-29

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