annotate src/redisplay-msw.c @ 771:943eaba38521

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