annotate src/redisplay-msw.c @ 442:abe6d1db359e r21-2-36

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