annotate src/glyphs-msw.c @ 5934:e2fae7783046 cygwin

lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
author Henry Thompson <ht@markup.co.uk>
date Sat, 12 Dec 2015 19:08:46 +0000
parents 68639fb08af8
children 574f0cded429
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-specific glyph objects.
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2 Copyright (C) 1998, 1999, 2000 Andy Piper.
2959
4eb2a8c07cb3 [xemacs-hg @ 2005-09-27 05:48:22 by ben]
ben
parents: 2500
diff changeset
3 Copyright (C) 2001, 2002, 2003, 2004, 2005 Ben Wing.
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
4
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5192
diff changeset
7 XEmacs is free software: you can redistribute it and/or modify it
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5192
diff changeset
9 Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5192
diff changeset
10 option) any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 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
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5192
diff changeset
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
22 /* This file apparently Mule-ized, 8-7-2000, but could stand review. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
23
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
24 /* written by Andy Piper <andy@xemacs.org> plagiarising bits from
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 glyphs-x.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
27 #define NEED_MSWINDOWS_COMMCTRL
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
28
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "lisp.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
31
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
32 #include "device-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
33 #include "elhash.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
34 #include "faces.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
35 #include "file-coding.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
36 #include "frame-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
37 #include "gui.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
38 #include "imgproc.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
39 #include "insdel.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "lstream.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
41 #include "opaque.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
42 #include "sysdep.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
43 #include "sysfile.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
44 #include "window.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
46 #include "console-msw-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 #include "glyphs-msw.h"
5176
8b2f75cecb89 rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents: 5047
diff changeset
48 #include "fontcolor-msw-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #define WIDGET_GLYPH_SLOT 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 DECLARE_IMAGE_INSTANTIATOR_FORMAT (string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 #ifdef HAVE_JPEG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 #ifdef HAVE_TIFF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
61 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 #ifdef HAVE_PNG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 DECLARE_IMAGE_INSTANTIATOR_FORMAT (png);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
64 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #ifdef HAVE_GIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 DECLARE_IMAGE_INSTANTIATOR_FORMAT (gif);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
67 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #ifdef HAVE_XPM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 DEFINE_DEVICE_IIFORMAT (mswindows, xpm);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 DEFINE_DEVICE_IIFORMAT (msprinter, xpm);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 DEFINE_DEVICE_IIFORMAT (mswindows, xbm);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
73 DEFINE_DEVICE_IIFORMAT (msprinter, xbm);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 #ifdef HAVE_XFACE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 DEFINE_DEVICE_IIFORMAT (mswindows, xface);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
76 DEFINE_DEVICE_IIFORMAT (msprinter, xface);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 #endif
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
78 DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
79 DEFINE_DEVICE_IIFORMAT (mswindows, native_layout);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 DEFINE_DEVICE_IIFORMAT (mswindows, button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 DEFINE_DEVICE_IIFORMAT (mswindows, edit_field);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 DEFINE_DEVICE_IIFORMAT (mswindows, subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 DEFINE_DEVICE_IIFORMAT (mswindows, widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 DEFINE_DEVICE_IIFORMAT (mswindows, label);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 DEFINE_DEVICE_IIFORMAT (mswindows, scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 DEFINE_DEVICE_IIFORMAT (mswindows, combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 DEFINE_DEVICE_IIFORMAT (mswindows, progress_gauge);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 DEFINE_DEVICE_IIFORMAT (mswindows, tree_view);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 DEFINE_DEVICE_IIFORMAT (mswindows, tab_control);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 DEFINE_IMAGE_INSTANTIATOR_FORMAT (bmp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 Lisp_Object Qbmp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 Lisp_Object Vmswindows_bitmap_file_path;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 static COLORREF transparent_color = RGB (1,1,1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 DEFINE_IMAGE_INSTANTIATOR_FORMAT (mswindows_resource);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Lisp_Object Qmswindows_resource;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
100 mswindows_initialize_dibitmap_image_instance (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 int slices,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 enum image_instance_type type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 static void
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
104 mswindows_initialize_image_instance_mask (Lisp_Image_Instance *image,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
105 HDC hcdc);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
106
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
107 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
108 * Given device D, retrieve compatible device context. D can be either
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
109 * mswindows or an msprinter device.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
110 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
111 inline static HDC
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
112 get_device_compdc (struct device *d)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
113 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
114 if (DEVICE_MSWINDOWS_P (d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
115 return DEVICE_MSWINDOWS_HCDC (d);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
116 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
117 return DEVICE_MSPRINTER_HCDC (d);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
118 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
119
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
120 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
121 * Initialize image instance pixel sizes in II. For a display bitmap,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
122 * these will be same as real bitmap sizes. For a printer bitmap,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
123 * these will be scaled up so that the bitmap is proportionally enlarged
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
124 * when output to printer. Redisplay code takes care of scaling, to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
125 * conserve memory we do not really scale bitmaps. Set the watermark
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
126 * only here.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
127 * #### Add support for unscalable bitmaps.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
128 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
129 static void init_image_instance_geometry (Lisp_Image_Instance *ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
130 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
131 struct device *d = DOMAIN_XDEVICE (ii->domain);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
132
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
133 if (/* #### Scaleable && */ DEVICE_MSPRINTER_P (d))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
134 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
135 HDC printer_dc = DEVICE_MSPRINTER_HCDC (d);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
136 HDC display_dc = CreateCompatibleDC (NULL);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
137 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
138 MulDiv (IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
139 GetDeviceCaps (printer_dc, LOGPIXELSX),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
140 GetDeviceCaps (display_dc, LOGPIXELSX));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
141 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
142 MulDiv (IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
143 GetDeviceCaps (printer_dc, LOGPIXELSY),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
144 GetDeviceCaps (display_dc, LOGPIXELSY));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #define BPLINE(width) ((int)(~3UL & (unsigned long)((width) +3)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 /* convert from a series of RGB triples to a BITMAPINFO formated for the*/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 /* proper display */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 /************************************************************************/
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
161 static BITMAPINFO *convert_EImage_to_DIBitmap (Lisp_Object device,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 int width, int height,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
163 Binbyte *pic,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 int *bit_count,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
165 Binbyte **bmp_data)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 struct device *d = XDEVICE (device);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
168 int i, j;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
169 RGBQUAD *colortbl;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
170 int ncolors;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
171 BITMAPINFO *bmp_info;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
172 Binbyte *ip, *dp;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
174 if (GetDeviceCaps (get_device_compdc (d), BITSPIXEL) > 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 int bpline = BPLINE(width * 3);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 /* FIXME: we can do this because 24bpp implies no color table, once
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 * we start palettizing this is no longer true. The X versions of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 * this function quantises to 256 colors or bit masks down to a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 * long. Windows can actually handle rgb triples in the raw so I
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 * don't see much point trying to optimize down to the best
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 * structure - unless it has memory / color allocation implications
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 * .... */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
184 bmp_info = xnew_and_zero (BITMAPINFO);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
185
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 if (!bmp_info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
191 bmp_info->bmiHeader.biBitCount = 24; /* just RGB triples for now */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
192 bmp_info->bmiHeader.biCompression = BI_RGB; /* just RGB triples
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
193 for now */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
194 bmp_info->bmiHeader.biSizeImage = width * height * 3;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 /* bitmap data needs to be in blue, green, red triples - in that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 order, eimage is in RGB format so we need to convert */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
198 *bmp_data = xnew_array_and_zero (Binbyte, bpline * height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 *bit_count = bpline * height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 if (!bmp_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
203 xfree (bmp_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 }
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 ip = pic;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 for (i = height-1; i >= 0; i--) {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 dp = (*bmp_data) + (i * bpline);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 for (j = 0; j < width; j++) {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
211 dp[2] = *ip++;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
212 dp[1] = *ip++;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
213 *dp = *ip++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 dp += 3;
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 }
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 else /* scale to 256 colors */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 int rd,gr,bl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 quant_table *qtable;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 int bpline = BPLINE (width * 3);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 /* Quantize the image and get a histogram while we're at it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 Do this first to save memory */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 qtable = build_EImage_quantable(pic, width, height, 256);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 if (qtable == NULL) return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 /* use our quantize table to allocate the colors */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 ncolors = qtable->num_active_colors;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
230 bmp_info = (BITMAPINFO *)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) +
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 sizeof(RGBQUAD) * ncolors);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 if (!bmp_info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
234 xfree (qtable);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
238 colortbl = (RGBQUAD *) (((Binbyte *) bmp_info) +
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
239 sizeof (BITMAPINFOHEADER));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
240
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
241 bmp_info->bmiHeader.biBitCount = 8;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
242 bmp_info->bmiHeader.biCompression = BI_RGB;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
243 bmp_info->bmiHeader.biSizeImage = bpline * height;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
244 bmp_info->bmiHeader.biClrUsed = ncolors;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
245 bmp_info->bmiHeader.biClrImportant = ncolors;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
246
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
247 *bmp_data = xnew_array_and_zero (Binbyte, bpline * height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 *bit_count = bpline * height;
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 if (!*bmp_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
252 xfree (qtable);
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
253 xfree (bmp_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
256
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 /* build up an RGBQUAD colortable */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
258 for (i = 0; i < qtable->num_active_colors; i++)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
259 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
260 colortbl[i].rgbRed = (BYTE) qtable->rm[i];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
261 colortbl[i].rgbGreen = (BYTE) qtable->gm[i];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
262 colortbl[i].rgbBlue = (BYTE) qtable->bm[i];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
263 colortbl[i].rgbReserved = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
264 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 /* now build up the data. picture has to be upside-down and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 back-to-front for msw bitmaps */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 ip = pic;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
269 for (i = height-1; i >= 0; i--)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
270 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
271 dp = (*bmp_data) + (i * bpline);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
272 for (j = 0; j < width; j++)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 rd = *ip++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275 gr = *ip++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 bl = *ip++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 }
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
280 xfree (qtable);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
281 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 /* fix up the standard stuff */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
283 bmp_info->bmiHeader.biWidth = width;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
284 bmp_info->bmiHeader.biHeight = height;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
285 bmp_info->bmiHeader.biPlanes = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
286 bmp_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
287 bmp_info->bmiHeader.biXPelsPerMeter = 0; /* unless you know better */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
288 bmp_info->bmiHeader.biYPelsPerMeter = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 return bmp_info;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /* Given a pixmap filename, look through all of the "standard" places
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 where the file might be located. Return a full pathname if found;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 otherwise, return Qnil. */
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 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 mswindows_locate_pixmap_file (Lisp_Object name)
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 /* This function can GC if IN_REDISPLAY is false */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 Lisp_Object found;
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 /* Check non-absolute pathnames with a directory component relative to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 the search path; that's the way Xt does it. */
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
305 if (IS_DIRECTORY_SEP(string_byte (name, 0)) ||
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
306 (string_byte (name, 0) == '.' &&
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
307 (IS_DIRECTORY_SEP(string_byte (name, 1)) ||
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
308 (string_byte (name, 1) == '.' &&
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
309 (IS_DIRECTORY_SEP(string_byte (name, 2)))))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 if (!NILP (Ffile_readable_p (name)))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
312 return Fexpand_file_name (name, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 if (locate_file (Vmswindows_bitmap_file_path, name, Qnil, &found, R_OK) < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 Lisp_Object temp = list1 (Vdata_directory);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 struct gcpro gcpro1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 GCPRO1 (temp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 locate_file (temp, name, Qnil, &found, R_OK);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 UNGCPRO;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
326
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 return found;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 /* Initialize an image instance from a bitmap
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 DEST_MASK specifies the mask of allowed image types.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 If this fails, signal an error. INSTANTIATOR is only used
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 in the error message. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
339 init_image_instance_from_dibitmap (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 BITMAPINFO *bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 int dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 void *bmp_data,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 int bmp_bits,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 int slices,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
345 Lisp_Object instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346 int x_hot, int y_hot,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 int create_mask)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
349 struct device *d = XDEVICE (IMAGE_INSTANCE_DEVICE (ii));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
350 void *bmp_buf = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
351 enum image_instance_type type;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 HBITMAP bitmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 HDC hdc;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 type = IMAGE_COLOR_PIXMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 else if (dest_mask & IMAGE_POINTER_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 type = IMAGE_POINTER;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
359 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 incompatible_image_types (instantiator, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
362
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
363 hdc = get_device_compdc (d);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
364 bitmap = CreateDIBSection (hdc,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
365 bmp_info,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
366 DIB_RGB_COLORS,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
367 &bmp_buf,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
368 0, 0);
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 if (!bitmap || !bmp_buf)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
371 signal_image_error ("Unable to create bitmap", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 /* copy in the actual bitmap */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 memcpy (bmp_buf, bmp_data, bmp_bits);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 mswindows_initialize_dibitmap_image_instance (ii, slices, type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 find_keyword_in_vector (instantiator, Q_file);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 /* Fixup a set of bitmaps. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = bitmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = NULL;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
385 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
386 bmp_info->bmiHeader.biWidth;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
387 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii) =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
388 bmp_info->bmiHeader.biHeight;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
389 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = bmp_info->bmiHeader.biBitCount;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
390 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = make_fixnum (x_hot);
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
391 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = make_fixnum (y_hot);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
392 init_image_instance_geometry (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 if (create_mask)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
396 mswindows_initialize_image_instance_mask (ii, hdc);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
398
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 if (type == IMAGE_POINTER)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 mswindows_initialize_image_instance_icon(ii, TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
406 image_instance_add_dibitmap (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 BITMAPINFO *bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 void *bmp_data,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 int bmp_bits,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 int slice,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 Lisp_Object instantiator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
413 struct device *d = XDEVICE (IMAGE_INSTANCE_DEVICE (ii));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
414 void *bmp_buf = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
415
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
416 HBITMAP bitmap = CreateDIBSection (get_device_compdc (d),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 DIB_RGB_COLORS,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
419 &bmp_buf,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 0,0);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
421
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 if (!bitmap || !bmp_buf)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
423 signal_image_error ("Unable to create bitmap", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 /* copy in the actual bitmap */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 memcpy (bmp_buf, bmp_data, bmp_bits);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (ii, slice) = bitmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
431 mswindows_init_image_instance_from_eimage (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 int width, int height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 int slices,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
434 Binbyte *eimage,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 int dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 Lisp_Object instantiator,
2959
4eb2a8c07cb3 [xemacs-hg @ 2005-09-27 05:48:22 by ben]
ben
parents: 2500
diff changeset
437 Lisp_Object UNUSED (pointer_fg),
4eb2a8c07cb3 [xemacs-hg @ 2005-09-27 05:48:22 by ben]
ben
parents: 2500
diff changeset
438 Lisp_Object UNUSED (pointer_bg),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
442 BITMAPINFO * bmp_info;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
443 Binbyte * bmp_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 int bmp_bits;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 COLORREF bkcolor;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 int slice;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
447
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
448 CHECK_MSGDI_DEVICE (device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 /* this is a hack but MaskBlt and TransparentBlt are not supported
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 on most windows variants */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
452 bkcolor = COLOR_INSTANCE_MSWINDOWS_COLOR
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 (XCOLOR_INSTANCE (FACE_BACKGROUND (Vdefault_face, domain)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 for (slice = 0; slice < slices; slice++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 /* build a bitmap from the eimage */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
458 if (!(bmp_info = convert_EImage_to_DIBitmap (device, width, height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 eimage + (width * height * 3 * slice),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 &bmp_bits, &bmp_data)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
462 signal_image_error ("EImage to DIBitmap conversion failed",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
463 instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 }
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 /* Now create the pixmap and set up the image instance */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 if (slice == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 bmp_data, bmp_bits, slices, instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 instantiator);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
474
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
475 xfree (bmp_info);
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
476 xfree (bmp_data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
480 inline static void
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
481 set_mono_pixel (Binbyte *bits,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
482 int bpline, int height,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
483 int x, int y, int white)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
484 {
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
485 int i;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
486 Binbyte bitnum;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 /* Find the byte on which this scanline begins */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
488 i = (height - y - 1) * bpline;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 /* Find the byte containing this pixel */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
490 i += (x >> 3);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 /* Which bit is it? */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
492 bitnum = (Binbyte) (7 - (x & 7));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
493 if (white) /* Turn it on */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
494 bits[i] |= (1 << bitnum);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 else /* Turn it off */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
496 bits[i] &= ~(1 << bitnum);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
497 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 static void
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
500 mswindows_initialize_image_instance_mask (Lisp_Image_Instance *image,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
501 HDC hcdc)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 HBITMAP mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 HGDIOBJ old = NULL;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
505 Binbyte *dibits, *and_bits;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
506 BITMAPINFO *bmp_info =
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
507 (BITMAPINFO *) xmalloc_and_zero (sizeof (BITMAPINFO) + sizeof (RGBQUAD));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 int i, j;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
509 int height = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (image);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
510
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
511 int maskbpline = BPLINE ((IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image) + 7) / 8);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
512 int bpline = BPLINE (IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image) * 3);
428
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 if (!bmp_info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
517 bmp_info->bmiHeader.biWidth = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 bmp_info->bmiHeader.biHeight = height;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
519 bmp_info->bmiHeader.biPlanes = 1;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
520 bmp_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
521 bmp_info->bmiHeader.biBitCount = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
522 bmp_info->bmiHeader.biCompression = BI_RGB;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
523 bmp_info->bmiHeader.biClrUsed = 2;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
524 bmp_info->bmiHeader.biClrImportant = 2;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
525 bmp_info->bmiHeader.biSizeImage = height * maskbpline;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 bmp_info->bmiColors[0].rgbRed = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 bmp_info->bmiColors[0].rgbGreen = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 bmp_info->bmiColors[0].rgbBlue = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 bmp_info->bmiColors[0].rgbReserved = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 bmp_info->bmiColors[1].rgbRed = 255;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 bmp_info->bmiColors[1].rgbGreen = 255;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 bmp_info->bmiColors[1].rgbBlue = 255;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 bmp_info->bmiColors[0].rgbReserved = 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
534
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
535 if (!(mask = CreateDIBSection (hcdc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 DIB_RGB_COLORS,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
538 /* The intermediate cast fools gcc into
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
539 not outputting strict-aliasing
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
540 complaints */
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
541 (void **) (void *) &and_bits,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 0,0)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
544 xfree (bmp_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 }
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 old = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (image));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 /* build up an in-memory set of bits to mess with */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 xzero (*bmp_info);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
552 bmp_info->bmiHeader.biWidth = IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 bmp_info->bmiHeader.biHeight = -height;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
554 bmp_info->bmiHeader.biPlanes = 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
555 bmp_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
556 bmp_info->bmiHeader.biBitCount = 24;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
557 bmp_info->bmiHeader.biCompression = BI_RGB;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
558 bmp_info->bmiHeader.biClrUsed = 0;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
559 bmp_info->bmiHeader.biClrImportant = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 bmp_info->bmiHeader.biSizeImage = height * bpline;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
562 dibits = xnew_array_and_zero (Binbyte, bpline * height);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 if (GetDIBits (hcdc,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 dibits,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 DIB_RGB_COLORS) <= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
571 xfree (bmp_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 /* now set the colored bits in the mask and transparent ones to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 black in the original */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
577 for (i = 0; i < IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (image); i++)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
578 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
579 for (j = 0; j < height; j++)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
580 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
581 Binbyte *idx = &dibits[j * bpline + i * 3];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
583 if (RGB (idx[2], idx[1], idx[0]) == transparent_color)
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
584 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 idx[0] = idx[1] = idx[2] = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
586 set_mono_pixel (and_bits, maskbpline, height, i, j, TRUE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
588 else
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
589 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
590 set_mono_pixel (and_bits, maskbpline, height, i, j, FALSE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 SetDIBits (hcdc,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 dibits,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601 DIB_RGB_COLORS);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
603 xfree (bmp_info);
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
604 xfree (dibits);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
605
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 SelectObject(hcdc, old);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 void
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
612 mswindows_initialize_image_instance_icon (Lisp_Image_Instance *image,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 int cursor)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 ICONINFO x_icon;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 /* we rely on windows to do any resizing necessary */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
618 x_icon.fIcon = cursor ? FALSE : TRUE;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
619 x_icon.xHotspot = XFIXNUM (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image));
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
620 x_icon.yHotspot = XFIXNUM (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
621 x_icon.hbmMask = IMAGE_INSTANCE_MSWINDOWS_MASK (image);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
622 x_icon.hbmColor = IMAGE_INSTANCE_MSWINDOWS_BITMAP (image);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
623
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 IMAGE_INSTANCE_MSWINDOWS_ICON (image)=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 CreateIconIndirect (&x_icon);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
628 static HBITMAP
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
629 create_resized_bitmap (HBITMAP curbmp, struct frame *f,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
630 int curx, int cury,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
631 int newx, int newy)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 HBITMAP newbmp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 HGDIOBJ old1, old2;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
635
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
636 HDC hcdc = get_device_compdc (XDEVICE (FRAME_DEVICE (f)));
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
637 HDC hdcDst = CreateCompatibleDC (hcdc);
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
638
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
639 old1 = SelectObject (hcdc, curbmp);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
640
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 newbmp = CreateCompatibleBitmap (hcdc, newx, newy);
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 old2 = SelectObject (hdcDst, newbmp);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
644
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 if (!StretchBlt (hdcDst, 0, 0, newx, newy,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
646 hcdc, 0, 0,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
647 curx,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
648 cury,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
649 SRCCOPY))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 DeleteObject (newbmp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 DeleteDC (hdcDst);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 SelectObject (hdcDst, old2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 SelectObject (hcdc, old1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658 DeleteDC (hdcDst);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 return newbmp;
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663 HBITMAP
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
664 mswindows_create_resized_bitmap (Lisp_Image_Instance *ii,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
665 struct frame *f,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
666 int newx, int newy)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
667 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
668 return create_resized_bitmap (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
669 f,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
670 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
671 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
672 newx, newy);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
673 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
674
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
675 HBITMAP
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
676 mswindows_create_resized_mask (Lisp_Image_Instance *ii,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
677 struct frame *f,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 int newx, int newy)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
680 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii) == NULL)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
681 return NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
682
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
683 return create_resized_bitmap (IMAGE_INSTANCE_MSWINDOWS_MASK (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
684 f,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
685 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
686 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
687 newx, newy);
428
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
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
690 #if 0 /* Currently unused */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
691 /* #### Warning: This function is not correct anymore with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
692 resizable printer bitmaps. If you uncomment it, clean it. --kkm */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
693 int
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
694 mswindows_resize_dibitmap_instance (Lisp_Image_Instance *ii,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
695 struct frame *f,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
696 int newx, int newy)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
697 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
698 HBITMAP newbmp = mswindows_create_resized_bitmap (ii, f, newx, newy);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
699 HBITMAP newmask = mswindows_create_resized_mask (ii, f, newx, newy);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
700
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
701 if (!newbmp)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
702 return FALSE;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
703
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
704 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
705 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
706 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
707 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (ii));
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 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = newbmp;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = newmask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = newx;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = newy;
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 return TRUE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
716 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 /**********************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 * XPM *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
720 **********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
722 #ifdef HAVE_XPM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
724 struct color_symbol
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
725 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
726 Ibyte * name;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
727 COLORREF color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
730 static struct color_symbol *
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
731 extract_xpm_color_names (Lisp_Object device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732 Lisp_Object domain,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 Lisp_Object color_symbol_alist,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
734 int *nsymbols)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 Lisp_Object rest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 Lisp_Object results = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 int i, j;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 struct color_symbol *colortbl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 struct gcpro gcpro1, gcpro2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 GCPRO2 (results, device);
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 /* We built up results to be (("name" . #<color>) ...) so that if an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
746 error happens we don't lose any malloc()ed data, or more importantly,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
747 leave any pixels allocated in the server. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
748 i = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 LIST_LOOP (rest, color_symbol_alist)
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 Lisp_Object cons = XCAR (rest);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
752 Lisp_Object name = XCAR (cons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 Lisp_Object value = XCDR (cons);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
754 if (NILP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
755 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756 if (STRINGP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 value =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
758 Fmake_color_instance
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 771
diff changeset
759 (value, device, encode_error_behavior_flag (ERROR_ME_DEBUG_WARN));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 assert (COLOR_SPECIFIERP (value));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763 value = Fspecifier_instance (value, domain, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 if (NILP (value))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 results = noseeum_cons (noseeum_cons (name, value), results);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 i++;
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 UNGCPRO; /* no more evaluation */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
771
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
772 *nsymbols = i;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
773 if (i == 0) return 0;
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 colortbl = xnew_array_and_zero (struct color_symbol, i);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
777 for (j = 0; j < i; j++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 Lisp_Object cons = XCAR (results);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
780 colortbl[j].color =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (XCDR (cons)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
783 /* mustn't lose this when we return */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
784 colortbl[j].name = qxestrdup (XSTRING_DATA (XCAR (cons)));
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 851
diff changeset
785 free_cons (cons);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 cons = results;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 results = XCDR (results);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 851
diff changeset
788 free_cons (cons);
428
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 return colortbl;
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
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
793 static int xpm_to_eimage (Lisp_Object image, const Extbyte *buffer,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
794 Binbyte **data,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
795 int *width, int *height,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
796 int *x_hot, int *y_hot,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
797 int *transp,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
798 struct color_symbol *color_symbols,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 int nsymbols)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 XpmImage xpmimage;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 XpmInfo xpminfo;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 int result, i, j, transp_idx, maskbpline;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
804 Binbyte *dptr;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
805 unsigned int *sptr;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 COLORREF color; /* the american spelling virus hits again .. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
807 COLORREF *colortbl;
428
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 xzero (xpmimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 xzero (xpminfo);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
811 xpminfo.valuemask = XpmHotspot;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
812 *transp = FALSE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
813
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
814 result = XpmCreateXpmImageFromBuffer ((char *)buffer,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 &xpmimage,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 &xpminfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817 switch (result)
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 case XpmSuccess:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 case XpmFileInvalid:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
823 signal_image_error ("Invalid XPM data", image);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 case XpmNoMemory:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
827 signal_double_image_error ("Parsing pixmap data",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
828 "out of memory", image);
428
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 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
831 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
832 signal_double_image_error_2 ("Parsing pixmap data",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
833 "unknown error",
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
834 make_fixnum (result), image);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
837
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 *width = xpmimage.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 *height = xpmimage.height;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
840 maskbpline = BPLINE ((~7UL & (unsigned long)(*width + 7)) / 8);
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
841
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
842 *data = xnew_array_and_zero (Binbyte, *width * *height * 3);
428
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 if (!*data)
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 XpmFreeXpmImage (&xpmimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 XpmFreeXpmInfo (&xpminfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 /* build a color table to speed things up */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 colortbl = xnew_array_and_zero (COLORREF, xpmimage.ncolors);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
853 if (!colortbl)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
855 xfree (*data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 XpmFreeXpmImage (&xpmimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 XpmFreeXpmInfo (&xpminfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
861 for (i = 0; i < (int) xpmimage.ncolors; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 /* goto alert!!!! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 /* pick up symbolic colors in preference */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
865 if (xpmimage.colorTable[i].symbolic)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
867 if (!strcasecmp (xpmimage.colorTable[i].symbolic, "BgColor")
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 ||
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
869 !strcasecmp (xpmimage.colorTable[i].symbolic, "None"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
871 *transp = TRUE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
872 colortbl[i] = transparent_color;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
873 transp_idx = i;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 goto label_found_color;
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 else if (color_symbols)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
878 for (j = 0; j < nsymbols; j++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
880 if (!qxestrcmp_ascii (color_symbols[j].name,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
881 xpmimage.colorTable[i].symbolic))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
883 colortbl[i] = color_symbols[j].color;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 goto label_found_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
886 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 else if (xpmimage.colorTable[i].c_color == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
890 goto label_no_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
891 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
892 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
893 /* pick up transparencies */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
894 if (!strcasecmp (xpmimage.colorTable[i].c_color, "None"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
895 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
896 *transp = TRUE;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
897 colortbl[i] = transparent_color;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
898 transp_idx = i;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 goto label_found_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 /* finally pick up a normal color spec */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 if (xpmimage.colorTable[i].c_color)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
904 colortbl[i]=
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
905 mswindows_string_to_color ((Ibyte *)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
906 xpmimage.colorTable[i].c_color);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
907 goto label_found_color;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
908 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
909
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 label_no_color:
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
911 xfree (*data);
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
912 xfree (colortbl);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 XpmFreeXpmImage (&xpmimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
914 XpmFreeXpmInfo (&xpminfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 return 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
916
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
917 label_found_color:;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 /* convert the image */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
921 sptr = xpmimage.data;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
922 dptr= *data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
923 for (i = 0; i< *width * *height; i++)
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 color = colortbl[*sptr++];
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 /* split out the 0x02bbggrr colorref into an rgb triple */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
928 *dptr++=GetRValue (color); /* red */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
929 *dptr++=GetGValue (color); /* green */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
930 *dptr++=GetBValue (color); /* blue */
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
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
933 *x_hot = xpminfo.x_hotspot;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
934 *y_hot = xpminfo.y_hotspot;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 XpmFreeXpmImage (&xpmimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 XpmFreeXpmInfo (&xpminfo);
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
938 xfree (colortbl);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 return TRUE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 }
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 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
943 mswindows_xpm_instantiate (Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
944 Lisp_Object instantiator,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
945 Lisp_Object UNUSED (pointer_fg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
946 Lisp_Object UNUSED (pointer_bg),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 int dest_mask, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
949 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
951 const Extbyte *bytes;
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
952 Bytecount len;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
953 Binbyte *eimage;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 int width, height, x_hot, y_hot;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 BITMAPINFO* bmp_info;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
956 Binbyte* bmp_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 int bmp_bits;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
958 int nsymbols = 0, transp;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
959 struct color_symbol* color_symbols = NULL;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
960
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
962 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
963 Q_color_symbols);
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 CHECK_MSGDI_DEVICE (device);
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 assert (!NILP (data));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
968
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
969 LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
970
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
971 /* in case we have color symbols */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
972 color_symbols = extract_xpm_color_names (device, domain,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 color_symbol_alist, &nsymbols);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
975 /* convert to an eimage to make processing easier */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
976 if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
977 &x_hot, &y_hot, &transp, color_symbols, nsymbols))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
978 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
979 signal_image_error ("XPM to EImage conversion failed",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
980 image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
981 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
982
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 if (color_symbols)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 while (nsymbols--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
987 xfree (color_symbols[nsymbols].name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 }
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
989 xfree (color_symbols);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
991
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
992 /* build a bitmap from the eimage */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
993 if (!(bmp_info = convert_EImage_to_DIBitmap (device, width, height, eimage,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
994 &bmp_bits, &bmp_data)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
995 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
996 signal_image_error ("XPM to EImage conversion failed",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
997 image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
998 }
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
999 xfree (eimage);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1001 /* Now create the pixmap and set up the image instance */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1002 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1003 bmp_data, bmp_bits, 1, instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004 x_hot, y_hot, transp);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1006 xfree (bmp_info);
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1007 xfree (bmp_data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1009 #endif /* HAVE_XPM */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1011 /**********************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1012 * BMP *
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 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1016 bmp_validate (Lisp_Object instantiator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1017 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1018 file_or_data_must_be_present (instantiator);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 }
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 Lisp_Object
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1022 bmp_normalize (Lisp_Object inst, Lisp_Object console_type,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1023 Lisp_Object UNUSED (dest_mask))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1024 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1025 return simple_image_type_normalize (inst, console_type, Qbmp);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029 bmp_possible_dest_types (void)
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 return IMAGE_COLOR_PIXMAP_MASK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 bmp_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1036 Lisp_Object UNUSED (pointer_fg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1037 Lisp_Object UNUSED (pointer_bg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1038 int dest_mask, Lisp_Object UNUSED (domain))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1040 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1042 const Extbyte *bytes;
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
1043 Bytecount len;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1044 BITMAPFILEHEADER * bmp_file_header;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1045 BITMAPINFO * bmp_info;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1046 void * bmp_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 int bmp_bits;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1050 CHECK_MSGDI_DEVICE (device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 assert (!NILP (data));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1054 LISP_STRING_TO_SIZED_EXTERNAL (data, bytes, len, Qbinary);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1055
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 /* Then slurp the image into memory, decoding along the way.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 The result is the image in a simple one-byte-per-pixel
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 format. */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1059
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1060 bmp_file_header = (BITMAPFILEHEADER *)bytes;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1061 bmp_info = (BITMAPINFO *)(bytes + sizeof(BITMAPFILEHEADER));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1062 bmp_data = (Extbyte *)bytes + bmp_file_header->bfOffBits;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 bmp_bits = bmp_file_header->bfSize - bmp_file_header->bfOffBits;
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 /* Now create the pixmap and set up the image instance */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067 bmp_data, bmp_bits, 1, instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 0, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1069 }
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 /**********************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 * RESOURCES *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074 **********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 mswindows_resource_validate (Lisp_Object instantiator)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1079 shared_resource_validate (instantiator);
428
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 static Lisp_Object
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1083 mswindows_resource_normalize (Lisp_Object inst, Lisp_Object console_type,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1084 Lisp_Object dest_mask)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1086 return shared_resource_normalize (inst, console_type, dest_mask,
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1087 Qmswindows_resource);
428
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 mswindows_resource_possible_dest_types (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1092 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 return IMAGE_POINTER_MASK | IMAGE_COLOR_PIXMAP_MASK;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1095
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1096 typedef struct
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1097 {
4932
8b63e21b0436 fix compile issues with gcc 4
Ben Wing <ben@xemacs.org>
parents: 4834
diff changeset
1098 const Ascbyte *name;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 int resource_id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 } resource_t;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1101
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1102 static const resource_t bitmap_table[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 /* bitmaps */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 { "close", OBM_CLOSE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106 { "uparrow", OBM_UPARROW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 { "dnarrow", OBM_DNARROW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1108 { "rgarrow", OBM_RGARROW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 { "lfarrow", OBM_LFARROW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 { "reduce", OBM_REDUCE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 { "zoom", OBM_ZOOM },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 { "restore", OBM_RESTORE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 { "reduced", OBM_REDUCED },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114 { "zoomd", OBM_ZOOMD },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 { "restored", OBM_RESTORED },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 { "uparrowd", OBM_UPARROWD },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 { "dnarrowd", OBM_DNARROWD },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 { "rgarrowd", OBM_RGARROWD },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119 { "lfarrowd", OBM_LFARROWD },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 { "mnarrow", OBM_MNARROW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 { "combo", OBM_COMBO },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 { "uparrowi", OBM_UPARROWI },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 { "dnarrowi", OBM_DNARROWI },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 { "rgarrowi", OBM_RGARROWI },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 { "lfarrowi", OBM_LFARROWI },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 { "size", OBM_SIZE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 { "btsize", OBM_BTSIZE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 { "check", OBM_CHECK },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 { "checkboxes", OBM_CHECKBOXES },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1130 { "btncorners" , OBM_BTNCORNERS },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1131 {0}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1132 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1133
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1134 static const resource_t cursor_table[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1135 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 /* cursors */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 { "normal", OCR_NORMAL },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 { "ibeam", OCR_IBEAM },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139 { "wait", OCR_WAIT },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 { "cross", OCR_CROSS },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 { "up", OCR_UP },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142 /* { "icon", OCR_ICON }, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 { "sizenwse", OCR_SIZENWSE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144 { "sizenesw", OCR_SIZENESW },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1145 { "sizewe", OCR_SIZEWE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1146 { "sizens", OCR_SIZENS },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1147 { "sizeall", OCR_SIZEALL },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 /* { "icour", OCR_ICOCUR }, */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 { "no", OCR_NO },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 { 0 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1153 static const resource_t icon_table[] =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1154 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1155 /* icons */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 { "sample", OIC_SAMPLE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1157 { "hand", OIC_HAND },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1158 { "ques", OIC_QUES },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 { "bang", OIC_BANG },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 { "note", OIC_NOTE },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 { "winlogo", OIC_WINLOGO },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 {0}
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1165 static int
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1166 resource_name_to_resource (Lisp_Object name, int type)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1168 const resource_t *res = (type == IMAGE_CURSOR ? cursor_table
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1169 : type == IMAGE_ICON ? icon_table
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 : bitmap_table);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1172 if (FIXNUMP (name))
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1173 return XFIXNUM (name);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1174 else if (!STRINGP (name))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1175 invalid_argument ("invalid resource identifier", name);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1176
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1177 do
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1179 if (!qxestrcasecmp_i18n ((Ibyte *) res->name, XSTRING_DATA (name)))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1180 return res->resource_id;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1182 while ((++res)->name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1183 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1184 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 resource_symbol_to_type (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 if (EQ (data, Qcursor))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 return IMAGE_CURSOR;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1191 else if (EQ (data, Qicon))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 return IMAGE_ICON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 else if (EQ (data, Qbitmap))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194 return IMAGE_BITMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1195 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1196 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
1200 mswindows_resource_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
1201 Lisp_Object instantiator,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1202 Lisp_Object UNUSED (pointer_fg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1203 Lisp_Object UNUSED (pointer_bg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1204 int dest_mask, Lisp_Object UNUSED (domain))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1205 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1206 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 611
diff changeset
1207 int type = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 HANDLE himage = NULL;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1209 Extbyte *resid = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1210 HINSTANCE hinst = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 ICONINFO iconinfo;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1212 enum image_instance_type iitype;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1213 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1215 Lisp_Object file = find_keyword_in_vector (instantiator, Q_file);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1216 Lisp_Object resource_type = find_keyword_in_vector (instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1217 Q_resource_type);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1218 Lisp_Object resource_id = find_keyword_in_vector (instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1219 Q_resource_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1220
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1221 xzero (iconinfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1222
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1223 CHECK_MSGDI_DEVICE (device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225 type = resource_symbol_to_type (resource_type);
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 if (dest_mask & IMAGE_POINTER_MASK && type == IMAGE_CURSOR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1228 iitype = IMAGE_POINTER;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1229 else if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1230 iitype = IMAGE_COLOR_PIXMAP;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1231 else
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1232 incompatible_image_types (instantiator, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1233 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1234
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1235 /* mess with the keyword info we were provided with */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1236 if (!NILP (file))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1237 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1238 Extbyte *fname;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1239
4834
b3ea9c582280 Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents: 2959
diff changeset
1240 LISP_LOCAL_FILE_FORMAT_TO_TSTR (file, fname);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1241
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1242 if (NILP (resource_id))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1243 resid = fname;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1244 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1245 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1246 hinst = qxeLoadLibraryEx (fname, NULL, LOAD_LIBRARY_AS_DATAFILE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1247 resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1248 type));
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1249
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1250 if (!resid)
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1251 resid = LISP_STRING_TO_TSTR (resource_id);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1252 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1253 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1254 else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1255 type))))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1256 invalid_argument ("Invalid resource identifier", resource_id);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1257
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1258 /* load the image */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1259 if (!(himage = qxeLoadImage (hinst, resid, type, 0, 0,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1260 LR_CREATEDIBSECTION | LR_DEFAULTSIZE |
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1261 LR_SHARED |
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1262 (!NILP (file) ? LR_LOADFROMFILE : 0))))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1263 signal_image_error ("Cannot load image", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1264
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1265 if (hinst)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1266 FreeLibrary (hinst);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1268 mswindows_initialize_dibitmap_image_instance (ii, 1, iitype);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1269
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1270 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = file;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1271 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii) =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CXCURSOR : SM_CXICON);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1273 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii) =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CYCURSOR : SM_CYICON);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1276 init_image_instance_geometry (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 /* hey, we've got an icon type thing so we can reverse engineer the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 bitmap and mask */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1280 if (type != IMAGE_BITMAP)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1282 GetIconInfo ((HICON)himage, &iconinfo);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = iconinfo.hbmColor;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = iconinfo.hbmMask;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1285 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = make_fixnum (iconinfo.xHotspot);
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1286 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = make_fixnum (iconinfo.yHotspot);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1287 IMAGE_INSTANCE_MSWINDOWS_ICON (ii) = (HICON) himage;
428
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 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1290 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 IMAGE_INSTANCE_MSWINDOWS_ICON (ii) = NULL;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1292 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = (HBITMAP) himage;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = NULL;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1294 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = make_fixnum (0);
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1295 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = make_fixnum (0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 check_valid_resource_symbol (Lisp_Object data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 CHECK_SYMBOL (data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 if (!resource_symbol_to_type (data))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1304 invalid_constant ("invalid resource type", data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 check_valid_resource_id (Lisp_Object data)
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 if (!resource_name_to_resource (data, IMAGE_CURSOR)
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 !resource_name_to_resource (data, IMAGE_ICON)
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 !resource_name_to_resource (data, IMAGE_BITMAP))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1315 invalid_constant ("invalid resource identifier", data);
428
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
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1318
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 /**********************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 * XBM *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1321 **********************************************************************/
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1322
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 /* this table flips four bits around. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 static int flip_table[] =
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 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 /* the bitmap data comes in the following format: Widths are padded to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 a multiple of 8. Scan lines are stored in increasing byte order
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 from left to right, little-endian within a byte. 0 = white, 1 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 black. It must be converted to the following format: Widths are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 padded to a multiple of 16. Scan lines are stored in increasing
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 byte order from left to right, big-endian within a byte. 0 =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 black, 1 = white. */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
1336 static HBITMAP
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1337 xbm_create_bitmap_from_data (HDC hdc, const Binbyte *data,
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 611
diff changeset
1338 int width, int height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 int mask, COLORREF fg, COLORREF bg)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341 int old_width = (width + 7)/8;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1342 int new_width = BPLINE (2 * ((width + 15)/16));
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1343 const Binbyte *offset;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 void *bmp_buf = 0;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1345 Binbyte *new_data, *new_offset;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 int i, j;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1347 BITMAPINFO *bmp_info =
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1348 (BITMAPINFO *) xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 HBITMAP bitmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 if (!bmp_info)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 return NULL;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1353
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1354 new_data = xnew_array_and_zero (Binbyte, height * new_width);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1355
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 if (!new_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1358 xfree (bmp_info);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1361
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1362 for (i = 0; i < height; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1364 offset = data + i * old_width;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1365 new_offset = new_data + i * new_width;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1366
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1367 for (j = 0; j < old_width; j++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1369 int bite = offset[j];
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1370 new_offset[j] = ~ (Binbyte)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1371 ((flip_table[bite & 0xf] << 4) + flip_table[bite >> 4]);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1374
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 /* if we want a mask invert the bits */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 if (!mask)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 new_offset = &new_data[height * new_width];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 while (new_offset-- != new_data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 *new_offset ^= 0xff;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1385 bmp_info->bmiHeader.biWidth = width;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 bmp_info->bmiHeader.biHeight=-(LONG)height;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1387 bmp_info->bmiHeader.biPlanes = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1388 bmp_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1389 bmp_info->bmiHeader.biBitCount = 1;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1390 bmp_info->bmiHeader.biCompression = BI_RGB;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1391 bmp_info->bmiHeader.biClrUsed = 2;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1392 bmp_info->bmiHeader.biClrImportant = 2;
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1393 bmp_info->bmiHeader.biSizeImage = height * new_width;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 bmp_info->bmiColors[0].rgbRed = GetRValue (fg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1395 bmp_info->bmiColors[0].rgbGreen = GetGValue (fg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 bmp_info->bmiColors[0].rgbBlue = GetBValue (fg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 bmp_info->bmiColors[0].rgbReserved = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 bmp_info->bmiColors[1].rgbRed = GetRValue (bg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399 bmp_info->bmiColors[1].rgbGreen = GetGValue (bg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1400 bmp_info->bmiColors[1].rgbBlue = GetBValue (bg);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1401 bmp_info->bmiColors[1].rgbReserved = 0;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1402
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1403 bitmap = CreateDIBSection (hdc,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 bmp_info,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405 DIB_RGB_COLORS,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1406 &bmp_buf,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 0,0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1409 xfree (bmp_info);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1410
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 if (!bitmap || !bmp_buf)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1413 xfree (new_data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414 return NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 }
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1416
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417 /* copy in the actual bitmap */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1418 memcpy (bmp_buf, new_data, height * new_width);
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1419 xfree (new_data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1421 return bitmap;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1422 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 /* Given inline data for a mono pixmap, initialize the given
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 image instance accordingly. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1426
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1427 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1428 init_image_instance_from_xbm_inline (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1429 int width, int height,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1430 const Binbyte *bits,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1431 Lisp_Object instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1432 Lisp_Object pointer_fg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1433 Lisp_Object pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1434 int dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1435 HBITMAP mask,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1436 Lisp_Object UNUSED (mask_filename))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1437 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 Lisp_Object foreground = find_keyword_in_vector (instantiator, Q_foreground);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 Lisp_Object background = find_keyword_in_vector (instantiator, Q_background);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 enum image_instance_type type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1442 COLORREF black = PALETTERGB (0,0,0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1443 COLORREF white = PALETTERGB (255,255,255);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1444 HDC hdc;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1445
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1446 CHECK_MSGDI_DEVICE (device);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1447
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1448 hdc = get_device_compdc (XDEVICE (device));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1449
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1450 if ((dest_mask & IMAGE_MONO_PIXMAP_MASK) &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1451 (dest_mask & IMAGE_COLOR_PIXMAP_MASK))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1452 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1453 if (!NILP (foreground) || !NILP (background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1454 type = IMAGE_COLOR_PIXMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1455 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1456 type = IMAGE_MONO_PIXMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1457 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1458 else if (dest_mask & IMAGE_MONO_PIXMAP_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1459 type = IMAGE_MONO_PIXMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1460 else if (dest_mask & IMAGE_COLOR_PIXMAP_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1461 type = IMAGE_COLOR_PIXMAP;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1462 else if (dest_mask & IMAGE_POINTER_MASK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1463 type = IMAGE_POINTER;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1464 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1465 incompatible_image_types (instantiator, dest_mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1466 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1467 | IMAGE_POINTER_MASK);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1468
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1469 mswindows_initialize_dibitmap_image_instance (ii, 1, type);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1470
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1471 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1472 find_keyword_in_vector (instantiator, Q_file);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1473 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_WIDTH (ii) = width;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1474 IMAGE_INSTANCE_MSWINDOWS_BITMAP_REAL_HEIGHT (ii) = height;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1475 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1476 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = make_fixnum (0);
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1477 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = make_fixnum (0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1478 init_image_instance_geometry (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1479
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1480 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = mask ? mask :
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
1481 xbm_create_bitmap_from_data (hdc, bits, width, height, TRUE, black, white);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1483 switch (type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1484 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1485 case IMAGE_MONO_PIXMAP:
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1486 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
1487 xbm_create_bitmap_from_data (hdc, bits, width, height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1488 FALSE, black, black);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1489 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1490
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1491 case IMAGE_COLOR_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1492 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1493 COLORREF fg = black;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1494 COLORREF bg = white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1496 if (!NILP (foreground) && !COLOR_INSTANCEP (foreground))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1497 foreground =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1498 Fmake_color_instance (foreground, device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1499 encode_error_behavior_flag (ERROR_ME));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1500
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1501 if (COLOR_INSTANCEP (foreground))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1502 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1503
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1504 if (!NILP (background) && !COLOR_INSTANCEP (background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1505 background =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1506 Fmake_color_instance (background, device,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1507 encode_error_behavior_flag (ERROR_ME));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1508
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1509 if (COLOR_INSTANCEP (background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1510 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1511
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1512 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1513 IMAGE_INSTANCE_PIXMAP_BG (ii) = background;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1514
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1515 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
1516 xbm_create_bitmap_from_data (hdc, bits, width, height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1517 FALSE, fg, black);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1518 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1519 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1520
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1521 case IMAGE_POINTER:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1522 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1523 COLORREF fg = black;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1524 COLORREF bg = white;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1526 if (NILP (foreground))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1527 foreground = pointer_fg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1528 if (NILP (background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1529 background = pointer_bg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1530
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1531 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1532 find_keyword_in_vector (instantiator, Q_hotspot_x);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1533 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1534 find_keyword_in_vector (instantiator, Q_hotspot_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1535 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1536 IMAGE_INSTANCE_PIXMAP_BG (ii) = background;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1537 if (COLOR_INSTANCEP (foreground))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1538 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1539 if (COLOR_INSTANCEP (background))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1540 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1541
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1542 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) =
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
1543 xbm_create_bitmap_from_data (hdc, bits, width, height,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1544 TRUE, fg, black);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1545 mswindows_initialize_image_instance_icon (ii, TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1547 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1548
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1549 default:
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2421
diff changeset
1550 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1551 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1552 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1553
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1554 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1555 xbm_instantiate_1 (Lisp_Object image_instance, Lisp_Object instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1556 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1557 int dest_mask, int width, int height,
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1558 const Binbyte *bits)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1559 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1560 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1561 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1562 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1563 HDC hdc = get_device_compdc (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1564 HBITMAP mask = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1565
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1566 if (!NILP (mask_data))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1567 {
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1568 Binbyte *ext_data;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1569
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1570 ext_data =
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1571 (Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (mask_data))),
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1572 Qbinary);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1573 mask = xbm_create_bitmap_from_data (hdc,
593
5fd7ba8b56e7 [xemacs-hg @ 2001-05-31 12:45:27 by ben]
ben
parents: 563
diff changeset
1574 ext_data,
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1575 XFIXNUM (XCAR (mask_data)),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1576 XFIXNUM (XCAR (XCDR (mask_data))),
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1577 FALSE,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1578 PALETTERGB (0,0,0),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1579 PALETTERGB (255,255,255));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1580 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1582 init_image_instance_from_xbm_inline (ii, width, height, bits,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1583 instantiator, pointer_fg, pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1584 dest_mask, mask, mask_file);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1585 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1586
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1587 /* Instantiate method for XBM's. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1588
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1589 static void
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1590 mswindows_xbm_instantiate (Lisp_Object image_instance,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1591 Lisp_Object instantiator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1592 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1593 int dest_mask, Lisp_Object UNUSED (domain))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1594 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1595 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1596 const Binbyte *ext_data;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1597
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1598 assert (!NILP (data));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1599
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1600 ext_data =
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1601 (const Binbyte *) LISP_STRING_TO_EXTERNAL (XCAR (XCDR (XCDR (data))),
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1602 Qbinary);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1603
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1604 xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1605 pointer_bg, dest_mask, XFIXNUM (XCAR (data)),
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
1606 XFIXNUM (XCAR (XCDR (data))), ext_data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1607 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1608
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1609 #ifdef HAVE_XFACE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1610 /**********************************************************************
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1611 * X-Face *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1612 **********************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1613 #if defined(EXTERN)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1614 /* This is about to get redefined! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1615 #undef EXTERN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1616 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1617 /* We have to define SYSV32 so that compface.h includes string.h
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1618 instead of strings.h. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1619 #define SYSV32
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 1726
diff changeset
1620 BEGIN_C_DECLS
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2421
diff changeset
1621 #ifndef __STDC__ /* Needed to avoid prototype warnings */
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2421
diff changeset
1622 #define __STDC__
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2421
diff changeset
1623 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1624 #include <compface.h>
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 1726
diff changeset
1625 END_C_DECLS
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 1726
diff changeset
1626
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1627 /* JMP_BUF cannot be used here because if it doesn't get defined
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1628 to jmp_buf we end up with a conflicting type error with the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1629 definition in compface.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1630 extern jmp_buf comp_env;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1631 #undef SYSV32
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1632
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1633 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
1634 mswindows_xface_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
1635 Lisp_Object instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1636 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1637 int dest_mask, Lisp_Object UNUSED (domain))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1638 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1639 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1640 int i, stattis;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1641 Binbyte *p, *bits, *bp;
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1642 const CIbyte * volatile emsg = 0;
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1643 const Binbyte * volatile dstring;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1644
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1645 assert (!NILP (data));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1646
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1647 dstring = (const Binbyte *) LISP_STRING_TO_EXTERNAL (data, Qbinary);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1648
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1649 if ((p = (Binbyte *) strchr ((char *) dstring, ':')))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1650 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1651 dstring = p + 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1652 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1653
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1654 /* Must use setjmp not SETJMP because we used jmp_buf above not JMP_BUF */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1655 if (!(stattis = setjmp (comp_env)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1656 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1657 UnCompAll ((char *) dstring);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1658 UnGenFace ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1659 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1660
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1661 switch (stattis)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1662 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1663 case -2:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1664 emsg = "uncompface: internal error";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1665 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1666 case -1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1667 emsg = "uncompface: insufficient or invalid data";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1668 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1669 case 1:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1670 emsg = "uncompface: excess data ignored";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1671 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1672 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1673
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1674 if (emsg)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
1675 signal_image_error_2 (emsg, data, Qimage);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1676
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1677 bp = bits = alloca_binbytes (PIXELS / 8);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1678
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1679 /* the compface library exports char F[], which uses a single byte per
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1680 pixel to represent a 48x48 bitmap. Yuck. */
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1681 for (i = 0, p = (Binbyte *) F; i < (PIXELS / 8); ++i)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1682 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1683 int n, b;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1684 /* reverse the bit order of each byte... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1685 for (b = n = 0; b < 8; ++b)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1686 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1687 n |= ((*p++) << b);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1688 }
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
1689 *bp++ = (Binbyte) n;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1690 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1691
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1692 xbm_instantiate_1 (image_instance, instantiator, pointer_fg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1693 pointer_bg, dest_mask, 48, 48, bits);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1694 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1695 #endif /* HAVE_XFACE */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1696
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1697
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1698 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1699 /* image instance methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1700 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1701
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1702 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1703 mswindows_print_image_instance (Lisp_Image_Instance *p,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1704 Lisp_Object printcharfun,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
1705 int UNUSED (escapeflag))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1706 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1707 switch (IMAGE_INSTANCE_TYPE (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1708 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1709 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1710 case IMAGE_COLOR_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1711 case IMAGE_POINTER:
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1712 write_fmt_string (printcharfun, " (0x%lx",
5934
e2fae7783046 lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
Henry Thompson <ht@markup.co.uk>
parents: 5921
diff changeset
1713 (uintptr_t) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1714 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1715 {
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
1716 write_fmt_string (printcharfun, "/0x%lx",
5934
e2fae7783046 lots of use of EMACS_INT, a few others, to eliminate all pointer truncation warnings
Henry Thompson <ht@markup.co.uk>
parents: 5921
diff changeset
1717 (uintptr_t) IMAGE_INSTANCE_MSWINDOWS_MASK (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1718 }
4952
19a72041c5ed Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents: 4932
diff changeset
1719 write_ascstring (printcharfun, ")");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1720 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1721
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1722 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1723 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1724 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1725 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1726
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1727 #ifdef DEBUG_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1728 extern int debug_widget_instances;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1729 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1730
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1731 static void
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1732 finalize_destroy_window (void *win)
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1733 {
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1734 DestroyWindow ((HWND) win);
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1735 }
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1736
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1737 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1738 mswindows_finalize_image_instance (Lisp_Image_Instance *p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1739 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1740 if (!p->data)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1741 return;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1742
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1743 if (DEVICE_LIVE_P (XDEVICE (IMAGE_INSTANCE_DEVICE (p))))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1744 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1745 if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (p))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1746 & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1747 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1748 #ifdef DEBUG_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1749 debug_widget_instances--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1750 stderr_out ("widget destroyed, %d left\n", debug_widget_instances);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1751 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1752 if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1753 {
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1754 /* DestroyWindow is not safe here, as it will send messages
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1755 to our window proc. */
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1756 register_post_gc_action
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1757 (finalize_destroy_window,
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1758 (void *) (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p)));
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1759 register_post_gc_action
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1760 (finalize_destroy_window,
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 608
diff changeset
1761 (void *) (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1762 IMAGE_INSTANCE_SUBWINDOW_ID (p) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1763 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1764 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1765 else if (p->data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1766 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1767 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1768 if (IMAGE_INSTANCE_PIXMAP_TIMEOUT (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1769 disable_glyph_animated_timeout (IMAGE_INSTANCE_PIXMAP_TIMEOUT (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1770
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1771 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1772 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1773 for (i = 0; i < IMAGE_INSTANCE_PIXMAP_MAXSLICE (p); i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1774 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1775 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1776 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1777 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICE (p, i) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1778 }
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1779 xfree (IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1780 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (p) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1781 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1782 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1783 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1784 IMAGE_INSTANCE_MSWINDOWS_MASK (p) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1785 if (IMAGE_INSTANCE_MSWINDOWS_ICON (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1786 DestroyIcon (IMAGE_INSTANCE_MSWINDOWS_ICON (p));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1787 IMAGE_INSTANCE_MSWINDOWS_ICON (p) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1788 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1789 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1790
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1791 if (p->data)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1792 {
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
1793 xfree (p->data);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1794 p->data = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1795 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1796 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1797
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1798 /************************************************************************/
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1799 /* subwindow and widget support */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1800 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1801
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1802 static Lisp_Object
2333
ba4677f54a05 [xemacs-hg @ 2004-10-14 17:26:18 by james]
james
parents: 2286
diff changeset
1803 charset_of_text (Lisp_Object USED_IF_MULE (text))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1804 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1805 #ifdef MULE
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1806 Ibyte *p;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1807
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1808 if (NILP (text))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1809 return Vcharset_ascii;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1810 for (p = XSTRING_DATA (text); *p;)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1811 {
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1812 Ichar c = itext_ichar (p);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1813 if (!EQ (ichar_charset (c), Vcharset_ascii))
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1814 return ichar_charset (c);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 863
diff changeset
1815 INC_IBYTEPTR (p);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1816 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1817 #endif /* MULE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1818
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1819 return Vcharset_ascii;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1820 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1821
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1822
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1823 static HFONT
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1824 mswindows_widget_hfont (Lisp_Object face,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1825 Lisp_Object domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1826 Lisp_Object text)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1827 {
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1828 int under = FACE_UNDERLINE_P (face, domain);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1829 int strike = FACE_STRIKETHRU_P (face, domain);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1830 Lisp_Object font;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1831 struct face_cachel frame_cachel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1832 struct face_cachel *cachel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1833 Lisp_Object charset;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1834
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1835 reset_face_cachel (&frame_cachel);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1836 update_face_cachel_data (&frame_cachel, domain, face);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1837 cachel = &frame_cachel;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1838 /* !!#### This is a big hack. We return the first non-ASCII charset in
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1839 the string, on the assumption that we can display ASCII characters in
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1840 all fonts. We really need to draw the text of the widget ourselves;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1841 or perhaps there are fonts supporting lots of character sets? */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1842 charset = charset_of_text (text);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1843
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1844 font = FACE_CACHEL_FONT (cachel, charset);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1845
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1846 if (!FONT_INSTANCEP (font))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1847 font = ensure_face_cachel_contains_charset (cachel, domain, charset);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1848
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1849 if (EQ (font, Vthe_null_font_instance))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1850 font = FACE_CACHEL_FONT (cachel, Vcharset_ascii);
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1851
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1852 return mswindows_get_hfont (XFONT_INSTANCE (font), under, strike);
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1853 }
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1854
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1855 #ifdef DEFER_WINDOW_POS
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1856
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1857 static HDWP
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1858 begin_defer_window_pos (struct frame *f)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1859 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1860 if (FRAME_MSWINDOWS_DATA (f)->hdwp == 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1861 FRAME_MSWINDOWS_DATA (f)->hdwp = BeginDeferWindowPos (10);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1862 return FRAME_MSWINDOWS_DATA (f)->hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1863 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1864
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1865 #endif
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
1866
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1867 /* unmap the image if it is a widget. This is used by redisplay via
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1868 redisplay_unmap_subwindows */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1869 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1870 mswindows_unmap_subwindow (Lisp_Image_Instance *p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1871 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1872 if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1873 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1874 #ifdef DEFER_WINDOW_POS
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1875 struct frame *f = XFRAME (IMAGE_INSTANCE_FRAME (p));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1876 HDWP hdwp = begin_defer_window_pos (f);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1877 HDWP new_hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1878 new_hdwp = DeferWindowPos (hdwp, IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1879 NULL,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1880 0, 0, 0, 0,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1881 SWP_HIDEWINDOW | SWP_NOACTIVATE |
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1882 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1883 /* Setting this flag causes the call to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1884 DeferWindowPos to fail with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1885 "Invalid parameter". I don't understand
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1886 why we bother to try and set this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1887 anyway. -- ben */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1888 /* | SWP_NOSENDCHANGING */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1889 );
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1890 if (!new_hdwp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1891 mswindows_output_last_error ("unmapping");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1892 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1893 hdwp = new_hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1894 FRAME_MSWINDOWS_DATA (f)->hdwp = hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1895 #else
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1896 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p),
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1897 NULL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1898 0, 0, 0, 0,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1899 SWP_HIDEWINDOW | SWP_NOACTIVATE |
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1900 SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER );
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1901 #endif
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1902 if (GetFocus() == WIDGET_INSTANCE_MSWINDOWS_HANDLE (p))
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1903 SetFocus (GetParent (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1904 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1905 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1906
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1907 /* map the subwindow. This is used by redisplay via
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1908 redisplay_output_subwindow */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1909 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
1910 mswindows_map_subwindow (Lisp_Image_Instance *p, int x, int y,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1911 struct display_glyph_area *dga)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1912 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1913 #ifdef DEFER_WINDOW_POS
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1914 struct frame *f = XFRAME (IMAGE_INSTANCE_FRAME (p));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1915 HDWP hdwp = begin_defer_window_pos (f);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1916 HDWP new_hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1917 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1918 /* move the window before mapping it ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1919 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p),
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1920 NULL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1921 x, y, dga->width, dga->height,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1922 SWP_NOZORDER
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1923 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1924 /* ... adjust the child ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1925 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1926 NULL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1927 -dga->xoffset, -dga->yoffset, 0, 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1928 SWP_NOZORDER | SWP_NOSIZE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1929 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1930 /* ... now map it - we are not allowed to move it at the same time. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1931 if (!IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (p))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1932 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1933 #ifdef DEFER_WINDOW_POS
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1934 new_hdwp = DeferWindowPos
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1935 (hdwp,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1936 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1937 NULL, 0, 0, 0, 0,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1938 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1939 | SWP_SHOWWINDOW
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1940 /* | SWP_NOCOPYBITS */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1941 /* Setting this flag causes the call to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1942 DeferWindowPos to fail with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1943 "Invalid parameter". I don't understand
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1944 why we bother to try and set this
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1945 anyway. -- ben */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1946 /* | SWP_NOSENDCHANGING */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1947 | SWP_NOACTIVATE);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1948 if (!new_hdwp)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1949 mswindows_output_last_error ("mapping");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1950 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1951 hdwp = new_hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1952 FRAME_MSWINDOWS_DATA (f)->hdwp = hdwp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1953 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1954 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1955 NULL,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1956 0, 0, 0, 0,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1957 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1958 | SWP_SHOWWINDOW | SWP_NOCOPYBITS | SWP_NOACTIVATE);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1959
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1960 /* Doing this once does not seem to be enough, for instance when
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1961 mapping the search dialog this gets called four times. If we
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1962 only set on the first time through then the subwindow never
5384
3889ef128488 Fix misspelled words, and some grammar, across the entire source tree.
Jerry James <james@xemacs.org>
parents: 5192
diff changeset
1963 gets focus as intended. However, doing this every time doesn't
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1964 seem so bad, after all we only need to redo this after the
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1965 focus changes - and if that happens resetting the initial
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1966 focus doesn't seem so bad. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1967 if (IMAGE_INSTANCE_WANTS_INITIAL_FOCUS (p))
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
1968 SetFocus (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1969 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1970 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1971 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1972
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1973 /* resize the subwindow instance */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
1974 static void
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
1975 mswindows_resize_subwindow (Lisp_Image_Instance *ii, int w, int h)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1976 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1977 /* Set the size of the control .... */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1978 if (!SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1979 NULL,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1980 0, 0, w, h,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1981 SWP_NOZORDER | SWP_NOMOVE
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1982 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1983 mswindows_output_last_error ("resizing");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1984 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1985
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1986 /* Simply resize the window here. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1987 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1988 mswindows_redisplay_subwindow (Lisp_Image_Instance *p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1989 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1990 mswindows_resize_subwindow (p,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1991 IMAGE_INSTANCE_WIDTH (p),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1992 IMAGE_INSTANCE_HEIGHT (p));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1993 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1994
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1995 /* when you click on a widget you may activate another widget this
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1996 needs to be checked and all appropriate widgets updated */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1997 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1998 mswindows_redisplay_widget (Lisp_Image_Instance *p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1999 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2000 /* Possibly update the face font and colors. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2001 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (p))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2002 && (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2003 || XFRAME (IMAGE_INSTANCE_FRAME (p))->faces_changed
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2004 || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2005 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2006 /* set the widget font from the widget face */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2007 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2008 WM_SETFONT,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2009 (WPARAM) mswindows_widget_hfont
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2010 (IMAGE_INSTANCE_WIDGET_FACE (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2011 IMAGE_INSTANCE_FRAME (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2012 IMAGE_INSTANCE_WIDGET_TEXT (p)),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2013 MAKELPARAM (TRUE, 0));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2014 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2015 /* Possibly update the dimensions. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2016 if (IMAGE_INSTANCE_SIZE_CHANGED (p))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2017 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2018 mswindows_resize_subwindow (p,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2019 IMAGE_INSTANCE_WIDTH (p),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2020 IMAGE_INSTANCE_HEIGHT (p));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2021 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2022 /* Possibly update the text in the widget. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2023 if (IMAGE_INSTANCE_TEXT_CHANGED (p)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2024 && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2025 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2026 Extbyte *lparam = 0;
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2027 lparam = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (p));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2028 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2029 WM_SETTEXT, 0, (LPARAM) lparam);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2030 }
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2031 /* Set active state. */
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2032 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2033 {
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2034 Lisp_Object item = IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (p);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2035 LONG style = qxeGetWindowLong
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2036 (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2037 GWL_STYLE);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2038
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2039 if (CONSP (item))
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2040 item = XCAR (item);
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2041
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2042 if (gui_item_active_p (item))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2043 qxeSetWindowLong (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2044 GWL_STYLE, style & ~WS_DISABLED);
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2045 else
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2046 qxeSetWindowLong (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2047 GWL_STYLE, style | WS_DISABLED);
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2048 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2049 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2050
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2051 #ifdef HAVE_WIDGETS
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2052
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2053 /* Account for some of the limitations with widget images. */
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2054 static int
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2055 mswindows_widget_border_width (void)
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2056 {
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2057 return DEFAULT_WIDGET_BORDER_WIDTH;
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2058 }
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2059
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2060 /* register widgets into our hashtable so that we can cope with the
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2061 callbacks. The hashtable is weak so deregistration is handled
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2062 automatically */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2063 static int
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2064 mswindows_register_gui_item (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2065 Lisp_Object gui, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2066 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2067 Lisp_Object frame = DOMAIN_FRAME (domain);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2068 struct frame *f = XFRAME (frame);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2069 int id = gui_item_id_hash (FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2070 gui,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2071 WIDGET_GLYPH_SLOT);
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2072 Fputhash (make_fixnum (id), image_instance,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2073 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f));
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2074 Fputhash (make_fixnum (id), XGUI_ITEM (gui)->callback,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2075 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f));
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2076 Fputhash (make_fixnum (id), XGUI_ITEM (gui)->callback_ex,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2077 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2078 return id;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2079 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2080
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2081 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2082 mswindows_register_widget_instance (Lisp_Object instance, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2083 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2084 return mswindows_register_gui_item (instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2085 XIMAGE_INSTANCE_WIDGET_ITEM (instance),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2086 domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2087 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2088
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2089 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2090 mswindows_subwindow_instantiate (Lisp_Object image_instance,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2091 Lisp_Object UNUSED (instantiator),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2092 Lisp_Object UNUSED (pointer_fg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2093 Lisp_Object UNUSED (pointer_bg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2094 int UNUSED (dest_mask), Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2095 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2096 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2097 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2098 Lisp_Object frame = DOMAIN_FRAME (domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2099 HWND wnd;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2100
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2101 CHECK_MSWINDOWS_DEVICE (device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2102
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2103 /* have to set the type this late in case there is no device
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2104 instantiation for a widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2105 IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2106 /* Allocate space for the clip window */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2107 ii->data = xnew_and_zero (struct mswindows_subwindow_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2108
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2109 if ((IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2110 = qxeCreateWindowEx (
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2111 0, /* EX flags */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2112 XETEXT (XEMACS_CONTROL_CLASS),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2113 0, /* text */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2114 WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2115 0, /* starting x position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2116 0, /* starting y position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2117 IMAGE_INSTANCE_WIDGET_WIDTH (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2118 IMAGE_INSTANCE_WIDGET_HEIGHT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2119 /* parent window */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2120 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2121 NULL, /* No menu */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2122 NULL, /* must be null for this class */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2123 NULL)) == NULL)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2124 gui_error ("window creation failed with code",
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2125 make_fixnum (GetLastError()));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2126
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2127 wnd = qxeCreateWindow (XETEXT ("STATIC"), XETEXT (""),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2128 WS_CHILD,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2129 0, /* starting x position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2130 0, /* starting y position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2131 IMAGE_INSTANCE_WIDGET_WIDTH (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2132 IMAGE_INSTANCE_WIDGET_HEIGHT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2133 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2134 0,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2135 (HINSTANCE)
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2136 qxeGetWindowLongPtr
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2137 (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2138 GWLP_HINSTANCE),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2139 NULL);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2140
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2141 qxeSetWindowLongPtr (wnd, GWLP_USERDATA, (LONG_PTR)STORE_LISP_IN_VOID(image_instance));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2142 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2143 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2144
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2145 #endif /* HAVE_WIDGETS */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2146
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2147 static int
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2148 mswindows_image_instance_equal (Lisp_Image_Instance *p1,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2149 Lisp_Image_Instance *p2, int UNUSED (depth))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2150 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2151 switch (IMAGE_INSTANCE_TYPE (p1))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2152 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2153 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2154 case IMAGE_COLOR_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2155 case IMAGE_POINTER:
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2156 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2157 != IMAGE_INSTANCE_MSWINDOWS_BITMAP (p2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2158 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2159 break;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2160
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2161 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2162 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2164
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2165 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2166 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2167
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
2168 static Hashcode
5192
635f4b506855 Call internal_hash() with its new arg, Win32-specific code, fixing build
Aidan Kehoe <kehoea@parhasard.net>
parents: 5191
diff changeset
2169 mswindows_image_instance_hash (Lisp_Image_Instance *p, int UNUSED (depth))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2170 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2171 switch (IMAGE_INSTANCE_TYPE (p))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2172 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2173 case IMAGE_MONO_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2174 case IMAGE_COLOR_PIXMAP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2175 case IMAGE_POINTER:
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 647
diff changeset
2176 return (Hashcode) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2177
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2178 default:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2179 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2180 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2181 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2182
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2183 /* Set all the slots in an image instance structure to reasonable
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2184 default values. This is used somewhere within an instantiate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2185 method. It is assumed that the device slot within the image
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2186 instance is already set -- this is the case when instantiate
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2187 methods are called. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2188
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2189 static void
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2190 mswindows_initialize_dibitmap_image_instance (Lisp_Image_Instance *ii,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2191 int slices,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2192 enum image_instance_type type)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2193 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2194 ii->data = xnew_and_zero (struct mswindows_image_instance_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2195 IMAGE_INSTANCE_TYPE (ii) = type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2196 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2197 IMAGE_INSTANCE_PIXMAP_MASK_FILENAME (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2198 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2199 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2200 IMAGE_INSTANCE_PIXMAP_FG (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2201 IMAGE_INSTANCE_PIXMAP_BG (ii) = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2202 IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii) = slices;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2203 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (ii) =
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2204 xnew_array_and_zero (HBITMAP, slices);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2205 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2206
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2208 #ifdef HAVE_WIDGETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2209
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2210 /************************************************************************/
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2211 /* widgets */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2212 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2213 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2214 mswindows_widget_instantiate (Lisp_Object image_instance,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2215 Lisp_Object UNUSED (instantiator),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2216 Lisp_Object UNUSED (pointer_fg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2217 Lisp_Object UNUSED (pointer_bg),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1913
diff changeset
2218 int UNUSED (dest_mask), Lisp_Object domain,
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
2219 const CIbyte *class_, int flags, int exflags)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2220 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2221 /* this function can call lisp */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2222 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2223 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), style;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2224 Lisp_Object frame = DOMAIN_FRAME (domain);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2225 Extbyte *nm = 0;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2226 Extbyte *classext;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2227 HWND wnd;
5921
68639fb08af8 no obvious 64 vs. 32 pblms in compilation, but still crashing in event-msw
Henry Thompson <ht@markup.co.uk>
parents: 5920
diff changeset
2228 intptr_t id = -1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2229 Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2230 Lisp_Gui_Item *pgui = XGUI_ITEM (gui);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2231
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2232 CHECK_MSWINDOWS_DEVICE (device);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2233
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2234 if (!gui_item_active_p (gui))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2235 flags |= WS_DISABLED;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2236
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2237 style = pgui->style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2238
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2239 if (!NILP (pgui->callback) || !NILP (pgui->callback_ex))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2240 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2241 id = mswindows_register_widget_instance (image_instance, domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2242 }
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2243
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2244 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2245 nm = LISP_STRING_TO_TSTR (IMAGE_INSTANCE_WIDGET_TEXT (ii));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2246
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2247 /* allocate space for the clip window and then allocate the clip window */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2248 ii->data = xnew_and_zero (struct mswindows_subwindow_data);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2250 if ((IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2251 = qxeCreateWindowEx (WS_EX_CONTROLPARENT, /* EX flags */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2252 XETEXT (XEMACS_CONTROL_CLASS),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2253 0, /* text */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2254 WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_CHILD,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2255 0, /* starting x position */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2256 0, /* starting y position */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2257 IMAGE_INSTANCE_WIDGET_WIDTH (ii),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2258 IMAGE_INSTANCE_WIDGET_HEIGHT (ii),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2259 /* parent window */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2260 DOMAIN_MSWINDOWS_HANDLE (domain),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2261 (HMENU)id, /* No menu */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2262 NULL, /* must be null for this class */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2263 NULL)) == NULL)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2264 gui_error ("window creation failed with code",
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2265 make_fixnum (GetLastError()));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2266
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2267 classext = ITEXT_TO_TSTR (class_);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2268
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2269 if ((wnd = qxeCreateWindowEx (exflags /* | WS_EX_NOPARENTNOTIFY*/,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2270 classext,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2271 nm,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2272 flags | WS_CHILD | WS_VISIBLE,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2273 0, /* starting x position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2274 0, /* starting y position */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2275 IMAGE_INSTANCE_WIDGET_WIDTH (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2276 IMAGE_INSTANCE_WIDGET_HEIGHT (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2277 /* parent window */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2278 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2279 (HMENU)id, /* No menu */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2280 (HINSTANCE)
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2281 qxeGetWindowLongPtr
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2282 (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2283 GWLP_HINSTANCE),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2284 NULL)) == NULL)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2285 gui_error ("window creation failed with code",
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2286 make_fixnum (GetLastError()));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2287
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2288 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd;
5920
0f2338afbabf Minimum necessary to get started:
Henry Thompson <ht@markup.co.uk>
parents: 5581
diff changeset
2289 qxeSetWindowLongPtr (wnd, GWLP_USERDATA, (LONG_PTR)STORE_LISP_IN_VOID(image_instance));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2290 /* set the widget font from the widget face */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2291 if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2292 qxeSendMessage (wnd, WM_SETFONT,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2293 (WPARAM) mswindows_widget_hfont
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2294 (IMAGE_INSTANCE_WIDGET_FACE (ii), domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2295 IMAGE_INSTANCE_WIDGET_TEXT (ii)),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2296 MAKELPARAM (TRUE, 0));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2297 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2298
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2299 /* Instantiate a native layout widget. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2300 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2301 mswindows_native_layout_instantiate (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2302 Lisp_Object instantiator,
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2303 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2304 Lisp_Object pointer_bg,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2305 int dest_mask, Lisp_Object domain)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2306 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2307 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2308
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2309 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2310 pointer_bg, dest_mask, domain, "STATIC",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2311 /* Approximation to styles available with
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2312 an XEmacs layout. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2313 (EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2314 Qetched_in) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2315 EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2316 Qetched_out) ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2317 GLYPHP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2318 ? SS_ETCHEDFRAME : SS_SUNKEN) | DS_CONTROL,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2319 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2320 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2321
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2322 /* Instantiate a button widget. Unfortunately instantiated widgets are
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2323 particular to a frame since they need to have a parent. It's not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2324 like images where you just select the image into the context you
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2325 want to display it in and BitBlt it. So image instances can have a
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2326 many-to-one relationship with things you see, whereas widgets can
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2327 only be one-to-one (i.e. per frame) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2328 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2329 mswindows_button_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2330 Lisp_Object instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2331 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2332 int dest_mask, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2333 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2334 /* This function can call lisp */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2335 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2336 HWND wnd;
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2337 int flags = WS_TABSTOP | BS_NOTIFY;
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2338 /* BS_NOTIFY #### is needed to get exotic feedback only. Since we
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2339 seem to want nothing beyond BN_CLICK, the style is perhaps not
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
2340 necessary -- kkm */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2341 Lisp_Object style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2342 Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2343 Lisp_Gui_Item *pgui = XGUI_ITEM (gui);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2344 Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2345
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2346 if (!NILP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2347 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2348 if (!IMAGE_INSTANCEP (glyph))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2349 glyph = glyph_image_instance (glyph, domain, ERROR_ME, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2350
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2351 if (IMAGE_INSTANCEP (glyph))
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2352 flags |= XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ?
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2353 BS_BITMAP : BS_ICON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2354 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2355
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2356 style = pgui->style;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2357
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2358 /* #### consider using the default face for radio and toggle
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2359 buttons. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2360 if (EQ (style, Qradio))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2361 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2362 flags |= BS_RADIOBUTTON;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2363 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2364 else if (EQ (style, Qtoggle))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2365 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2366 flags |= BS_AUTOCHECKBOX;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2367 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2368 else
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2369 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2370 flags |= BS_DEFPUSHBUTTON;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2371 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2373 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2374 pointer_bg, dest_mask, domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2375 "BUTTON", flags, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2376
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2377 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2378 /* set the checked state */
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2379 if (gui_item_selected_p (gui))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2380 qxeSendMessage (wnd, BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2381 else
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2382 qxeSendMessage (wnd, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2383 /* add the image if one was given */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2384 if (!NILP (glyph) && IMAGE_INSTANCEP (glyph)
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2385 &&
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2386 IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (glyph)))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2387 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2388 qxeSendMessage (wnd, BM_SETIMAGE,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2389 (WPARAM) (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ?
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2390 IMAGE_BITMAP : IMAGE_ICON),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2391 (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ?
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2392 (LPARAM) XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) :
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2393 (LPARAM) XIMAGE_INSTANCE_MSWINDOWS_ICON (glyph)));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2394 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2395 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2396
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2397 /* Update the state of a button. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2398 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2399 mswindows_button_redisplay (Lisp_Object image_instance)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2400 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2401 /* This function can GC if IN_REDISPLAY is false. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2402 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2403
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2404 /* buttons checked or otherwise */
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2405 if (gui_item_selected_p (IMAGE_INSTANCE_WIDGET_ITEM (ii)))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2406 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2407 BM_SETCHECK, (WPARAM)BST_CHECKED, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2408 else
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2409 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2410 BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2411 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2412
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2413 /* instantiate an edit control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2414 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2415 mswindows_edit_field_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2416 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2417 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2418 Lisp_Object pointer_bg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2419 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2420 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2421 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2422 pointer_bg, dest_mask, domain, "EDIT",
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2423 ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2424 | WS_BORDER, WS_EX_CLIENTEDGE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2425 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2426
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2427 /* instantiate a progress gauge */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2428 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2429 mswindows_progress_gauge_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2430 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2431 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2432 Lisp_Object pointer_bg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2433 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2434 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2435 HWND wnd;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2436 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2437 Lisp_Object val;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2438 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2439 pointer_bg, dest_mask, domain, PROGRESS_CLASS,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2440 WS_BORDER | PBS_SMOOTH, WS_EX_CLIENTEDGE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2441 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2442 /* set the colors */
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2443 #if 0 /* #### fix this */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2444 qxeSendMessage (wnd, PBM_SETBKCOLOR, 0,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2445 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2446 (XCOLOR_INSTANCE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2447 (FACE_BACKGROUND
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2448 (XIMAGE_INSTANCE_WIDGET_FACE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2449 XIMAGE_INSTANCE_FRAME (ii))))));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2450 qxeSendMessage (wnd, PBM_SETBARCOLOR, 0,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2451 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2452 (XCOLOR_INSTANCE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2453 (FACE_FOREGROUND
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2454 (XIMAGE_INSTANCE_WIDGET_FACE (ii),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2455 XIMAGE_INSTANCE_FRAME (ii))))));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2456 #endif
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2457 val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEMS (ii))->value;
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2458 CHECK_FIXNUM (val);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2459 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2460 PBM_SETPOS, (WPARAM)XFIXNUM (val), 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2461 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2462
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2463 /* instantiate a tree view widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2464 static HTREEITEM add_tree_item (Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2465 HWND wnd, HTREEITEM parent, Lisp_Object item,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2466 int children, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2467 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2468 HTREEITEM ret;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2469 TV_INSERTSTRUCTW tvitem;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2470
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2471 tvitem.hParent = parent;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2472 tvitem.hInsertAfter = TVI_LAST;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2473 tvitem.item.mask = TVIF_TEXT | TVIF_CHILDREN;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2474 tvitem.item.cChildren = children;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2475
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2476 if (GUI_ITEMP (item))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2477 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2478 tvitem.item.lParam =
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2479 mswindows_register_gui_item (image_instance, item, domain);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2480 tvitem.item.mask |= TVIF_PARAM;
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2481 tvitem.item.pszText =
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2482 (LPWSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2483 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2484 else
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2485 tvitem.item.pszText = (LPWSTR) LISP_STRING_TO_TSTR (item);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2486
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
2487 tvitem.item.cchTextMax = qxetcslen ((Extbyte *) tvitem.item.pszText);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2488
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2489 if ((ret = (HTREEITEM) qxeSendMessage (wnd, TVM_INSERTITEM,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2490 0, (LPARAM) &tvitem)) == 0)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2491 gui_error ("error adding tree view entry", item);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2492
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2493 return ret;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2494 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2495
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2496 static void add_tree_item_list (Lisp_Object image_instance,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2497 HWND wnd, HTREEITEM parent, Lisp_Object list,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2498 Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2499 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2500 Lisp_Object rest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2501
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2502 /* get the first item */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2503 parent = add_tree_item (image_instance, wnd, parent, XCAR (list), TRUE, domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2504 /* recursively add items to the tree view */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2505 LIST_LOOP (rest, XCDR (list))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2506 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2507 if (LISTP (XCAR (rest)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2508 add_tree_item_list (image_instance, wnd, parent, XCAR (rest), domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2509 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2510 add_tree_item (image_instance, wnd, parent, XCAR (rest), FALSE, domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2511 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2512 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2513
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2514 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2515 mswindows_tree_view_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2516 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2517 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2518 Lisp_Object pointer_bg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2519 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2520 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2521 Lisp_Object rest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2522 HWND wnd;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2523 HTREEITEM parent;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2524 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2525 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2526 pointer_bg, dest_mask, domain, WC_TREEVIEW,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2527 WS_TABSTOP | WS_BORDER | PBS_SMOOTH
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2528 | TVS_HASLINES | TVS_HASBUTTONS,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2529 WS_EX_CLIENTEDGE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2530
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2531 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2532
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2533 /* define a root */
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2534 parent = add_tree_item (image_instance, wnd, NULL,
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2535 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2536 TRUE, domain);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2537
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2538 /* recursively add items to the tree view */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2539 /* add items to the tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2540 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2541 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2542 if (LISTP (XCAR (rest)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2543 add_tree_item_list (image_instance, wnd, parent, XCAR (rest), domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2544 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2545 add_tree_item (image_instance, wnd, parent, XCAR (rest), FALSE, domain);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2546 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2547 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2548
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2549 /* Set the properties of a tree view. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2550 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2551 mswindows_tree_view_redisplay (Lisp_Object image_instance)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2552 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2553 /* This function can GC if IN_REDISPLAY is false. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2554 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2555
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2556 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2557 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2558 HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2559 Lisp_Object rest;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2560 HTREEITEM parent;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2561 /* Delete previous items. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2562 qxeSendMessage (wnd, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2563 /* define a root */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2564 parent = add_tree_item (image_instance, wnd, NULL,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2565 XCAR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2566 TRUE, IMAGE_INSTANCE_DOMAIN (ii));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2567
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2568 /* recursively add items to the tree view */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2569 /* add items to the tab */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2570 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2571 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2572 if (LISTP (XCAR (rest)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2573 add_tree_item_list (image_instance, wnd, parent, XCAR (rest),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2574 IMAGE_INSTANCE_DOMAIN (ii));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2575 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2576 add_tree_item (image_instance, wnd, parent, XCAR (rest), FALSE,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2577 IMAGE_INSTANCE_DOMAIN (ii));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2578 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2579 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2580 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2581
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2582 /* instantiate a tab control */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2583 static int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2584 add_tab_item (Lisp_Object image_instance,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2585 HWND wnd, Lisp_Object item,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2586 Lisp_Object domain, int i)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2587 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2588 TC_ITEMW tcitem;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2589 int ret = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2590
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2591 tcitem.mask = TCIF_TEXT;
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2592
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2593 if (GUI_ITEMP (item))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2594 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2595 tcitem.lParam =
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2596 mswindows_register_gui_item (image_instance, item, domain);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2597 tcitem.mask |= TCIF_PARAM;
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2598 tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (XGUI_ITEM (item)->name);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2599 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2600 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2601 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2602 CHECK_STRING (item);
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2603 tcitem.pszText = (XELPTSTR) LISP_STRING_TO_TSTR (item);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2604 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2605
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2367
diff changeset
2606 tcitem.cchTextMax = qxetcslen ((Extbyte *) tcitem.pszText);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2607
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2608 if ((ret = qxeSendMessage (wnd, TCM_INSERTITEM, i, (LPARAM) &tcitem)) < 0)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2609 gui_error ("error adding tab entry", item);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2611 return ret;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2612 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2613
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2614 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2615 mswindows_tab_control_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2616 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2617 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2618 Lisp_Object pointer_bg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2619 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2620 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2621 /* This function can call lisp */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2622 Lisp_Object rest;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2623 HWND wnd;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2624 int i = 0, selected = 0;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2625 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2626 Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2627 unsigned int flags = WS_TABSTOP;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2628
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2629 if (EQ (orient, Qleft) || EQ (orient, Qright))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2630 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2631 flags |= TCS_VERTICAL | TCS_MULTILINE;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2632 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2633 if (EQ (orient, Qright) || EQ (orient, Qbottom))
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2634 {
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2635 flags |= TCS_BOTTOM;
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2636 }
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2637
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2638 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2639 pointer_bg, dest_mask, domain, WC_TABCONTROL,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2640 /* borders don't suit tabs so well */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2641 flags, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2642 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2643 /* add items to the tab */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2644 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2645 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2646 int idx = add_tab_item (image_instance, wnd, XCAR (rest), domain, i);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2647 assert (idx == i);
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2648 if (gui_item_selected_p (XCAR (rest)))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2649 selected = i;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2650 i++;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2651 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2652 qxeSendMessage (wnd, TCM_SETCURSEL, selected, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2653 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2654
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2655 /* Set the properties of a tab control. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2656 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2657 mswindows_tab_control_redisplay (Lisp_Object image_instance)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2658 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2659 /* This function can GC if IN_REDISPLAY is false. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2660 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2661 #ifdef DEBUG_WIDGET_OUTPUT
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1204
diff changeset
2662 stderr_out ("tab control %p redisplayed\n",
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1204
diff changeset
2663 IMAGE_INSTANCE_SUBWINDOW_ID (ii));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2664 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2665 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2666 ||
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2667 IMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (ii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2668 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2669 HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2670 int i = 0, selected_idx = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2671 Lisp_Object rest;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2672
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2673 assert (!NILP (IMAGE_INSTANCE_WIDGET_ITEMS (ii)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2674
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2675 /* If only the order has changed then simply select the first
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2676 one. This stops horrendous rebuilding of the tabs each time
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2677 you click on one. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2678 if (tab_control_order_only_changed (image_instance))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2679 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2680 Lisp_Object selected =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2681 gui_item_list_find_selected
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2682 (NILP (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)) ?
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2683 XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)) :
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2684 XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2685
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2686 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2687 {
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2688 if (gui_item_equal_sans_selected (XCAR (rest), selected, 0))
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2689 {
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1204
diff changeset
2690 Lisp_Object old_selected =
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1204
diff changeset
2691 gui_item_list_find_selected
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2692 (XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2693
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2694 /* Pick up the new selected item. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2695 XGUI_ITEM (old_selected)->selected =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2696 XGUI_ITEM (XCAR (rest))->selected;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2697 XGUI_ITEM (XCAR (rest))->selected =
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2698 XGUI_ITEM (selected)->selected;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2699 /* We're not actually changing the items. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2700 IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii) = 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2701 IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2702
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2703 qxeSendMessage (wnd, TCM_SETCURSEL, i, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2704 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2705 stderr_out ("tab control %p selected item %d\n",
1318
b531bf8658e9 [xemacs-hg @ 2003-02-21 06:56:46 by ben]
ben
parents: 1204
diff changeset
2706 IMAGE_INSTANCE_SUBWINDOW_ID (ii), i);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2707 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2708 break;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2709 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2710 i++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2711 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2712 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2713 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2714 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2715 /* delete the pre-existing items */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2716 qxeSendMessage (wnd, TCM_DELETEALLITEMS, 0, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2717
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2718 /* add items to the tab */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2719 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii)))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2720 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2721 add_tab_item (image_instance, wnd, XCAR (rest),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2722 IMAGE_INSTANCE_FRAME (ii), i);
1913
7473844a83d3 [xemacs-hg @ 2004-02-17 15:20:41 by james]
james
parents: 1743
diff changeset
2723 if (gui_item_selected_p (XCAR (rest)))
454
d7a9135ec789 Import from CVS: tag r21-2-42
cvs
parents: 444
diff changeset
2724 selected_idx = i;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2725 i++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2726 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2727 qxeSendMessage (wnd, TCM_SETCURSEL, selected_idx, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2728 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2729 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2730 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2731
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2732 /* instantiate a static control possible for putting other things in */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2733 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2734 mswindows_label_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2735 Lisp_Object instantiator,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2736 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2737 int dest_mask, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2738 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2739 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2740 pointer_bg, dest_mask, domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2741 "STATIC", 0, WS_EX_STATICEDGE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2742 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2743
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2744 /* instantiate a scrollbar control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2745 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2746 mswindows_scrollbar_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2747 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2748 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2749 Lisp_Object pointer_bg,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2750 int dest_mask, Lisp_Object domain)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2751 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2752 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2753 pointer_bg, dest_mask, domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2754 "SCROLLBAR", WS_TABSTOP, WS_EX_CLIENTEDGE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2755 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2757 /* instantiate a combo control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2758 static void
502
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2759 mswindows_combo_box_instantiate (Lisp_Object image_instance,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2760 Lisp_Object instantiator,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2761 Lisp_Object pointer_fg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2762 Lisp_Object pointer_bg,
7039e6323819 [xemacs-hg @ 2001-05-04 22:41:46 by ben]
ben
parents: 454
diff changeset
2763 int dest_mask, Lisp_Object domain)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2764 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2765 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2766 HWND wnd;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2767 Lisp_Object rest;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2768 Lisp_Object items = find_keyword_in_vector (instantiator, Q_items);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2769 int len, height;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2770
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2771 /* Maybe ought to generalise this more but it may be very windows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2772 specific. In windows the window height of a combo box is the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2773 height when the combo box is open. Thus we need to set the height
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2774 before creating the window and then reset it to a single line
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2775 after the window is created so that redisplay does the right
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2776 thing. */
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2777 widget_instantiate (image_instance, instantiator, pointer_fg,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2778 pointer_bg, dest_mask, domain);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2779
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2780 /* We now have everything right apart from the height. */
5047
07dcc7000bbf put width before height consistently, fix a real bug found in the process
Ben Wing <ben@xemacs.org>
parents: 5013
diff changeset
2781 default_face_font_info (domain, 0, 0, 0, &height, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2782 GET_LIST_LENGTH (items, len);
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2783
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2784 height = (height + DEFAULT_WIDGET_BORDER_WIDTH * 2 ) * len;
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2785 IMAGE_INSTANCE_HEIGHT (ii) = height;
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2786
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2787 /* Now create the widget. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2788 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2789 pointer_bg, dest_mask, domain,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2790 "COMBOBOX",
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2791 WS_BORDER | WS_TABSTOP | CBS_DROPDOWN
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
2792 | CBS_AUTOHSCROLL
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2793 | CBS_HASSTRINGS | WS_VSCROLL,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2794 WS_EX_CLIENTEDGE);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2795 /* Reset the height. layout will probably do this safely, but better make sure. */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2796 image_instance_layout (image_instance,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2797 IMAGE_UNSPECIFIED_GEOMETRY,
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2798 IMAGE_UNSPECIFIED_GEOMETRY,
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2799 IMAGE_UNCHANGED_GEOMETRY,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2800 IMAGE_UNCHANGED_GEOMETRY,
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2801 domain);
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2802
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2803 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2804 /* add items to the combo box */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2805 qxeSendMessage (wnd, CB_RESETCONTENT, 0, 0);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2806 LIST_LOOP (rest, items)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2807 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2808 Extbyte *lparam;
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2809 lparam = LISP_STRING_TO_TSTR (XCAR (rest));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2810 if (qxeSendMessage (wnd, CB_ADDSTRING, 0, (LPARAM)lparam) == CB_ERR)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 558
diff changeset
2811 gui_error ("error adding combo entries", instantiator);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2812 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2813 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2814
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2815 /* get properties of a control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2816 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2817 mswindows_widget_property (Lisp_Object image_instance, Lisp_Object prop)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2818 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2819 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2820 HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2821 /* get the text from a control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2822 if (EQ (prop, Q_text))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2823 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2824 Charcount tchar_len = qxeSendMessage (wnd, WM_GETTEXTLENGTH, 0, 0);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
2825 Extbyte *buf = alloca_extbytes (XETCHAR_SIZE * (tchar_len + 1));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2826
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2827 qxeSendMessage (wnd, WM_GETTEXT, (WPARAM)tchar_len + 1, (LPARAM) buf);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2828 return build_tstr_string (buf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2829 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2830 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2831 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2832
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2833 /* get properties of a button */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2834 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2835 mswindows_button_property (Lisp_Object image_instance, Lisp_Object prop)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2836 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2837 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2838 HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2839 /* check the state of a button */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2840 if (EQ (prop, Q_selected))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2841 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2842 if (qxeSendMessage (wnd, BM_GETSTATE, 0, 0) & BST_CHECKED)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2843 return Qt;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2844 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2845 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2846 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2847 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2848 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2849
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2850 /* get properties of a combo box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2851 static Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2852 mswindows_combo_box_property (Lisp_Object image_instance, Lisp_Object prop)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2853 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2854 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2855 HWND wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2856 /* get the text from a control */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2857 if (EQ (prop, Q_text))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2858 {
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2859 long item = qxeSendMessage (wnd, CB_GETCURSEL, 0, 0);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2860 Charcount tchar_len = qxeSendMessage (wnd, CB_GETLBTEXTLEN,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2861 (WPARAM)item, 0);
2367
ecf1ebac70d8 [xemacs-hg @ 2004-11-04 23:05:23 by ben]
ben
parents: 2333
diff changeset
2862 Extbyte *buf = alloca_extbytes (XETCHAR_SIZE * (tchar_len + 1));
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2863 qxeSendMessage (wnd, CB_GETLBTEXT, (WPARAM)item, (LPARAM) buf);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2864 return build_tstr_string (buf);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2865 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2866 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2867 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2868
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2869 /* set the properties of a progress gauge */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2870 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2871 mswindows_progress_gauge_redisplay (Lisp_Object image_instance)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2872 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
2873 Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2874
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2875 if (IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2876 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2877 Lisp_Object val;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2878 val = XGUI_ITEM (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))->value;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2879 #ifdef DEBUG_WIDGET_OUTPUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2880 stderr_out ("progress gauge displayed value on %p updated to %ld\n",
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2881 WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2882 XFIXNUM(val));
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2883 #endif
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2884 CHECK_FIXNUM (val);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2885 qxeSendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii),
5581
56144c8593a8 Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5474
diff changeset
2886 PBM_SETPOS, (WPARAM)XFIXNUM (val), 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2887 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2888 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2889
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2890 LRESULT WINAPI
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2891 mswindows_control_wnd_proc (HWND hwnd, UINT msg,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2892 WPARAM wParam, LPARAM lParam)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2893 {
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2894 switch (msg)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2895 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2896 case WM_NOTIFY:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2897 case WM_COMMAND:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2898 case WM_CTLCOLORBTN:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2899 case WM_CTLCOLORLISTBOX:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2900 case WM_CTLCOLOREDIT:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2901 case WM_CTLCOLORSTATIC:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2902 case WM_CTLCOLORSCROLLBAR:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2903
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 434
diff changeset
2904 return mswindows_wnd_proc (GetParent (hwnd), msg, wParam, lParam);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2905 default:
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2906 return qxeDefWindowProc (hwnd, msg, wParam, lParam);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2907 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2908 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2909
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2910 static void
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2911 mswindows_widget_query_string_geometry (Lisp_Object string, Lisp_Object face,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2912 int *width, int *height,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2913 Lisp_Object domain)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2914 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2915 if (height)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2916 query_string_geometry (string, face, 0, height, 0, domain);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2917
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2918 if (width)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2919 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2920 HDC hdc = FRAME_MSWINDOWS_DC (DOMAIN_XFRAME (domain));
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2921 Extbyte *str;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2922 Bytecount len;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2923 SIZE size;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2924
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2925 SelectObject (hdc, mswindows_widget_hfont (face, domain, string));
4981
4aebb0131297 Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents: 4952
diff changeset
2926 LISP_STRING_TO_SIZED_EXTERNAL (string, str, len, Qmswindows_tstr);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2927 qxeGetTextExtentPoint32 (hdc, str, len / XETCHAR_SIZE, &size);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2928 *width = size.cx;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2929 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2930 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2931
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2932 #endif /* HAVE_WIDGETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2933
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2934
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2935 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2936 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2937 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2938
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2939 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2940 syms_of_glyphs_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2941 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2942 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2943
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2944 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2945 console_type_create_glyphs_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2946 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2947 /* image methods - display */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2948 CONSOLE_HAS_METHOD (mswindows, print_image_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2949 CONSOLE_HAS_METHOD (mswindows, finalize_image_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2950 CONSOLE_HAS_METHOD (mswindows, unmap_subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2951 CONSOLE_HAS_METHOD (mswindows, map_subwindow);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2952 CONSOLE_HAS_METHOD (mswindows, redisplay_subwindow);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2953 CONSOLE_HAS_METHOD (mswindows, resize_subwindow);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2954 CONSOLE_HAS_METHOD (mswindows, redisplay_widget);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2955 CONSOLE_HAS_METHOD (mswindows, image_instance_equal);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2956 CONSOLE_HAS_METHOD (mswindows, image_instance_hash);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2957 CONSOLE_HAS_METHOD (mswindows, init_image_instance_from_eimage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2958 CONSOLE_HAS_METHOD (mswindows, locate_pixmap_file);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2959 #ifdef HAVE_WIDGETS
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2960 CONSOLE_HAS_METHOD (mswindows, widget_query_string_geometry);
863
42375619fa45 [xemacs-hg @ 2002-06-04 06:03:59 by andyp]
andyp
parents: 853
diff changeset
2961 CONSOLE_HAS_METHOD (mswindows, widget_border_width);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2962 #endif
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2963
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2964 /* image methods - printer */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2965 CONSOLE_INHERITS_METHOD (msprinter, mswindows, print_image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2966 CONSOLE_INHERITS_METHOD (msprinter, mswindows, finalize_image_instance);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2967 CONSOLE_INHERITS_METHOD (msprinter, mswindows, image_instance_equal);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2968 CONSOLE_INHERITS_METHOD (msprinter, mswindows, image_instance_hash);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2969 CONSOLE_INHERITS_METHOD (msprinter, mswindows,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 665
diff changeset
2970 init_image_instance_from_eimage);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2971 CONSOLE_INHERITS_METHOD (msprinter, mswindows, locate_pixmap_file);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2972 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2973
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2974 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2975 image_instantiator_format_create_glyphs_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2976 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2977 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, nothing);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2978 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, string);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2979 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, formatted_string);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2980 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, inherit);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2981 /* image-instantiator types */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2982 INITIALIZE_DEVICE_IIFORMAT (mswindows, xbm);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2983 INITIALIZE_DEVICE_IIFORMAT (msprinter, xbm);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2984 IIFORMAT_HAS_DEVMETHOD (mswindows, xbm, instantiate);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2985 IIFORMAT_INHERITS_DEVMETHOD (msprinter, mswindows, xbm, instantiate);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2986 #ifdef HAVE_XPM
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2987 INITIALIZE_DEVICE_IIFORMAT (mswindows, xpm);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2988 INITIALIZE_DEVICE_IIFORMAT (msprinter, xpm);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2989 IIFORMAT_HAS_DEVMETHOD (mswindows, xpm, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2990 IIFORMAT_INHERITS_DEVMETHOD (msprinter, mswindows, xpm, instantiate);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2991 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2992 #ifdef HAVE_XFACE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2993 INITIALIZE_DEVICE_IIFORMAT (mswindows, xface);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2994 INITIALIZE_DEVICE_IIFORMAT (msprinter, xface);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2995 IIFORMAT_HAS_DEVMETHOD (mswindows, xface, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2996 IIFORMAT_INHERITS_DEVMETHOD (msprinter, mswindows, xface, instantiate);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2997 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2998 #ifdef HAVE_JPEG
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
2999 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, jpeg);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3000 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3001 #ifdef HAVE_TIFF
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3002 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, tiff);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
3003 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3004 #ifdef HAVE_PNG
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3005 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, png);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
3006 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3007 #ifdef HAVE_GIF
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3008 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, gif);
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
3009 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3010 #ifdef HAVE_WIDGETS
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3011 INITIALIZE_DEVICE_IIFORMAT (mswindows, widget);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3012 IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3013 /* layout widget */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3014 IIFORMAT_VALID_CONSOLE (mswindows, layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3015 INITIALIZE_DEVICE_IIFORMAT (mswindows, native_layout);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3016 IIFORMAT_HAS_DEVMETHOD (mswindows, native_layout, instantiate);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3017 /* button widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3018 INITIALIZE_DEVICE_IIFORMAT (mswindows, button);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3019 IIFORMAT_HAS_DEVMETHOD (mswindows, button, property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3020 IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3021 IIFORMAT_HAS_DEVMETHOD (mswindows, button, redisplay);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3022 /* edit-field widget */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3023 INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3024 IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3025 /* subwindow */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3026 INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3027 IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3028 /* label */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3029 INITIALIZE_DEVICE_IIFORMAT (mswindows, label);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3030 IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3031 /* combo box */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3032 INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3033 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3034 IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3035 /* scrollbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3036 INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3037 IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3038 /* progress gauge */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3039 INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3040 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, redisplay);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3041 IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3042 /* tree view widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3043 INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3044 IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3045 IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, redisplay);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3046 /* tab control widget */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3047 INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3048 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3049 IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, redisplay);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3050 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3051 /* windows bitmap format */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3052 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp, "bmp");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3053 IIFORMAT_HAS_METHOD (bmp, validate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3054 IIFORMAT_HAS_METHOD (bmp, normalize);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3055 IIFORMAT_HAS_METHOD (bmp, possible_dest_types);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3056 IIFORMAT_HAS_METHOD (bmp, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3057
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3058 IIFORMAT_VALID_KEYWORD (bmp, Q_data, check_valid_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3059 IIFORMAT_VALID_KEYWORD (bmp, Q_file, check_valid_string);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3060 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, bmp);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3061
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3062 /* mswindows resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3063 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (mswindows_resource,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3064 "mswindows-resource");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3065
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3066 IIFORMAT_HAS_METHOD (mswindows_resource, validate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3067 IIFORMAT_HAS_METHOD (mswindows_resource, normalize);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3068 IIFORMAT_HAS_METHOD (mswindows_resource, possible_dest_types);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3069 IIFORMAT_HAS_METHOD (mswindows_resource, instantiate);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3070
434
9d177e8d4150 Import from CVS: tag r21-2-25
cvs
parents: 430
diff changeset
3071 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_type,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3072 check_valid_resource_symbol);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3073 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_id, check_valid_resource_id);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3074 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_file, check_valid_string);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
3075 IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, mswindows_resource);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3076 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3077
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3078 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3079 vars_of_glyphs_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3080 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3081 DEFVAR_LISP ("mswindows-bitmap-file-path", &Vmswindows_bitmap_file_path /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3082 A list of the directories in which mswindows bitmap files may be found.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3083 This is used by the `make-image-instance' function.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3084 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3085 Vmswindows_bitmap_file_path = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3086 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3087
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3088 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3089 complex_vars_of_glyphs_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3090 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3091 }