annotate src/redisplay-msw.c @ 249:83b3d10dcba9 r20-5b23

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