Mercurial > hg > xemacs-beta
comparison src/glyphs-msw.c @ 434:9d177e8d4150 r21-2-25
Import from CVS: tag r21-2-25
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:30:53 +0200 |
parents | a5df635868b2 |
children | 84b14dcb0985 |
comparison
equal
deleted
inserted
replaced
433:892ca416f0fb | 434:9d177e8d4150 |
---|---|
1 /* mswindows-specific glyph objects. | 1 /* mswindows-specific glyph objects. |
2 Copyright (C) 1998, 1999 Andy Piper. | 2 Copyright (C) 1998, 1999 Andy Piper. |
3 | 3 |
4 This file is part of XEmacs. | 4 This file is part of XEmacs. |
5 | 5 |
6 XEmacs is free software; you can redistribute it and/or modify it | 6 XEmacs is free software; you can redistribute it and/or modify it |
7 under the terms of the GNU General Public License as published by the | 7 under the terms of the GNU General Public License as published by the |
8 Free Software Foundation; either version 2, or (at your option) any | 8 Free Software Foundation; either version 2, or (at your option) any |
61 #ifdef HAVE_JPEG | 61 #ifdef HAVE_JPEG |
62 DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); | 62 DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); |
63 #endif | 63 #endif |
64 #ifdef HAVE_TIFF | 64 #ifdef HAVE_TIFF |
65 DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff); | 65 DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff); |
66 #endif | 66 #endif |
67 #ifdef HAVE_PNG | 67 #ifdef HAVE_PNG |
68 DECLARE_IMAGE_INSTANTIATOR_FORMAT (png); | 68 DECLARE_IMAGE_INSTANTIATOR_FORMAT (png); |
69 #endif | 69 #endif |
70 #ifdef HAVE_GIF | 70 #ifdef HAVE_GIF |
71 DECLARE_IMAGE_INSTANTIATOR_FORMAT (gif); | 71 DECLARE_IMAGE_INSTANTIATOR_FORMAT (gif); |
72 #endif | 72 #endif |
73 #ifdef HAVE_XPM | 73 #ifdef HAVE_XPM |
74 DEFINE_DEVICE_IIFORMAT (mswindows, xpm); | 74 DEFINE_DEVICE_IIFORMAT (mswindows, xpm); |
75 #endif | 75 #endif |
76 DEFINE_DEVICE_IIFORMAT (mswindows, xbm); | 76 DEFINE_DEVICE_IIFORMAT (mswindows, xbm); |
77 #ifdef HAVE_XFACE | 77 #ifdef HAVE_XFACE |
100 static void | 100 static void |
101 mswindows_initialize_dibitmap_image_instance (struct Lisp_Image_Instance *ii, | 101 mswindows_initialize_dibitmap_image_instance (struct Lisp_Image_Instance *ii, |
102 int slices, | 102 int slices, |
103 enum image_instance_type type); | 103 enum image_instance_type type); |
104 static void | 104 static void |
105 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image, | 105 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image, |
106 struct frame* f); | 106 struct frame* f); |
107 | 107 |
108 COLORREF mswindows_string_to_color (CONST char *name); | 108 COLORREF mswindows_string_to_color (CONST char *name); |
109 | 109 |
110 #define BPLINE(width) ((int)(~3UL & (unsigned long)((width) +3))) | 110 #define BPLINE(width) ((int)(~3UL & (unsigned long)((width) +3))) |
135 * long. Windows can actually handle rgb triples in the raw so I | 135 * long. Windows can actually handle rgb triples in the raw so I |
136 * don't see much point trying to optimize down to the best | 136 * don't see much point trying to optimize down to the best |
137 * structure - unless it has memory / color allocation implications | 137 * structure - unless it has memory / color allocation implications |
138 * .... */ | 138 * .... */ |
139 bmp_info=xnew_and_zero (BITMAPINFO); | 139 bmp_info=xnew_and_zero (BITMAPINFO); |
140 | 140 |
141 if (!bmp_info) | 141 if (!bmp_info) |
142 { | 142 { |
143 return NULL; | 143 return NULL; |
144 } | 144 } |
145 | 145 |
146 bmp_info->bmiHeader.biBitCount=24; /* just RGB triples for now */ | 146 bmp_info->bmiHeader.biBitCount=24; /* just RGB triples for now */ |
147 bmp_info->bmiHeader.biCompression=BI_RGB; /* just RGB triples for now */ | 147 bmp_info->bmiHeader.biCompression=BI_RGB; /* just RGB triples for now */ |
148 bmp_info->bmiHeader.biSizeImage=width*height*3; | 148 bmp_info->bmiHeader.biSizeImage=width*height*3; |
149 | 149 |
150 /* bitmap data needs to be in blue, green, red triples - in that | 150 /* bitmap data needs to be in blue, green, red triples - in that |
151 order, eimage is in RGB format so we need to convert */ | 151 order, eimage is in RGB format so we need to convert */ |
152 *bmp_data = xnew_array_and_zero (unsigned char, bpline * height); | 152 *bmp_data = xnew_array_and_zero (unsigned char, bpline * height); |
153 *bit_count = bpline * height; | 153 *bit_count = bpline * height; |
179 qtable = build_EImage_quantable(pic, width, height, 256); | 179 qtable = build_EImage_quantable(pic, width, height, 256); |
180 if (qtable == NULL) return NULL; | 180 if (qtable == NULL) return NULL; |
181 | 181 |
182 /* use our quantize table to allocate the colors */ | 182 /* use our quantize table to allocate the colors */ |
183 ncolors = qtable->num_active_colors; | 183 ncolors = qtable->num_active_colors; |
184 bmp_info=(BITMAPINFO*)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) + | 184 bmp_info=(BITMAPINFO*)xmalloc_and_zero (sizeof(BITMAPINFOHEADER) + |
185 sizeof(RGBQUAD) * ncolors); | 185 sizeof(RGBQUAD) * ncolors); |
186 if (!bmp_info) | 186 if (!bmp_info) |
187 { | 187 { |
188 xfree (qtable); | 188 xfree (qtable); |
189 return NULL; | 189 return NULL; |
190 } | 190 } |
191 | 191 |
192 colortbl=(RGBQUAD*)(((unsigned char*)bmp_info)+sizeof(BITMAPINFOHEADER)); | 192 colortbl=(RGBQUAD*)(((unsigned char*)bmp_info)+sizeof(BITMAPINFOHEADER)); |
193 | 193 |
194 bmp_info->bmiHeader.biBitCount=8; | 194 bmp_info->bmiHeader.biBitCount=8; |
195 bmp_info->bmiHeader.biCompression=BI_RGB; | 195 bmp_info->bmiHeader.biCompression=BI_RGB; |
196 bmp_info->bmiHeader.biSizeImage=bpline*height; | 196 bmp_info->bmiHeader.biSizeImage=bpline*height; |
197 bmp_info->bmiHeader.biClrUsed=ncolors; | 197 bmp_info->bmiHeader.biClrUsed=ncolors; |
198 bmp_info->bmiHeader.biClrImportant=ncolors; | 198 bmp_info->bmiHeader.biClrImportant=ncolors; |
199 | 199 |
200 *bmp_data = (unsigned char *) xmalloc_and_zero (bpline * height); | 200 *bmp_data = (unsigned char *) xmalloc_and_zero (bpline * height); |
201 *bit_count = bpline * height; | 201 *bit_count = bpline * height; |
202 | 202 |
203 if (!*bmp_data) | 203 if (!*bmp_data) |
204 { | 204 { |
205 xfree (qtable); | 205 xfree (qtable); |
206 xfree (bmp_info); | 206 xfree (bmp_info); |
207 return NULL; | 207 return NULL; |
208 } | 208 } |
209 | 209 |
210 /* build up an RGBQUAD colortable */ | 210 /* build up an RGBQUAD colortable */ |
211 for (i = 0; i < qtable->num_active_colors; i++) { | 211 for (i = 0; i < qtable->num_active_colors; i++) { |
212 colortbl[i].rgbRed = (BYTE) qtable->rm[i]; | 212 colortbl[i].rgbRed = (BYTE) qtable->rm[i]; |
213 colortbl[i].rgbGreen = (BYTE) qtable->gm[i]; | 213 colortbl[i].rgbGreen = (BYTE) qtable->gm[i]; |
214 colortbl[i].rgbBlue = (BYTE) qtable->bm[i]; | 214 colortbl[i].rgbBlue = (BYTE) qtable->bm[i]; |
226 bl = *ip++; | 226 bl = *ip++; |
227 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl); | 227 *dp++ = QUANT_GET_COLOR (qtable,rd,gr,bl); |
228 } | 228 } |
229 } | 229 } |
230 xfree (qtable); | 230 xfree (qtable); |
231 } | 231 } |
232 /* fix up the standard stuff */ | 232 /* fix up the standard stuff */ |
233 bmp_info->bmiHeader.biWidth=width; | 233 bmp_info->bmiHeader.biWidth=width; |
234 bmp_info->bmiHeader.biHeight=height; | 234 bmp_info->bmiHeader.biHeight=height; |
235 bmp_info->bmiHeader.biPlanes=1; | 235 bmp_info->bmiHeader.biPlanes=1; |
236 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 236 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); |
237 bmp_info->bmiHeader.biXPelsPerMeter=0; /* unless you know better */ | 237 bmp_info->bmiHeader.biXPelsPerMeter=0; /* unless you know better */ |
238 bmp_info->bmiHeader.biYPelsPerMeter=0; | 238 bmp_info->bmiHeader.biYPelsPerMeter=0; |
239 | 239 |
240 return bmp_info; | 240 return bmp_info; |
241 } | 241 } |
242 | 242 |
243 /* Given a pixmap filename, look through all of the "standard" places | 243 /* Given a pixmap filename, look through all of the "standard" places |
271 | 271 |
272 GCPRO1 (temp); | 272 GCPRO1 (temp); |
273 locate_file (temp, name, Qnil, &found, R_OK); | 273 locate_file (temp, name, Qnil, &found, R_OK); |
274 UNGCPRO; | 274 UNGCPRO; |
275 } | 275 } |
276 | 276 |
277 return found; | 277 return found; |
278 } | 278 } |
279 | 279 |
280 | 280 |
281 /* Initialize an image instance from a bitmap | 281 /* Initialize an image instance from a bitmap |
290 BITMAPINFO *bmp_info, | 290 BITMAPINFO *bmp_info, |
291 int dest_mask, | 291 int dest_mask, |
292 void *bmp_data, | 292 void *bmp_data, |
293 int bmp_bits, | 293 int bmp_bits, |
294 int slices, | 294 int slices, |
295 Lisp_Object instantiator, | 295 Lisp_Object instantiator, |
296 int x_hot, int y_hot, | 296 int x_hot, int y_hot, |
297 int create_mask) | 297 int create_mask) |
298 { | 298 { |
299 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 299 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
300 struct device *d = XDEVICE (device); | 300 struct device *d = XDEVICE (device); |
309 | 309 |
310 if (NILP (DEVICE_SELECTED_FRAME (d))) | 310 if (NILP (DEVICE_SELECTED_FRAME (d))) |
311 signal_simple_error ("No selected frame on mswindows device", device); | 311 signal_simple_error ("No selected frame on mswindows device", device); |
312 | 312 |
313 f = XFRAME (DEVICE_SELECTED_FRAME (d)); | 313 f = XFRAME (DEVICE_SELECTED_FRAME (d)); |
314 | 314 |
315 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) | 315 if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) |
316 type = IMAGE_COLOR_PIXMAP; | 316 type = IMAGE_COLOR_PIXMAP; |
317 else if (dest_mask & IMAGE_POINTER_MASK) | 317 else if (dest_mask & IMAGE_POINTER_MASK) |
318 type = IMAGE_POINTER; | 318 type = IMAGE_POINTER; |
319 else | 319 else |
320 incompatible_image_types (instantiator, dest_mask, | 320 incompatible_image_types (instantiator, dest_mask, |
321 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK); | 321 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK); |
322 hdc = FRAME_MSWINDOWS_CDC (f); | 322 hdc = FRAME_MSWINDOWS_CDC (f); |
323 | 323 |
324 bitmap=CreateDIBSection (hdc, | 324 bitmap=CreateDIBSection (hdc, |
325 bmp_info, | 325 bmp_info, |
326 DIB_RGB_COLORS, | 326 DIB_RGB_COLORS, |
327 &bmp_buf, | 327 &bmp_buf, |
328 0,0); | 328 0,0); |
329 | 329 |
330 if (!bitmap || !bmp_buf) | 330 if (!bitmap || !bmp_buf) |
331 signal_simple_error ("Unable to create bitmap", instantiator); | 331 signal_simple_error ("Unable to create bitmap", instantiator); |
332 | 332 |
350 | 350 |
351 if (create_mask) | 351 if (create_mask) |
352 { | 352 { |
353 mswindows_initialize_image_instance_mask (ii, f); | 353 mswindows_initialize_image_instance_mask (ii, f); |
354 } | 354 } |
355 | 355 |
356 if (type == IMAGE_POINTER) | 356 if (type == IMAGE_POINTER) |
357 { | 357 { |
358 mswindows_initialize_image_instance_icon(ii, TRUE); | 358 mswindows_initialize_image_instance_icon(ii, TRUE); |
359 } | 359 } |
360 } | 360 } |
370 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 370 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
371 struct device *d = XDEVICE (device); | 371 struct device *d = XDEVICE (device); |
372 struct frame *f = XFRAME (DEVICE_SELECTED_FRAME (d)); | 372 struct frame *f = XFRAME (DEVICE_SELECTED_FRAME (d)); |
373 void* bmp_buf=0; | 373 void* bmp_buf=0; |
374 HDC hdc = FRAME_MSWINDOWS_CDC (f); | 374 HDC hdc = FRAME_MSWINDOWS_CDC (f); |
375 HBITMAP bitmap = CreateDIBSection (hdc, | 375 HBITMAP bitmap = CreateDIBSection (hdc, |
376 bmp_info, | 376 bmp_info, |
377 DIB_RGB_COLORS, | 377 DIB_RGB_COLORS, |
378 &bmp_buf, | 378 &bmp_buf, |
379 0,0); | 379 0,0); |
380 | 380 |
381 if (!bitmap || !bmp_buf) | 381 if (!bitmap || !bmp_buf) |
382 signal_simple_error ("Unable to create bitmap", instantiator); | 382 signal_simple_error ("Unable to create bitmap", instantiator); |
383 | 383 |
384 /* copy in the actual bitmap */ | 384 /* copy in the actual bitmap */ |
385 memcpy (bmp_buf, bmp_data, bmp_bits); | 385 memcpy (bmp_buf, bmp_data, bmp_bits); |
388 | 388 |
389 static void | 389 static void |
390 mswindows_init_image_instance_from_eimage (struct Lisp_Image_Instance *ii, | 390 mswindows_init_image_instance_from_eimage (struct Lisp_Image_Instance *ii, |
391 int width, int height, | 391 int width, int height, |
392 int slices, | 392 int slices, |
393 unsigned char *eimage, | 393 unsigned char *eimage, |
394 int dest_mask, | 394 int dest_mask, |
395 Lisp_Object instantiator, | 395 Lisp_Object instantiator, |
396 Lisp_Object domain) | 396 Lisp_Object domain) |
397 { | 397 { |
398 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 398 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
399 BITMAPINFO* bmp_info; | 399 BITMAPINFO* bmp_info; |
400 unsigned char* bmp_data; | 400 unsigned char* bmp_data; |
401 int bmp_bits; | 401 int bmp_bits; |
402 COLORREF bkcolor; | 402 COLORREF bkcolor; |
403 int slice; | 403 int slice; |
404 | 404 |
405 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) | 405 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) |
406 signal_simple_error ("Not an mswindows device", device); | 406 signal_simple_error ("Not an mswindows device", device); |
407 | 407 |
408 /* this is a hack but MaskBlt and TransparentBlt are not supported | 408 /* this is a hack but MaskBlt and TransparentBlt are not supported |
409 on most windows variants */ | 409 on most windows variants */ |
410 bkcolor = COLOR_INSTANCE_MSWINDOWS_COLOR | 410 bkcolor = COLOR_INSTANCE_MSWINDOWS_COLOR |
411 (XCOLOR_INSTANCE (FACE_BACKGROUND (Vdefault_face, domain))); | 411 (XCOLOR_INSTANCE (FACE_BACKGROUND (Vdefault_face, domain))); |
412 | 412 |
413 for (slice = 0; slice < slices; slice++) | 413 for (slice = 0; slice < slices; slice++) |
414 { | 414 { |
415 /* build a bitmap from the eimage */ | 415 /* build a bitmap from the eimage */ |
416 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, | 416 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, |
417 eimage + (width * height * 3 * slice), | 417 eimage + (width * height * 3 * slice), |
418 &bmp_bits, &bmp_data))) | 418 &bmp_bits, &bmp_data))) |
419 { | 419 { |
420 signal_simple_error ("EImage to DIBitmap conversion failed", | 420 signal_simple_error ("EImage to DIBitmap conversion failed", |
421 instantiator); | 421 instantiator); |
427 bmp_data, bmp_bits, slices, instantiator, | 427 bmp_data, bmp_bits, slices, instantiator, |
428 0, 0, 0); | 428 0, 0, 0); |
429 else | 429 else |
430 image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice, | 430 image_instance_add_dibitmap (ii, bmp_info, bmp_data, bmp_bits, slice, |
431 instantiator); | 431 instantiator); |
432 | 432 |
433 xfree (bmp_info); | 433 xfree (bmp_info); |
434 xfree (bmp_data); | 434 xfree (bmp_data); |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 static void set_mono_pixel ( unsigned char* bits, | 438 static void set_mono_pixel ( unsigned char* bits, |
439 int bpline, int height, | 439 int bpline, int height, |
440 int x, int y, int white ) | 440 int x, int y, int white ) |
441 { | 441 { |
442 int index; | 442 int index; |
443 unsigned char bitnum; | 443 unsigned char bitnum; |
444 /* Find the byte on which this scanline begins */ | 444 /* Find the byte on which this scanline begins */ |
445 index = (height - y - 1) * bpline; | 445 index = (height - y - 1) * bpline; |
446 /* Find the byte containing this pixel */ | 446 /* Find the byte containing this pixel */ |
447 index += (x >> 3); | 447 index += (x >> 3); |
448 /* Which bit is it? */ | 448 /* Which bit is it? */ |
449 bitnum = (unsigned char)( 7 - (x % 8) ); | 449 bitnum = (unsigned char)( 7 - (x % 8) ); |
450 if( white ) /* Turn it on */ | 450 if( white ) /* Turn it on */ |
451 bits[index] |= (1<<bitnum); | 451 bits[index] |= (1<<bitnum); |
452 else /* Turn it off */ | 452 else /* Turn it off */ |
453 bits[index] &= ~(1<<bitnum); | 453 bits[index] &= ~(1<<bitnum); |
454 } | 454 } |
455 | 455 |
456 static void | 456 static void |
457 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image, | 457 mswindows_initialize_image_instance_mask (struct Lisp_Image_Instance* image, |
458 struct frame* f) | 458 struct frame* f) |
459 { | 459 { |
460 HBITMAP mask; | 460 HBITMAP mask; |
461 HGDIOBJ old = NULL; | 461 HGDIOBJ old = NULL; |
462 HDC hcdc = FRAME_MSWINDOWS_CDC (f); | 462 HDC hcdc = FRAME_MSWINDOWS_CDC (f); |
463 unsigned char* dibits; | 463 unsigned char* dibits; |
464 BITMAPINFO* bmp_info = | 464 BITMAPINFO* bmp_info = |
465 xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD)); | 465 xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD)); |
466 int i, j; | 466 int i, j; |
467 int height = IMAGE_INSTANCE_PIXMAP_HEIGHT (image); | 467 int height = IMAGE_INSTANCE_PIXMAP_HEIGHT (image); |
468 | 468 |
469 void* and_bits; | 469 void* and_bits; |
470 int maskbpline = BPLINE (((IMAGE_INSTANCE_PIXMAP_WIDTH (image)+7)/8)); | 470 int maskbpline = BPLINE ((IMAGE_INSTANCE_PIXMAP_WIDTH (image)+7)/8); |
471 int bpline = BPLINE (IMAGE_INSTANCE_PIXMAP_WIDTH (image) * 3); | 471 int bpline = BPLINE (IMAGE_INSTANCE_PIXMAP_WIDTH (image) * 3); |
472 | 472 |
473 if (!bmp_info) | 473 if (!bmp_info) |
474 return; | 474 return; |
475 | 475 |
476 bmp_info->bmiHeader.biWidth=IMAGE_INSTANCE_PIXMAP_WIDTH (image); | 476 bmp_info->bmiHeader.biWidth=IMAGE_INSTANCE_PIXMAP_WIDTH (image); |
477 bmp_info->bmiHeader.biHeight = height; | 477 bmp_info->bmiHeader.biHeight = height; |
478 bmp_info->bmiHeader.biPlanes=1; | 478 bmp_info->bmiHeader.biPlanes=1; |
479 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 479 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); |
480 bmp_info->bmiHeader.biBitCount=1; | 480 bmp_info->bmiHeader.biBitCount=1; |
481 bmp_info->bmiHeader.biCompression=BI_RGB; | 481 bmp_info->bmiHeader.biCompression=BI_RGB; |
482 bmp_info->bmiHeader.biClrUsed = 2; | 482 bmp_info->bmiHeader.biClrUsed = 2; |
483 bmp_info->bmiHeader.biClrImportant = 2; | 483 bmp_info->bmiHeader.biClrImportant = 2; |
484 bmp_info->bmiHeader.biSizeImage = height * maskbpline; | 484 bmp_info->bmiHeader.biSizeImage = height * maskbpline; |
485 bmp_info->bmiColors[0].rgbRed = 0; | 485 bmp_info->bmiColors[0].rgbRed = 0; |
486 bmp_info->bmiColors[0].rgbGreen = 0; | 486 bmp_info->bmiColors[0].rgbGreen = 0; |
487 bmp_info->bmiColors[0].rgbBlue = 0; | 487 bmp_info->bmiColors[0].rgbBlue = 0; |
488 bmp_info->bmiColors[0].rgbReserved = 0; | 488 bmp_info->bmiColors[0].rgbReserved = 0; |
489 bmp_info->bmiColors[1].rgbRed = 255; | 489 bmp_info->bmiColors[1].rgbRed = 255; |
490 bmp_info->bmiColors[1].rgbGreen = 255; | 490 bmp_info->bmiColors[1].rgbGreen = 255; |
491 bmp_info->bmiColors[1].rgbBlue = 255; | 491 bmp_info->bmiColors[1].rgbBlue = 255; |
492 bmp_info->bmiColors[0].rgbReserved = 0; | 492 bmp_info->bmiColors[0].rgbReserved = 0; |
493 | 493 |
494 if (!(mask = CreateDIBSection (hcdc, | 494 if (!(mask = CreateDIBSection (hcdc, |
495 bmp_info, | 495 bmp_info, |
496 DIB_RGB_COLORS, | 496 DIB_RGB_COLORS, |
497 &and_bits, | 497 &and_bits, |
498 0,0))) | 498 0,0))) |
499 { | 499 { |
500 xfree (bmp_info); | 500 xfree (bmp_info); |
501 return; | 501 return; |
502 } | 502 } |
507 | 507 |
508 bmp_info->bmiHeader.biWidth=IMAGE_INSTANCE_PIXMAP_WIDTH (image); | 508 bmp_info->bmiHeader.biWidth=IMAGE_INSTANCE_PIXMAP_WIDTH (image); |
509 bmp_info->bmiHeader.biHeight = -height; | 509 bmp_info->bmiHeader.biHeight = -height; |
510 bmp_info->bmiHeader.biPlanes=1; | 510 bmp_info->bmiHeader.biPlanes=1; |
511 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 511 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); |
512 bmp_info->bmiHeader.biBitCount=24; | 512 bmp_info->bmiHeader.biBitCount=24; |
513 bmp_info->bmiHeader.biCompression=BI_RGB; | 513 bmp_info->bmiHeader.biCompression=BI_RGB; |
514 bmp_info->bmiHeader.biClrUsed = 0; | 514 bmp_info->bmiHeader.biClrUsed = 0; |
515 bmp_info->bmiHeader.biClrImportant = 0; | 515 bmp_info->bmiHeader.biClrImportant = 0; |
516 bmp_info->bmiHeader.biSizeImage = height * bpline; | 516 bmp_info->bmiHeader.biSizeImage = height * bpline; |
517 | 517 |
518 dibits = xmalloc_and_zero (bpline * height); | 518 dibits = xmalloc_and_zero (bpline * height); |
519 if (GetDIBits (hcdc, | 519 if (GetDIBits (hcdc, |
520 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image), | 520 IMAGE_INSTANCE_MSWINDOWS_BITMAP (image), |
528 return; | 528 return; |
529 } | 529 } |
530 | 530 |
531 /* now set the colored bits in the mask and transparent ones to | 531 /* now set the colored bits in the mask and transparent ones to |
532 black in the original */ | 532 black in the original */ |
533 for(i=0; i<IMAGE_INSTANCE_PIXMAP_WIDTH (image); i++) | 533 for(i=0; i<IMAGE_INSTANCE_PIXMAP_WIDTH (image); i++) |
534 { | 534 { |
535 for(j=0; j<height; j++) | 535 for(j=0; j<height; j++) |
536 { | 536 { |
537 unsigned char* idx = &dibits[j * bpline + i * 3]; | 537 unsigned char* idx = &dibits[j * bpline + i * 3]; |
538 | 538 |
539 if( RGB (idx[2], idx[1], idx[0]) == transparent_color ) | 539 if( RGB (idx[2], idx[1], idx[0]) == transparent_color ) |
540 { | 540 { |
541 idx[0] = idx[1] = idx[2] = 0; | 541 idx[0] = idx[1] = idx[2] = 0; |
542 set_mono_pixel( and_bits, maskbpline, height, i, j, TRUE ); | 542 set_mono_pixel( and_bits, maskbpline, height, i, j, TRUE ); |
543 } | 543 } |
544 else | 544 else |
545 { | 545 { |
546 set_mono_pixel( and_bits, maskbpline, height, i, j, FALSE ); | 546 set_mono_pixel( and_bits, maskbpline, height, i, j, FALSE ); |
547 } | 547 } |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
556 bmp_info, | 556 bmp_info, |
557 DIB_RGB_COLORS); | 557 DIB_RGB_COLORS); |
558 | 558 |
559 xfree (bmp_info); | 559 xfree (bmp_info); |
560 xfree (dibits); | 560 xfree (dibits); |
561 | 561 |
562 SelectObject(hcdc, old); | 562 SelectObject(hcdc, old); |
563 | 563 |
564 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask; | 564 IMAGE_INSTANCE_MSWINDOWS_MASK (image) = mask; |
565 } | 565 } |
566 | 566 |
574 x_icon.fIcon=cursor ? FALSE : TRUE; | 574 x_icon.fIcon=cursor ? FALSE : TRUE; |
575 x_icon.xHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image)); | 575 x_icon.xHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image)); |
576 x_icon.yHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image)); | 576 x_icon.yHotspot=XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image)); |
577 x_icon.hbmMask=IMAGE_INSTANCE_MSWINDOWS_MASK (image); | 577 x_icon.hbmMask=IMAGE_INSTANCE_MSWINDOWS_MASK (image); |
578 x_icon.hbmColor=IMAGE_INSTANCE_MSWINDOWS_BITMAP (image); | 578 x_icon.hbmColor=IMAGE_INSTANCE_MSWINDOWS_BITMAP (image); |
579 | 579 |
580 IMAGE_INSTANCE_MSWINDOWS_ICON (image)= | 580 IMAGE_INSTANCE_MSWINDOWS_ICON (image)= |
581 CreateIconIndirect (&x_icon); | 581 CreateIconIndirect (&x_icon); |
582 } | 582 } |
583 | 583 |
584 HBITMAP | 584 HBITMAP |
587 int newx, int newy) | 587 int newx, int newy) |
588 { | 588 { |
589 HBITMAP newbmp; | 589 HBITMAP newbmp; |
590 HGDIOBJ old1, old2; | 590 HGDIOBJ old1, old2; |
591 HDC hcdc = FRAME_MSWINDOWS_CDC (f); | 591 HDC hcdc = FRAME_MSWINDOWS_CDC (f); |
592 HDC hdcDst = CreateCompatibleDC (hcdc); | 592 HDC hdcDst = CreateCompatibleDC (hcdc); |
593 | 593 |
594 old1 = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)); | 594 old1 = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)); |
595 | 595 |
596 newbmp = CreateCompatibleBitmap (hcdc, newx, newy); | 596 newbmp = CreateCompatibleBitmap (hcdc, newx, newy); |
597 | 597 |
598 old2 = SelectObject (hdcDst, newbmp); | 598 old2 = SelectObject (hdcDst, newbmp); |
599 | 599 |
600 if (!StretchBlt (hdcDst, 0, 0, newx, newy, | 600 if (!StretchBlt (hdcDst, 0, 0, newx, newy, |
601 hcdc, 0, 0, | 601 hcdc, 0, 0, |
602 IMAGE_INSTANCE_PIXMAP_WIDTH (ii), | 602 IMAGE_INSTANCE_PIXMAP_WIDTH (ii), |
603 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii), | 603 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii), |
604 SRCCOPY)) | 604 SRCCOPY)) |
605 { | 605 { |
606 DeleteObject (newbmp); | 606 DeleteObject (newbmp); |
607 DeleteDC (hdcDst); | 607 DeleteDC (hdcDst); |
608 return 0; | 608 return 0; |
623 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)) | 623 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)) |
624 { | 624 { |
625 HBITMAP newmask; | 625 HBITMAP newmask; |
626 HGDIOBJ old1, old2; | 626 HGDIOBJ old1, old2; |
627 HDC hcdc = FRAME_MSWINDOWS_CDC (f); | 627 HDC hcdc = FRAME_MSWINDOWS_CDC (f); |
628 HDC hdcDst = CreateCompatibleDC (hcdc); | 628 HDC hdcDst = CreateCompatibleDC (hcdc); |
629 | 629 |
630 old1 = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_MASK (ii)); | 630 old1 = SelectObject (hcdc, IMAGE_INSTANCE_MSWINDOWS_MASK (ii)); |
631 newmask = CreateCompatibleBitmap(hcdc, newx, newy); | 631 newmask = CreateCompatibleBitmap(hcdc, newx, newy); |
632 old2 = SelectObject (hdcDst, newmask); | 632 old2 = SelectObject (hdcDst, newmask); |
633 | 633 |
634 if (!StretchBlt(hdcDst, 0, 0, newx, newy, | 634 if (!StretchBlt(hdcDst, 0, 0, newx, newy, |
635 hcdc, 0, 0, | 635 hcdc, 0, 0, |
636 IMAGE_INSTANCE_PIXMAP_WIDTH (ii), | 636 IMAGE_INSTANCE_PIXMAP_WIDTH (ii), |
637 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii), | 637 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii), |
638 SRCCOPY)) | 638 SRCCOPY)) |
639 { | 639 { |
640 DeleteObject (newmask); | 640 DeleteObject (newmask); |
641 DeleteDC (hdcDst); | 641 DeleteDC (hdcDst); |
642 return NULL; | 642 return NULL; |
643 } | 643 } |
644 | 644 |
645 SelectObject (hdcDst, old2); | 645 SelectObject (hdcDst, old2); |
646 SelectObject (hcdc, old1); | 646 SelectObject (hcdc, old1); |
647 | 647 |
648 DeleteDC (hdcDst); | 648 DeleteDC (hdcDst); |
649 | 649 |
661 HBITMAP newbmp = mswindows_create_resized_bitmap (ii, f, newx, newy); | 661 HBITMAP newbmp = mswindows_create_resized_bitmap (ii, f, newx, newy); |
662 HBITMAP newmask = mswindows_create_resized_mask (ii, f, newx, newy); | 662 HBITMAP newmask = mswindows_create_resized_mask (ii, f, newx, newy); |
663 | 663 |
664 if (!newbmp) | 664 if (!newbmp) |
665 return FALSE; | 665 return FALSE; |
666 | 666 |
667 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)) | 667 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)) |
668 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)); | 668 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)); |
669 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)) | 669 if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)) |
670 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)); | 670 DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (ii)); |
671 | 671 |
737 colortbl = xnew_array_and_zero (struct color_symbol, i); | 737 colortbl = xnew_array_and_zero (struct color_symbol, i); |
738 | 738 |
739 for (j=0; j<i; j++) | 739 for (j=0; j<i; j++) |
740 { | 740 { |
741 Lisp_Object cons = XCAR (results); | 741 Lisp_Object cons = XCAR (results); |
742 colortbl[j].color = | 742 colortbl[j].color = |
743 COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (XCDR (cons))); | 743 COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (XCDR (cons))); |
744 | 744 |
745 GET_C_STRING_OS_DATA_ALLOCA (XCAR (cons), colortbl[j].name); | 745 GET_C_STRING_OS_DATA_ALLOCA (XCAR (cons), colortbl[j].name); |
746 colortbl[j].name = xstrdup (colortbl[j].name); /* mustn't lose this when we return */ | 746 colortbl[j].name = xstrdup (colortbl[j].name); /* mustn't lose this when we return */ |
747 free_cons (XCONS (cons)); | 747 free_cons (XCONS (cons)); |
764 XpmInfo xpminfo; | 764 XpmInfo xpminfo; |
765 int result, i, j, transp_idx, maskbpline; | 765 int result, i, j, transp_idx, maskbpline; |
766 unsigned char* dptr; | 766 unsigned char* dptr; |
767 unsigned int* sptr; | 767 unsigned int* sptr; |
768 COLORREF color; /* the american spelling virus hits again .. */ | 768 COLORREF color; /* the american spelling virus hits again .. */ |
769 COLORREF* colortbl; | 769 COLORREF* colortbl; |
770 | 770 |
771 xzero (xpmimage); | 771 xzero (xpmimage); |
772 xzero (xpminfo); | 772 xzero (xpminfo); |
773 xpminfo.valuemask=XpmHotspot; | 773 xpminfo.valuemask=XpmHotspot; |
774 *transp=FALSE; | 774 *transp=FALSE; |
794 signal_double_file_error_2 ("Parsing pixmap data", | 794 signal_double_file_error_2 ("Parsing pixmap data", |
795 "unknown error code", | 795 "unknown error code", |
796 make_int (result), image); | 796 make_int (result), image); |
797 } | 797 } |
798 } | 798 } |
799 | 799 |
800 *width = xpmimage.width; | 800 *width = xpmimage.width; |
801 *height = xpmimage.height; | 801 *height = xpmimage.height; |
802 maskbpline = BPLINE (((~7UL & (unsigned long)(*width + 7)) / 8)); | 802 maskbpline = BPLINE ((~7UL & (unsigned long)(*width + 7)) / 8); |
803 | 803 |
804 *data = xnew_array_and_zero (unsigned char, *width * *height * 3); | 804 *data = xnew_array_and_zero (unsigned char, *width * *height * 3); |
805 | 805 |
806 if (!*data) | 806 if (!*data) |
807 { | 807 { |
808 XpmFreeXpmImage (&xpmimage); | 808 XpmFreeXpmImage (&xpmimage); |
829 if (!strcasecmp (xpmimage.colorTable[i].symbolic,"BgColor") | 829 if (!strcasecmp (xpmimage.colorTable[i].symbolic,"BgColor") |
830 || | 830 || |
831 !strcasecmp (xpmimage.colorTable[i].symbolic,"None")) | 831 !strcasecmp (xpmimage.colorTable[i].symbolic,"None")) |
832 { | 832 { |
833 *transp=TRUE; | 833 *transp=TRUE; |
834 colortbl[i]=transparent_color; | 834 colortbl[i]=transparent_color; |
835 transp_idx=i; | 835 transp_idx=i; |
836 goto label_found_color; | 836 goto label_found_color; |
837 } | 837 } |
838 else if (color_symbols) | 838 else if (color_symbols) |
839 { | 839 { |
854 } | 854 } |
855 /* pick up transparencies */ | 855 /* pick up transparencies */ |
856 if (!strcasecmp (xpmimage.colorTable[i].c_color,"None")) | 856 if (!strcasecmp (xpmimage.colorTable[i].c_color,"None")) |
857 { | 857 { |
858 *transp=TRUE; | 858 *transp=TRUE; |
859 colortbl[i]=transparent_color; | 859 colortbl[i]=transparent_color; |
860 transp_idx=i; | 860 transp_idx=i; |
861 goto label_found_color; | 861 goto label_found_color; |
862 } | 862 } |
863 /* finally pick up a normal color spec */ | 863 /* finally pick up a normal color spec */ |
864 if (xpmimage.colorTable[i].c_color) | 864 if (xpmimage.colorTable[i].c_color) |
865 { | 865 { |
866 colortbl[i]= | 866 colortbl[i]= |
867 mswindows_string_to_color (xpmimage.colorTable[i].c_color); | 867 mswindows_string_to_color (xpmimage.colorTable[i].c_color); |
868 goto label_found_color; | 868 goto label_found_color; |
869 } | 869 } |
870 | 870 |
871 label_no_color: | 871 label_no_color: |
872 xfree (*data); | 872 xfree (*data); |
873 xfree (colortbl); | 873 xfree (colortbl); |
874 XpmFreeXpmImage (&xpmimage); | 874 XpmFreeXpmImage (&xpmimage); |
875 XpmFreeXpmInfo (&xpminfo); | 875 XpmFreeXpmInfo (&xpminfo); |
876 return 0; | 876 return 0; |
877 | 877 |
878 label_found_color:; | 878 label_found_color:; |
879 } | 879 } |
880 | 880 |
881 /* convert the image */ | 881 /* convert the image */ |
882 sptr=xpmimage.data; | 882 sptr=xpmimage.data; |
915 BITMAPINFO* bmp_info; | 915 BITMAPINFO* bmp_info; |
916 unsigned char* bmp_data; | 916 unsigned char* bmp_data; |
917 int bmp_bits; | 917 int bmp_bits; |
918 int nsymbols=0, transp; | 918 int nsymbols=0, transp; |
919 struct color_symbol* color_symbols=NULL; | 919 struct color_symbol* color_symbols=NULL; |
920 | 920 |
921 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 921 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
922 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, | 922 Lisp_Object color_symbol_alist = find_keyword_in_vector (instantiator, |
923 Q_color_symbols); | 923 Q_color_symbols); |
924 | 924 |
925 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) | 925 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) |
935 | 935 |
936 /* convert to an eimage to make processing easier */ | 936 /* convert to an eimage to make processing easier */ |
937 if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height, | 937 if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height, |
938 &x_hot, &y_hot, &transp, color_symbols, nsymbols)) | 938 &x_hot, &y_hot, &transp, color_symbols, nsymbols)) |
939 { | 939 { |
940 signal_simple_error ("XPM to EImage conversion failed", | 940 signal_simple_error ("XPM to EImage conversion failed", |
941 image_instance); | 941 image_instance); |
942 } | 942 } |
943 | 943 |
944 if (color_symbols) | 944 if (color_symbols) |
945 { | 945 { |
946 while (nsymbols--) | 946 while (nsymbols--) |
947 { | 947 { |
948 xfree (color_symbols[nsymbols].name); | 948 xfree (color_symbols[nsymbols].name); |
949 } | 949 } |
950 xfree(color_symbols); | 950 xfree(color_symbols); |
951 } | 951 } |
952 | 952 |
953 /* build a bitmap from the eimage */ | 953 /* build a bitmap from the eimage */ |
954 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage, | 954 if (!(bmp_info=convert_EImage_to_DIBitmap (device, width, height, eimage, |
955 &bmp_bits, &bmp_data))) | 955 &bmp_bits, &bmp_data))) |
956 { | 956 { |
957 signal_simple_error ("XPM to EImage conversion failed", | 957 signal_simple_error ("XPM to EImage conversion failed", |
1010 signal_simple_error ("Not an mswindows device", device); | 1010 signal_simple_error ("Not an mswindows device", device); |
1011 | 1011 |
1012 assert (!NILP (data)); | 1012 assert (!NILP (data)); |
1013 | 1013 |
1014 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len); | 1014 GET_STRING_BINARY_DATA_ALLOCA (data, bytes, len); |
1015 | 1015 |
1016 /* Then slurp the image into memory, decoding along the way. | 1016 /* Then slurp the image into memory, decoding along the way. |
1017 The result is the image in a simple one-byte-per-pixel | 1017 The result is the image in a simple one-byte-per-pixel |
1018 format. */ | 1018 format. */ |
1019 | 1019 |
1020 bmp_file_header=(BITMAPFILEHEADER*)bytes; | 1020 bmp_file_header=(BITMAPFILEHEADER*)bytes; |
1021 bmp_info = (BITMAPINFO*)(bytes + sizeof(BITMAPFILEHEADER)); | 1021 bmp_info = (BITMAPINFO*)(bytes + sizeof(BITMAPFILEHEADER)); |
1022 bmp_data = (Extbyte*)bytes + bmp_file_header->bfOffBits; | 1022 bmp_data = (Extbyte*)bytes + bmp_file_header->bfOffBits; |
1023 bmp_bits = bmp_file_header->bfSize - bmp_file_header->bfOffBits; | 1023 bmp_bits = bmp_file_header->bfSize - bmp_file_header->bfOffBits; |
1024 | 1024 |
1034 **********************************************************************/ | 1034 **********************************************************************/ |
1035 | 1035 |
1036 static void | 1036 static void |
1037 mswindows_resource_validate (Lisp_Object instantiator) | 1037 mswindows_resource_validate (Lisp_Object instantiator) |
1038 { | 1038 { |
1039 if ((NILP (find_keyword_in_vector (instantiator, Q_file)) | 1039 if ((NILP (find_keyword_in_vector (instantiator, Q_file)) |
1040 && | 1040 && |
1041 NILP (find_keyword_in_vector (instantiator, Q_resource_id))) | 1041 NILP (find_keyword_in_vector (instantiator, Q_resource_id))) |
1042 || | 1042 || |
1043 NILP (find_keyword_in_vector (instantiator, Q_resource_type))) | 1043 NILP (find_keyword_in_vector (instantiator, Q_resource_type))) |
1044 signal_simple_error ("Must supply :file, :resource-id and :resource-type", | 1044 signal_simple_error ("Must supply :file, :resource-id and :resource-type", |
1045 instantiator); | 1045 instantiator); |
1046 } | 1046 } |
1053 struct gcpro gcpro1, gcpro2; | 1053 struct gcpro gcpro1, gcpro2; |
1054 Lisp_Object alist = Qnil; | 1054 Lisp_Object alist = Qnil; |
1055 | 1055 |
1056 GCPRO2 (file, alist); | 1056 GCPRO2 (file, alist); |
1057 | 1057 |
1058 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | 1058 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, |
1059 console_type); | 1059 console_type); |
1060 | 1060 |
1061 if (CONSP (file)) /* failure locating filename */ | 1061 if (CONSP (file)) /* failure locating filename */ |
1062 signal_double_file_error ("Opening pixmap file", | 1062 signal_double_file_error ("Opening pixmap file", |
1063 "no such file or directory", | 1063 "no such file or directory", |
1084 mswindows_resource_possible_dest_types (void) | 1084 mswindows_resource_possible_dest_types (void) |
1085 { | 1085 { |
1086 return IMAGE_POINTER_MASK | IMAGE_COLOR_PIXMAP_MASK; | 1086 return IMAGE_POINTER_MASK | IMAGE_COLOR_PIXMAP_MASK; |
1087 } | 1087 } |
1088 | 1088 |
1089 typedef struct | 1089 typedef struct |
1090 { | 1090 { |
1091 char *name; | 1091 char *name; |
1092 int resource_id; | 1092 int resource_id; |
1093 } resource_t; | 1093 } resource_t; |
1094 | 1094 |
1103 #if defined (__CYGWIN32__) && CYGWIN_VERSION_DLL_MAJOR < 21 | 1103 #if defined (__CYGWIN32__) && CYGWIN_VERSION_DLL_MAJOR < 21 |
1104 #define LR_SHARED 0x8000 | 1104 #define LR_SHARED 0x8000 |
1105 #endif | 1105 #endif |
1106 #endif | 1106 #endif |
1107 | 1107 |
1108 static CONST resource_t bitmap_table[] = | 1108 static CONST resource_t bitmap_table[] = |
1109 { | 1109 { |
1110 /* bitmaps */ | 1110 /* bitmaps */ |
1111 { "close", OBM_CLOSE }, | 1111 { "close", OBM_CLOSE }, |
1112 { "uparrow", OBM_UPARROW }, | 1112 { "uparrow", OBM_UPARROW }, |
1113 { "dnarrow", OBM_DNARROW }, | 1113 { "dnarrow", OBM_DNARROW }, |
1135 { "checkboxes", OBM_CHECKBOXES }, | 1135 { "checkboxes", OBM_CHECKBOXES }, |
1136 { "btncorners" , OBM_BTNCORNERS }, | 1136 { "btncorners" , OBM_BTNCORNERS }, |
1137 {0} | 1137 {0} |
1138 }; | 1138 }; |
1139 | 1139 |
1140 static CONST resource_t cursor_table[] = | 1140 static CONST resource_t cursor_table[] = |
1141 { | 1141 { |
1142 /* cursors */ | 1142 /* cursors */ |
1143 { "normal", OCR_NORMAL }, | 1143 { "normal", OCR_NORMAL }, |
1144 { "ibeam", OCR_IBEAM }, | 1144 { "ibeam", OCR_IBEAM }, |
1145 { "wait", OCR_WAIT }, | 1145 { "wait", OCR_WAIT }, |
1154 /* { "icour", OCR_ICOCUR }, */ | 1154 /* { "icour", OCR_ICOCUR }, */ |
1155 { "no", OCR_NO }, | 1155 { "no", OCR_NO }, |
1156 { 0 } | 1156 { 0 } |
1157 }; | 1157 }; |
1158 | 1158 |
1159 static CONST resource_t icon_table[] = | 1159 static CONST resource_t icon_table[] = |
1160 { | 1160 { |
1161 /* icons */ | 1161 /* icons */ |
1162 { "sample", OIC_SAMPLE }, | 1162 { "sample", OIC_SAMPLE }, |
1163 { "hand", OIC_HAND }, | 1163 { "hand", OIC_HAND }, |
1164 { "ques", OIC_QUES }, | 1164 { "ques", OIC_QUES }, |
1168 {0} | 1168 {0} |
1169 }; | 1169 }; |
1170 | 1170 |
1171 static int resource_name_to_resource (Lisp_Object name, int type) | 1171 static int resource_name_to_resource (Lisp_Object name, int type) |
1172 { | 1172 { |
1173 CONST resource_t* res = (type == IMAGE_CURSOR ? cursor_table | 1173 CONST resource_t* res = (type == IMAGE_CURSOR ? cursor_table |
1174 : type == IMAGE_ICON ? icon_table | 1174 : type == IMAGE_ICON ? icon_table |
1175 : bitmap_table); | 1175 : bitmap_table); |
1176 | 1176 |
1177 if (INTP (name)) | 1177 if (INTP (name)) |
1178 { | 1178 { |
1179 return XINT (name); | 1179 return XINT (name); |
1180 } | 1180 } |
1181 else if (!STRINGP (name)) | 1181 else if (!STRINGP (name)) |
1182 { | 1182 { |
1183 signal_simple_error ("invalid resource identifier", name); | 1183 signal_simple_error ("invalid resource identifier", name); |
1184 } | 1184 } |
1185 | 1185 |
1186 do { | 1186 do { |
1187 Extbyte* nm=0; | 1187 Extbyte* nm=0; |
1188 GET_C_STRING_OS_DATA_ALLOCA (name, nm); | 1188 GET_C_STRING_OS_DATA_ALLOCA (name, nm); |
1189 if (!strcasecmp ((char*)res->name, nm)) | 1189 if (!strcasecmp ((char*)res->name, nm)) |
1190 return res->resource_id; | 1190 return res->resource_id; |
1219 int iitype=0; | 1219 int iitype=0; |
1220 char* fname=0; | 1220 char* fname=0; |
1221 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); | 1221 Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); |
1222 | 1222 |
1223 Lisp_Object file = find_keyword_in_vector (instantiator, Q_file); | 1223 Lisp_Object file = find_keyword_in_vector (instantiator, Q_file); |
1224 Lisp_Object resource_type = find_keyword_in_vector (instantiator, | 1224 Lisp_Object resource_type = find_keyword_in_vector (instantiator, |
1225 Q_resource_type); | 1225 Q_resource_type); |
1226 Lisp_Object resource_id = find_keyword_in_vector (instantiator, | 1226 Lisp_Object resource_id = find_keyword_in_vector (instantiator, |
1227 Q_resource_id); | 1227 Q_resource_id); |
1228 | 1228 |
1229 xzero (iconinfo); | 1229 xzero (iconinfo); |
1230 | 1230 |
1231 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) | 1231 if (!DEVICE_MSWINDOWS_P (XDEVICE (device))) |
1235 | 1235 |
1236 if (dest_mask & IMAGE_POINTER_MASK && type == IMAGE_CURSOR) | 1236 if (dest_mask & IMAGE_POINTER_MASK && type == IMAGE_CURSOR) |
1237 iitype = IMAGE_POINTER; | 1237 iitype = IMAGE_POINTER; |
1238 else if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) | 1238 else if (dest_mask & IMAGE_COLOR_PIXMAP_MASK) |
1239 iitype = IMAGE_COLOR_PIXMAP; | 1239 iitype = IMAGE_COLOR_PIXMAP; |
1240 else | 1240 else |
1241 incompatible_image_types (instantiator, dest_mask, | 1241 incompatible_image_types (instantiator, dest_mask, |
1242 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK); | 1242 IMAGE_COLOR_PIXMAP_MASK | IMAGE_POINTER_MASK); |
1243 | 1243 |
1244 /* mess with the keyword info we were provided with */ | 1244 /* mess with the keyword info we were provided with */ |
1245 if (!NILP (file)) | 1245 if (!NILP (file)) |
1249 #ifdef __CYGWIN32__ | 1249 #ifdef __CYGWIN32__ |
1250 CYGWIN_WIN32_PATH (f, fname); | 1250 CYGWIN_WIN32_PATH (f, fname); |
1251 #else | 1251 #else |
1252 fname = f; | 1252 fname = f; |
1253 #endif | 1253 #endif |
1254 | 1254 |
1255 if (NILP (resource_id)) | 1255 if (NILP (resource_id)) |
1256 resid = (LPCTSTR)fname; | 1256 resid = (LPCTSTR)fname; |
1257 else | 1257 else |
1258 { | 1258 { |
1259 hinst = LoadLibraryEx (fname, NULL, | 1259 hinst = LoadLibraryEx (fname, NULL, |
1260 LOAD_LIBRARY_AS_DATAFILE); | 1260 LOAD_LIBRARY_AS_DATAFILE); |
1261 resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, | 1261 resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, |
1262 type)); | 1262 type)); |
1263 | 1263 |
1264 if (!resid) | 1264 if (!resid) |
1265 GET_C_STRING_OS_DATA_ALLOCA (resource_id, resid); | 1265 GET_C_STRING_OS_DATA_ALLOCA (resource_id, resid); |
1266 } | 1266 } |
1267 } | 1267 } |
1268 else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, | 1268 else if (!(resid = MAKEINTRESOURCE (resource_name_to_resource (resource_id, |
1269 type)))) | 1269 type)))) |
1270 signal_simple_error ("Invalid resource identifier", resource_id); | 1270 signal_simple_error ("Invalid resource identifier", resource_id); |
1271 | 1271 |
1272 /* load the image */ | 1272 /* load the image */ |
1273 if (!(himage = LoadImage (hinst, resid, type, 0, 0, | 1273 if (!(himage = LoadImage (hinst, resid, type, 0, 0, |
1274 LR_CREATEDIBSECTION | LR_DEFAULTSIZE | | 1274 LR_CREATEDIBSECTION | LR_DEFAULTSIZE | |
1275 LR_SHARED | | 1275 LR_SHARED | |
1276 (!NILP (file) ? LR_LOADFROMFILE : 0)))) | 1276 (!NILP (file) ? LR_LOADFROMFILE : 0)))) |
1277 { | 1277 { |
1278 signal_simple_error ("Cannot load image", instantiator); | 1278 signal_simple_error ("Cannot load image", instantiator); |
1279 } | 1279 } |
1280 | 1280 |
1282 FreeLibrary (hinst); | 1282 FreeLibrary (hinst); |
1283 | 1283 |
1284 mswindows_initialize_dibitmap_image_instance (ii, 1, iitype); | 1284 mswindows_initialize_dibitmap_image_instance (ii, 1, iitype); |
1285 | 1285 |
1286 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = file; | 1286 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = file; |
1287 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = | 1287 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = |
1288 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CXCURSOR : SM_CXICON); | 1288 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CXCURSOR : SM_CXICON); |
1289 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = | 1289 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = |
1290 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CYCURSOR : SM_CYICON); | 1290 GetSystemMetrics (type == IMAGE_CURSOR ? SM_CYCURSOR : SM_CYICON); |
1291 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1; | 1291 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1; |
1292 | 1292 |
1293 /* hey, we've got an icon type thing so we can reverse engineer the | 1293 /* hey, we've got an icon type thing so we can reverse engineer the |
1294 bitmap and mask */ | 1294 bitmap and mask */ |
1381 * XmuReadBitmapData read data from FILE descriptor | 1381 * XmuReadBitmapData read data from FILE descriptor |
1382 * XmuReadBitmapDataFromFile read X10 or X11 format bitmap files | 1382 * XmuReadBitmapDataFromFile read X10 or X11 format bitmap files |
1383 * and return data | 1383 * and return data |
1384 * | 1384 * |
1385 * Note that this file and ../X/XRdBitF.c look very similar.... Keep them | 1385 * Note that this file and ../X/XRdBitF.c look very similar.... Keep them |
1386 * that way (but don't use common source code so that people can have one | 1386 * that way (but don't use common source code so that people can have one |
1387 * without the other). | 1387 * without the other). |
1388 */ | 1388 */ |
1389 | 1389 |
1390 | 1390 |
1391 /* | 1391 /* |
1431 | 1431 |
1432 /* delimiters of significance are flagged w/ negative value */ | 1432 /* delimiters of significance are flagged w/ negative value */ |
1433 hexTable[' '] = -1; hexTable[','] = -1; | 1433 hexTable[' '] = -1; hexTable[','] = -1; |
1434 hexTable['}'] = -1; hexTable['\n'] = -1; | 1434 hexTable['}'] = -1; hexTable['\n'] = -1; |
1435 hexTable['\t'] = -1; | 1435 hexTable['\t'] = -1; |
1436 | 1436 |
1437 initialized = TRUE; | 1437 initialized = TRUE; |
1438 } | 1438 } |
1439 | 1439 |
1440 /* | 1440 /* |
1441 * read next hex value in the input stream, return -1 if EOF | 1441 * read next hex value in the input stream, return -1 if EOF |
1444 { | 1444 { |
1445 int ch; | 1445 int ch; |
1446 int value = 0; | 1446 int value = 0; |
1447 int gotone = 0; | 1447 int gotone = 0; |
1448 int done = 0; | 1448 int done = 0; |
1449 | 1449 |
1450 /* loop, accumulate hex value until find delimiter */ | 1450 /* loop, accumulate hex value until find delimiter */ |
1451 /* skip any initial delimiters found in read stream */ | 1451 /* skip any initial delimiters found in read stream */ |
1452 | 1452 |
1453 while (!done) { | 1453 while (!done) { |
1454 ch = getc(fstream); | 1454 ch = getc(fstream); |
1525 if (!strcmp("y_hot", type)) | 1525 if (!strcmp("y_hot", type)) |
1526 hy = value; | 1526 hy = value; |
1527 } | 1527 } |
1528 continue; | 1528 continue; |
1529 } | 1529 } |
1530 | 1530 |
1531 if (sscanf(line, "static short %s = {", name_and_type) == 1) | 1531 if (sscanf(line, "static short %s = {", name_and_type) == 1) |
1532 version10p = 1; | 1532 version10p = 1; |
1533 else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) | 1533 else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) |
1534 version10p = 0; | 1534 version10p = 0; |
1535 else if (sscanf(line, "static char %s = {", name_and_type) == 1) | 1535 else if (sscanf(line, "static char %s = {", name_and_type) == 1) |
1542 else | 1542 else |
1543 type++; | 1543 type++; |
1544 | 1544 |
1545 if (strcmp("bits[]", type)) | 1545 if (strcmp("bits[]", type)) |
1546 continue; | 1546 continue; |
1547 | 1547 |
1548 if (!ww || !hh) | 1548 if (!ww || !hh) |
1549 RETURN (BitmapFileInvalid); | 1549 RETURN (BitmapFileInvalid); |
1550 | 1550 |
1551 if ((ww % 16) && ((ww % 16) < 9) && version10p) | 1551 if ((ww % 16) && ((ww % 16) < 9) && version10p) |
1552 padding = 1; | 1552 padding = 1; |
1555 | 1555 |
1556 bytes_per_line = (ww+7)/8 + padding; | 1556 bytes_per_line = (ww+7)/8 + padding; |
1557 | 1557 |
1558 size = bytes_per_line * hh; | 1558 size = bytes_per_line * hh; |
1559 data = (unsigned char *) Xmalloc ((unsigned int) size); | 1559 data = (unsigned char *) Xmalloc ((unsigned int) size); |
1560 if (!data) | 1560 if (!data) |
1561 RETURN (BitmapNoMemory); | 1561 RETURN (BitmapNoMemory); |
1562 | 1562 |
1563 if (version10p) { | 1563 if (version10p) { |
1564 unsigned char *ptr; | 1564 unsigned char *ptr; |
1565 int bytes; | 1565 int bytes; |
1574 } else { | 1574 } else { |
1575 unsigned char *ptr; | 1575 unsigned char *ptr; |
1576 int bytes; | 1576 int bytes; |
1577 | 1577 |
1578 for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) { | 1578 for (bytes=0, ptr=data; bytes<size; bytes++, ptr++) { |
1579 if ((value = NextInt(fstream)) < 0) | 1579 if ((value = NextInt(fstream)) < 0) |
1580 RETURN (BitmapFileInvalid); | 1580 RETURN (BitmapFileInvalid); |
1581 *ptr=value; | 1581 *ptr=value; |
1582 } | 1582 } |
1583 } | 1583 } |
1584 break; | 1584 break; |
1597 | 1597 |
1598 RETURN (BitmapSuccess); | 1598 RETURN (BitmapSuccess); |
1599 } | 1599 } |
1600 | 1600 |
1601 | 1601 |
1602 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width, | 1602 int read_bitmap_data_from_file (CONST char *filename, unsigned int *width, |
1603 unsigned int *height, unsigned char **datap, | 1603 unsigned int *height, unsigned char **datap, |
1604 int *x_hot, int *y_hot) | 1604 int *x_hot, int *y_hot) |
1605 { | 1605 { |
1606 FILE *fstream; | 1606 FILE *fstream; |
1607 int status; | 1607 int status; |
1637 int new_width = BPLINE (2*((width + 15)/16)); | 1637 int new_width = BPLINE (2*((width + 15)/16)); |
1638 unsigned char *offset; | 1638 unsigned char *offset; |
1639 void *bmp_buf = 0; | 1639 void *bmp_buf = 0; |
1640 unsigned char *new_data, *new_offset; | 1640 unsigned char *new_data, *new_offset; |
1641 int i, j; | 1641 int i, j; |
1642 BITMAPINFO* bmp_info = | 1642 BITMAPINFO* bmp_info = |
1643 xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD)); | 1643 xmalloc_and_zero (sizeof(BITMAPINFO) + sizeof(RGBQUAD)); |
1644 HBITMAP bitmap; | 1644 HBITMAP bitmap; |
1645 | 1645 |
1646 if (!bmp_info) | 1646 if (!bmp_info) |
1647 return NULL; | 1647 return NULL; |
1648 | 1648 |
1649 new_data = (unsigned char *) xmalloc_and_zero (height * new_width); | 1649 new_data = (unsigned char *) xmalloc_and_zero (height * new_width); |
1650 | 1650 |
1651 if (!new_data) | 1651 if (!new_data) |
1652 { | 1652 { |
1653 xfree (bmp_info); | 1653 xfree (bmp_info); |
1654 return NULL; | 1654 return NULL; |
1655 } | 1655 } |
1656 | 1656 |
1657 for (i=0; i<height; i++) | 1657 for (i=0; i<height; i++) |
1658 { | 1658 { |
1659 offset = data + i*old_width; | 1659 offset = data + i*old_width; |
1660 new_offset = new_data + i*new_width; | 1660 new_offset = new_data + i*new_width; |
1661 | 1661 |
1679 | 1679 |
1680 bmp_info->bmiHeader.biWidth=width; | 1680 bmp_info->bmiHeader.biWidth=width; |
1681 bmp_info->bmiHeader.biHeight=-(LONG)height; | 1681 bmp_info->bmiHeader.biHeight=-(LONG)height; |
1682 bmp_info->bmiHeader.biPlanes=1; | 1682 bmp_info->bmiHeader.biPlanes=1; |
1683 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); | 1683 bmp_info->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); |
1684 bmp_info->bmiHeader.biBitCount=1; | 1684 bmp_info->bmiHeader.biBitCount=1; |
1685 bmp_info->bmiHeader.biCompression=BI_RGB; | 1685 bmp_info->bmiHeader.biCompression=BI_RGB; |
1686 bmp_info->bmiHeader.biClrUsed = 2; | 1686 bmp_info->bmiHeader.biClrUsed = 2; |
1687 bmp_info->bmiHeader.biClrImportant = 2; | 1687 bmp_info->bmiHeader.biClrImportant = 2; |
1688 bmp_info->bmiHeader.biSizeImage = height * new_width; | 1688 bmp_info->bmiHeader.biSizeImage = height * new_width; |
1689 bmp_info->bmiColors[0].rgbRed = GetRValue (fg); | 1689 bmp_info->bmiColors[0].rgbRed = GetRValue (fg); |
1690 bmp_info->bmiColors[0].rgbGreen = GetGValue (fg); | 1690 bmp_info->bmiColors[0].rgbGreen = GetGValue (fg); |
1691 bmp_info->bmiColors[0].rgbBlue = GetBValue (fg); | 1691 bmp_info->bmiColors[0].rgbBlue = GetBValue (fg); |
1692 bmp_info->bmiColors[0].rgbReserved = 0; | 1692 bmp_info->bmiColors[0].rgbReserved = 0; |
1693 bmp_info->bmiColors[1].rgbRed = GetRValue (bg); | 1693 bmp_info->bmiColors[1].rgbRed = GetRValue (bg); |
1694 bmp_info->bmiColors[1].rgbGreen = GetGValue (bg); | 1694 bmp_info->bmiColors[1].rgbGreen = GetGValue (bg); |
1695 bmp_info->bmiColors[1].rgbBlue = GetBValue (bg); | 1695 bmp_info->bmiColors[1].rgbBlue = GetBValue (bg); |
1696 bmp_info->bmiColors[1].rgbReserved = 0; | 1696 bmp_info->bmiColors[1].rgbReserved = 0; |
1697 | 1697 |
1698 bitmap = CreateDIBSection (hdc, | 1698 bitmap = CreateDIBSection (hdc, |
1699 bmp_info, | 1699 bmp_info, |
1700 DIB_RGB_COLORS, | 1700 DIB_RGB_COLORS, |
1701 &bmp_buf, | 1701 &bmp_buf, |
1702 0,0); | 1702 0,0); |
1703 | 1703 |
1704 xfree (bmp_info); | 1704 xfree (bmp_info); |
1705 | 1705 |
1706 if (!bitmap || !bmp_buf) | 1706 if (!bitmap || !bmp_buf) |
1707 { | 1707 { |
1708 xfree (new_data); | 1708 xfree (new_data); |
1709 return NULL; | 1709 return NULL; |
1710 } | 1710 } |
1711 | 1711 |
1712 /* copy in the actual bitmap */ | 1712 /* copy in the actual bitmap */ |
1713 memcpy (bmp_buf, new_data, height * new_width); | 1713 memcpy (bmp_buf, new_data, height * new_width); |
1714 xfree (new_data); | 1714 xfree (new_data); |
1715 | 1715 |
1716 return bitmap; | 1716 return bitmap; |
1762 incompatible_image_types (instantiator, dest_mask, | 1762 incompatible_image_types (instantiator, dest_mask, |
1763 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK | 1763 IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK |
1764 | IMAGE_POINTER_MASK); | 1764 | IMAGE_POINTER_MASK); |
1765 | 1765 |
1766 mswindows_initialize_dibitmap_image_instance (ii, 1, type); | 1766 mswindows_initialize_dibitmap_image_instance (ii, 1, type); |
1767 | 1767 |
1768 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = | 1768 IMAGE_INSTANCE_PIXMAP_FILENAME (ii) = |
1769 find_keyword_in_vector (instantiator, Q_file); | 1769 find_keyword_in_vector (instantiator, Q_file); |
1770 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = width; | 1770 IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = width; |
1771 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = height; | 1771 IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = height; |
1772 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1; | 1772 IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = 1; |
1773 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), 0); | 1773 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), 0); |
1774 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), 0); | 1774 XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), 0); |
1775 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = mask ? mask : | 1775 IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = mask ? mask : |
1776 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, | 1776 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, |
1777 TRUE, black, white); | 1777 TRUE, black, white); |
1778 | 1778 |
1779 switch (type) | 1779 switch (type) |
1780 { | 1780 { |
1781 case IMAGE_MONO_PIXMAP: | 1781 case IMAGE_MONO_PIXMAP: |
1782 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = | 1782 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = |
1783 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, | 1783 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, |
1784 FALSE, black, black); | 1784 FALSE, black, black); |
1785 break; | 1785 break; |
1786 | 1786 |
1787 case IMAGE_COLOR_PIXMAP: | 1787 case IMAGE_COLOR_PIXMAP: |
1788 { | 1788 { |
1806 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background)); | 1806 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background)); |
1807 | 1807 |
1808 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground; | 1808 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground; |
1809 IMAGE_INSTANCE_PIXMAP_BG (ii) = background; | 1809 IMAGE_INSTANCE_PIXMAP_BG (ii) = background; |
1810 | 1810 |
1811 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = | 1811 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = |
1812 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, | 1812 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, |
1813 FALSE, fg, black); | 1813 FALSE, fg, black); |
1814 } | 1814 } |
1815 break; | 1815 break; |
1816 | 1816 |
1817 case IMAGE_POINTER: | 1817 case IMAGE_POINTER: |
1822 if (NILP (foreground)) | 1822 if (NILP (foreground)) |
1823 foreground = pointer_fg; | 1823 foreground = pointer_fg; |
1824 if (NILP (background)) | 1824 if (NILP (background)) |
1825 background = pointer_bg; | 1825 background = pointer_bg; |
1826 | 1826 |
1827 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = | 1827 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = |
1828 find_keyword_in_vector (instantiator, Q_hotspot_x); | 1828 find_keyword_in_vector (instantiator, Q_hotspot_x); |
1829 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = | 1829 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = |
1830 find_keyword_in_vector (instantiator, Q_hotspot_y); | 1830 find_keyword_in_vector (instantiator, Q_hotspot_y); |
1831 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground; | 1831 IMAGE_INSTANCE_PIXMAP_FG (ii) = foreground; |
1832 IMAGE_INSTANCE_PIXMAP_BG (ii) = background; | 1832 IMAGE_INSTANCE_PIXMAP_BG (ii) = background; |
1833 if (COLOR_INSTANCEP (foreground)) | 1833 if (COLOR_INSTANCEP (foreground)) |
1834 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground)); | 1834 fg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (foreground)); |
1835 if (COLOR_INSTANCEP (background)) | 1835 if (COLOR_INSTANCEP (background)) |
1836 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background)); | 1836 bg = COLOR_INSTANCE_MSWINDOWS_COLOR (XCOLOR_INSTANCE (background)); |
1837 | 1837 |
1838 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = | 1838 IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = |
1839 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, | 1839 xbm_create_bitmap_from_data (hdc, (Extbyte *) bits, width, height, |
1840 TRUE, fg, black); | 1840 TRUE, fg, black); |
1841 mswindows_initialize_image_instance_icon (ii, TRUE); | 1841 mswindows_initialize_image_instance_icon (ii, TRUE); |
1842 } | 1842 } |
1843 break; | 1843 break; |
1844 | 1844 |
1855 CONST char *bits) | 1855 CONST char *bits) |
1856 { | 1856 { |
1857 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data); | 1857 Lisp_Object mask_data = find_keyword_in_vector (instantiator, Q_mask_data); |
1858 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file); | 1858 Lisp_Object mask_file = find_keyword_in_vector (instantiator, Q_mask_file); |
1859 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 1859 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
1860 struct frame* f = XFRAME (DEVICE_SELECTED_FRAME | 1860 struct frame* f = XFRAME (DEVICE_SELECTED_FRAME |
1861 (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)))); | 1861 (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)))); |
1862 HDC hdc = FRAME_MSWINDOWS_CDC (f); | 1862 HDC hdc = FRAME_MSWINDOWS_CDC (f); |
1863 HBITMAP mask = 0; | 1863 HBITMAP mask = 0; |
1864 CONST char *gcc_may_you_rot_in_hell; | 1864 CONST char *gcc_may_you_rot_in_hell; |
1865 | 1865 |
1883 } | 1883 } |
1884 | 1884 |
1885 /* Instantiate method for XBM's. */ | 1885 /* Instantiate method for XBM's. */ |
1886 | 1886 |
1887 static void | 1887 static void |
1888 mswindows_xbm_instantiate (Lisp_Object image_instance, | 1888 mswindows_xbm_instantiate (Lisp_Object image_instance, |
1889 Lisp_Object instantiator, | 1889 Lisp_Object instantiator, |
1890 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 1890 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
1891 int dest_mask, Lisp_Object domain) | 1891 int dest_mask, Lisp_Object domain) |
1892 { | 1892 { |
1893 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); | 1893 Lisp_Object data = find_keyword_in_vector (instantiator, Q_data); |
2005 switch (IMAGE_INSTANCE_TYPE (p)) | 2005 switch (IMAGE_INSTANCE_TYPE (p)) |
2006 { | 2006 { |
2007 case IMAGE_MONO_PIXMAP: | 2007 case IMAGE_MONO_PIXMAP: |
2008 case IMAGE_COLOR_PIXMAP: | 2008 case IMAGE_COLOR_PIXMAP: |
2009 case IMAGE_POINTER: | 2009 case IMAGE_POINTER: |
2010 sprintf (buf, " (0x%lx", | 2010 sprintf (buf, " (0x%lx", |
2011 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p)); | 2011 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p)); |
2012 write_c_string (buf, printcharfun); | 2012 write_c_string (buf, printcharfun); |
2013 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) | 2013 if (IMAGE_INSTANCE_MSWINDOWS_MASK (p)) |
2014 { | 2014 { |
2015 sprintf (buf, "/0x%lx", | 2015 sprintf (buf, "/0x%lx", |
2016 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p)); | 2016 (unsigned long) IMAGE_INSTANCE_MSWINDOWS_MASK (p)); |
2017 write_c_string (buf, printcharfun); | 2017 write_c_string (buf, printcharfun); |
2018 } | 2018 } |
2019 write_c_string (")", printcharfun); | 2019 write_c_string (")", printcharfun); |
2020 break; | 2020 break; |
2032 mswindows_finalize_image_instance (struct Lisp_Image_Instance *p) | 2032 mswindows_finalize_image_instance (struct Lisp_Image_Instance *p) |
2033 { | 2033 { |
2034 if (DEVICE_LIVE_P (XDEVICE (p->device))) | 2034 if (DEVICE_LIVE_P (XDEVICE (p->device))) |
2035 { | 2035 { |
2036 if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET | 2036 if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET |
2037 || | 2037 || |
2038 IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW) | 2038 IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW) |
2039 { | 2039 { |
2040 #ifdef DEBUG_WIDGETS | 2040 #ifdef DEBUG_WIDGETS |
2041 debug_widget_instances--; | 2041 debug_widget_instances--; |
2042 stderr_out ("widget destroyed, %d left\n", debug_widget_instances); | 2042 stderr_out ("widget destroyed, %d left\n", debug_widget_instances); |
2090 static void | 2090 static void |
2091 mswindows_unmap_subwindow (struct Lisp_Image_Instance *p) | 2091 mswindows_unmap_subwindow (struct Lisp_Image_Instance *p) |
2092 { | 2092 { |
2093 if (IMAGE_INSTANCE_SUBWINDOW_ID (p)) | 2093 if (IMAGE_INSTANCE_SUBWINDOW_ID (p)) |
2094 { | 2094 { |
2095 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2095 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2096 NULL, | 2096 NULL, |
2097 0, 0, 0, 0, | 2097 0, 0, 0, 0, |
2098 SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE | 2098 SWP_HIDEWINDOW | SWP_NOMOVE | SWP_NOSIZE |
2099 | SWP_NOSENDCHANGING); | 2099 | SWP_NOSENDCHANGING); |
2100 } | 2100 } |
2101 } | 2101 } |
2106 mswindows_map_subwindow (struct Lisp_Image_Instance *p, int x, int y, | 2106 mswindows_map_subwindow (struct Lisp_Image_Instance *p, int x, int y, |
2107 struct display_glyph_area* dga) | 2107 struct display_glyph_area* dga) |
2108 { | 2108 { |
2109 /* move the window before mapping it ... */ | 2109 /* move the window before mapping it ... */ |
2110 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2110 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2111 NULL, | 2111 NULL, |
2112 x, y, dga->width, dga->height, | 2112 x, y, dga->width, dga->height, |
2113 SWP_NOZORDER | 2113 SWP_NOZORDER |
2114 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); | 2114 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); |
2115 /* ... adjust the child ... */ | 2115 /* ... adjust the child ... */ |
2116 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), | 2116 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), |
2117 NULL, | 2117 NULL, |
2118 -dga->xoffset, -dga->yoffset, 0, 0, | 2118 -dga->xoffset, -dga->yoffset, 0, 0, |
2119 SWP_NOZORDER | SWP_NOSIZE | 2119 SWP_NOZORDER | SWP_NOSIZE |
2120 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); | 2120 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); |
2121 /* ... now map it - we are not allowed to move it at the same time. */ | 2121 /* ... now map it - we are not allowed to move it at the same time. */ |
2122 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), | 2122 SetWindowPos (IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (p), |
2123 NULL, | 2123 NULL, |
2124 0, 0, 0, 0, | 2124 0, 0, 0, 0, |
2125 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE | 2125 SWP_NOZORDER | SWP_NOSIZE | SWP_NOMOVE |
2126 | SWP_SHOWWINDOW | SWP_NOCOPYBITS | 2126 | SWP_SHOWWINDOW | SWP_NOCOPYBITS |
2127 | SWP_NOSENDCHANGING); | 2127 | SWP_NOSENDCHANGING); |
2128 } | 2128 } |
2129 | 2129 |
2130 /* resize the subwindow instance */ | 2130 /* resize the subwindow instance */ |
2131 static void | 2131 static void |
2132 mswindows_resize_subwindow (struct Lisp_Image_Instance* ii, int w, int h) | 2132 mswindows_resize_subwindow (struct Lisp_Image_Instance* ii, int w, int h) |
2133 { | 2133 { |
2134 /* Set the size of the control .... */ | 2134 /* Set the size of the control .... */ |
2135 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii), | 2135 SetWindowPos (WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii), |
2136 NULL, | 2136 NULL, |
2137 0, 0, w, h, | 2137 0, 0, w, h, |
2138 SWP_NOZORDER | SWP_NOMOVE | 2138 SWP_NOZORDER | SWP_NOMOVE |
2139 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); | 2139 | SWP_NOCOPYBITS | SWP_NOSENDCHANGING); |
2140 } | 2140 } |
2141 | 2141 |
2148 { | 2148 { |
2149 /* buttons checked or otherwise */ | 2149 /* buttons checked or otherwise */ |
2150 if ( EQ (IMAGE_INSTANCE_WIDGET_TYPE (p), Qbutton)) | 2150 if ( EQ (IMAGE_INSTANCE_WIDGET_TYPE (p), Qbutton)) |
2151 { | 2151 { |
2152 if (gui_item_selected_p (IMAGE_INSTANCE_WIDGET_ITEM (p))) | 2152 if (gui_item_selected_p (IMAGE_INSTANCE_WIDGET_ITEM (p))) |
2153 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), | 2153 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), |
2154 BM_SETCHECK, (WPARAM)BST_CHECKED, 0); | 2154 BM_SETCHECK, (WPARAM)BST_CHECKED, 0); |
2155 else | 2155 else |
2156 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), | 2156 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), |
2157 BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); | 2157 BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); |
2158 } | 2158 } |
2159 | 2159 |
2160 /* set the widget font from the widget face */ | 2160 /* set the widget font from the widget face */ |
2161 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), | 2161 SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), |
2162 WM_SETFONT, | 2162 WM_SETFONT, |
2163 (WPARAM)FONT_INSTANCE_MSWINDOWS_HFONT | 2163 (WPARAM)FONT_INSTANCE_MSWINDOWS_HFONT |
2164 (XFONT_INSTANCE (widget_face_font_info | 2164 (XFONT_INSTANCE (widget_face_font_info |
2165 (IMAGE_INSTANCE_SUBWINDOW_FRAME (p), | 2165 (IMAGE_INSTANCE_SUBWINDOW_FRAME (p), |
2166 IMAGE_INSTANCE_WIDGET_FACE (p), | 2166 IMAGE_INSTANCE_WIDGET_FACE (p), |
2167 0, 0))), | 2167 0, 0))), |
2168 MAKELPARAM (TRUE, 0)); | 2168 MAKELPARAM (TRUE, 0)); |
2169 } | 2169 } |
2170 } | 2170 } |
2171 | 2171 |
2172 /* register widgets into our hastable so that we can cope with the | 2172 /* register widgets into our hastable so that we can cope with the |
2226 /* parent window */ | 2226 /* parent window */ |
2227 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 2227 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), |
2228 NULL, /* No menu */ | 2228 NULL, /* No menu */ |
2229 NULL, /* must be null for this class */ | 2229 NULL, /* must be null for this class */ |
2230 NULL)) == NULL) | 2230 NULL)) == NULL) |
2231 signal_simple_error ("window creation failed with code", | 2231 signal_simple_error ("window creation failed with code", |
2232 make_int (GetLastError())); | 2232 make_int (GetLastError())); |
2233 | 2233 |
2234 wnd = CreateWindow( "STATIC", | 2234 wnd = CreateWindow( "STATIC", |
2235 "", | 2235 "", |
2236 WS_CHILD, | 2236 WS_CHILD, |
2237 0, /* starting x position */ | 2237 0, /* starting x position */ |
2238 0, /* starting y position */ | 2238 0, /* starting y position */ |
2239 IMAGE_INSTANCE_WIDGET_WIDTH (ii), | 2239 IMAGE_INSTANCE_WIDGET_WIDTH (ii), |
2240 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), | 2240 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), |
2241 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii), | 2241 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii), |
2242 0, | 2242 0, |
2243 (HINSTANCE) | 2243 (HINSTANCE) |
2244 GetWindowLong (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 2244 GetWindowLong (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), |
2245 GWL_HINSTANCE), | 2245 GWL_HINSTANCE), |
2246 NULL); | 2246 NULL); |
2247 | 2247 |
2248 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); | 2248 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); |
2249 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; | 2249 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; |
2250 } | 2250 } |
2256 switch (IMAGE_INSTANCE_TYPE (p1)) | 2256 switch (IMAGE_INSTANCE_TYPE (p1)) |
2257 { | 2257 { |
2258 case IMAGE_MONO_PIXMAP: | 2258 case IMAGE_MONO_PIXMAP: |
2259 case IMAGE_COLOR_PIXMAP: | 2259 case IMAGE_COLOR_PIXMAP: |
2260 case IMAGE_POINTER: | 2260 case IMAGE_POINTER: |
2261 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p1) | 2261 if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (p1) |
2262 != IMAGE_INSTANCE_MSWINDOWS_BITMAP (p2)) | 2262 != IMAGE_INSTANCE_MSWINDOWS_BITMAP (p2)) |
2263 return 0; | 2263 return 0; |
2264 break; | 2264 break; |
2265 | 2265 |
2266 default: | 2266 default: |
2267 break; | 2267 break; |
2268 } | 2268 } |
2269 | 2269 |
2270 return 1; | 2270 return 1; |
2277 { | 2277 { |
2278 case IMAGE_MONO_PIXMAP: | 2278 case IMAGE_MONO_PIXMAP: |
2279 case IMAGE_COLOR_PIXMAP: | 2279 case IMAGE_COLOR_PIXMAP: |
2280 case IMAGE_POINTER: | 2280 case IMAGE_POINTER: |
2281 return (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p); | 2281 return (unsigned long) IMAGE_INSTANCE_MSWINDOWS_BITMAP (p); |
2282 | 2282 |
2283 default: | 2283 default: |
2284 return 0; | 2284 return 0; |
2285 } | 2285 } |
2286 } | 2286 } |
2287 | 2287 |
2303 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil; | 2303 IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii) = Qnil; |
2304 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil; | 2304 IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii) = Qnil; |
2305 IMAGE_INSTANCE_PIXMAP_FG (ii) = Qnil; | 2305 IMAGE_INSTANCE_PIXMAP_FG (ii) = Qnil; |
2306 IMAGE_INSTANCE_PIXMAP_BG (ii) = Qnil; | 2306 IMAGE_INSTANCE_PIXMAP_BG (ii) = Qnil; |
2307 IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii) = slices; | 2307 IMAGE_INSTANCE_PIXMAP_MAXSLICE (ii) = slices; |
2308 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (ii) = | 2308 IMAGE_INSTANCE_MSWINDOWS_BITMAP_SLICES (ii) = |
2309 xnew_array_and_zero (HBITMAP, slices); | 2309 xnew_array_and_zero (HBITMAP, slices); |
2310 } | 2310 } |
2311 | 2311 |
2312 | 2312 |
2313 #ifdef HAVE_WIDGETS | 2313 #ifdef HAVE_WIDGETS |
2366 /* parent window */ | 2366 /* parent window */ |
2367 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 2367 FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), |
2368 (HMENU)id, /* No menu */ | 2368 (HMENU)id, /* No menu */ |
2369 NULL, /* must be null for this class */ | 2369 NULL, /* must be null for this class */ |
2370 NULL)) == NULL) | 2370 NULL)) == NULL) |
2371 signal_simple_error ("window creation failed with code", | 2371 signal_simple_error ("window creation failed with code", |
2372 make_int (GetLastError())); | 2372 make_int (GetLastError())); |
2373 | 2373 |
2374 if ((wnd = CreateWindowEx( | 2374 if ((wnd = CreateWindowEx( |
2375 exflags /* | WS_EX_NOPARENTNOTIFY*/, | 2375 exflags /* | WS_EX_NOPARENTNOTIFY*/, |
2376 class, | 2376 class, |
2377 nm, | 2377 nm, |
2378 flags | WS_CHILD | WS_VISIBLE, | 2378 flags | WS_CHILD | WS_VISIBLE, |
2379 0, /* starting x position */ | 2379 0, /* starting x position */ |
2380 0, /* starting y position */ | 2380 0, /* starting y position */ |
2381 IMAGE_INSTANCE_WIDGET_WIDTH (ii), | 2381 IMAGE_INSTANCE_WIDGET_WIDTH (ii), |
2382 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), | 2382 IMAGE_INSTANCE_WIDGET_HEIGHT (ii), |
2383 /* parent window */ | 2383 /* parent window */ |
2384 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii), | 2384 IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (ii), |
2385 (HMENU)id, /* No menu */ | 2385 (HMENU)id, /* No menu */ |
2386 (HINSTANCE) | 2386 (HINSTANCE) |
2387 GetWindowLong | 2387 GetWindowLong |
2388 (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | 2388 (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), |
2389 GWL_HINSTANCE), | 2389 GWL_HINSTANCE), |
2390 NULL)) == NULL) | 2390 NULL)) == NULL) |
2391 signal_simple_error ("window creation failed with code", | 2391 signal_simple_error ("window creation failed with code", |
2392 make_int (GetLastError())); | 2392 make_int (GetLastError())); |
2393 | 2393 |
2394 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; | 2394 IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; |
2395 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); | 2395 SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); |
2396 /* set the widget font from the widget face */ | 2396 /* set the widget font from the widget face */ |
2397 SendMessage (wnd, WM_SETFONT, | 2397 SendMessage (wnd, WM_SETFONT, |
2398 (WPARAM)FONT_INSTANCE_MSWINDOWS_HFONT | 2398 (WPARAM)FONT_INSTANCE_MSWINDOWS_HFONT |
2399 (XFONT_INSTANCE (widget_face_font_info | 2399 (XFONT_INSTANCE (widget_face_font_info |
2400 (domain, | 2400 (domain, |
2401 IMAGE_INSTANCE_WIDGET_FACE (ii), | 2401 IMAGE_INSTANCE_WIDGET_FACE (ii), |
2402 0, 0))), | 2402 0, 0))), |
2403 MAKELPARAM (TRUE, 0)); | 2403 MAKELPARAM (TRUE, 0)); |
2404 } | 2404 } |
2405 | 2405 |
2406 /* Instantiate a button widget. Unfortunately instantiated widgets are | 2406 /* Instantiate a button widget. Unfortunately instantiated widgets are |
2407 particular to a frame since they need to have a parent. It's not | 2407 particular to a frame since they need to have a parent. It's not |
2430 { | 2430 { |
2431 if (!IMAGE_INSTANCEP (glyph)) | 2431 if (!IMAGE_INSTANCEP (glyph)) |
2432 glyph = glyph_image_instance (glyph, domain, ERROR_ME, 1); | 2432 glyph = glyph_image_instance (glyph, domain, ERROR_ME, 1); |
2433 | 2433 |
2434 if (IMAGE_INSTANCEP (glyph)) | 2434 if (IMAGE_INSTANCEP (glyph)) |
2435 flags |= XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? | 2435 flags |= XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? |
2436 BS_BITMAP : BS_ICON; | 2436 BS_BITMAP : BS_ICON; |
2437 } | 2437 } |
2438 | 2438 |
2439 style = pgui->style; | 2439 style = pgui->style; |
2440 | 2440 |
2448 } | 2448 } |
2449 else | 2449 else |
2450 flags |= BS_DEFPUSHBUTTON; | 2450 flags |= BS_DEFPUSHBUTTON; |
2451 | 2451 |
2452 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2452 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2453 pointer_bg, dest_mask, domain, "BUTTON", flags, | 2453 pointer_bg, dest_mask, domain, "BUTTON", flags, |
2454 WS_EX_CONTROLPARENT); | 2454 WS_EX_CONTROLPARENT); |
2455 | 2455 |
2456 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); | 2456 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); |
2457 /* set the checked state */ | 2457 /* set the checked state */ |
2458 if (gui_item_selected_p (gui)) | 2458 if (gui_item_selected_p (gui)) |
2459 SendMessage (wnd, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); | 2459 SendMessage (wnd, BM_SETCHECK, (WPARAM)BST_CHECKED, 0); |
2460 else | 2460 else |
2461 SendMessage (wnd, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); | 2461 SendMessage (wnd, BM_SETCHECK, (WPARAM)BST_UNCHECKED, 0); |
2462 /* add the image if one was given */ | 2462 /* add the image if one was given */ |
2463 if (!NILP (glyph) && IMAGE_INSTANCEP (glyph)) | 2463 if (!NILP (glyph) && IMAGE_INSTANCEP (glyph)) |
2464 { | 2464 { |
2465 SendMessage (wnd, BM_SETIMAGE, | 2465 SendMessage (wnd, BM_SETIMAGE, |
2466 (WPARAM) (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? | 2466 (WPARAM) (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? |
2467 IMAGE_BITMAP : IMAGE_ICON), | 2467 IMAGE_BITMAP : IMAGE_ICON), |
2468 (LPARAM) (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? | 2468 (LPARAM) (XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) ? |
2469 XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) : | 2469 XIMAGE_INSTANCE_MSWINDOWS_BITMAP (glyph) : |
2470 XIMAGE_INSTANCE_MSWINDOWS_ICON (glyph))); | 2470 XIMAGE_INSTANCE_MSWINDOWS_ICON (glyph))); |
2471 } | 2471 } |
2476 mswindows_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2476 mswindows_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2477 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2477 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2478 int dest_mask, Lisp_Object domain) | 2478 int dest_mask, Lisp_Object domain) |
2479 { | 2479 { |
2480 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2480 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2481 pointer_bg, dest_mask, domain, "EDIT", | 2481 pointer_bg, dest_mask, domain, "EDIT", |
2482 ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP | 2482 ES_LEFT | ES_AUTOHSCROLL | WS_TABSTOP |
2483 | WS_BORDER, | 2483 | WS_BORDER, |
2484 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); | 2484 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); |
2485 } | 2485 } |
2486 | 2486 |
2491 int dest_mask, Lisp_Object domain) | 2491 int dest_mask, Lisp_Object domain) |
2492 { | 2492 { |
2493 HWND wnd; | 2493 HWND wnd; |
2494 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2494 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2495 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2495 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2496 pointer_bg, dest_mask, domain, PROGRESS_CLASS, | 2496 pointer_bg, dest_mask, domain, PROGRESS_CLASS, |
2497 WS_TABSTOP | WS_BORDER | PBS_SMOOTH, | 2497 WS_TABSTOP | WS_BORDER | PBS_SMOOTH, |
2498 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); | 2498 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); |
2499 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); | 2499 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); |
2500 /* set the colors */ | 2500 /* set the colors */ |
2501 #ifdef PBS_SETBKCOLOR | 2501 #ifdef PBS_SETBKCOLOR |
2502 SendMessage (wnd, PBS_SETBKCOLOR, 0, | 2502 SendMessage (wnd, PBS_SETBKCOLOR, 0, |
2503 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR | 2503 (LPARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR |
2504 (XCOLOR_INSTANCE | 2504 (XCOLOR_INSTANCE |
2505 (FACE_BACKGROUND | 2505 (FACE_BACKGROUND |
2506 (XIMAGE_INSTANCE_WIDGET_FACE (ii), | 2506 (XIMAGE_INSTANCE_WIDGET_FACE (ii), |
2507 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); | 2507 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); |
2508 #endif | 2508 #endif |
2509 #ifdef PBS_SETBARCOLOR | 2509 #ifdef PBS_SETBARCOLOR |
2510 SendMessage (wnd, PBS_SETBARCOLOR, 0, | 2510 SendMessage (wnd, PBS_SETBARCOLOR, 0, |
2511 (L:PARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR | 2511 (L:PARAM) (COLOR_INSTANCE_MSWINDOWS_COLOR |
2512 (XCOLOR_INSTANCE | 2512 (XCOLOR_INSTANCE |
2513 (FACE_FOREGROUND | 2513 (FACE_FOREGROUND |
2514 (XIMAGE_INSTANCE_WIDGET_FACE (ii), | 2514 (XIMAGE_INSTANCE_WIDGET_FACE (ii), |
2515 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); | 2515 XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); |
2516 #endif | 2516 #endif |
2517 } | 2517 } |
2518 | 2518 |
2526 | 2526 |
2527 tvitem.hParent = parent; | 2527 tvitem.hParent = parent; |
2528 tvitem.hInsertAfter = TVI_LAST; | 2528 tvitem.hInsertAfter = TVI_LAST; |
2529 tvitem.item.mask = TVIF_TEXT | TVIF_CHILDREN; | 2529 tvitem.item.mask = TVIF_TEXT | TVIF_CHILDREN; |
2530 tvitem.item.cChildren = children; | 2530 tvitem.item.cChildren = children; |
2531 | 2531 |
2532 if (GUI_ITEMP (item)) | 2532 if (GUI_ITEMP (item)) |
2533 { | 2533 { |
2534 tvitem.item.lParam = mswindows_register_gui_item (item, domain); | 2534 tvitem.item.lParam = mswindows_register_gui_item (item, domain); |
2535 tvitem.item.mask |= TVIF_PARAM; | 2535 tvitem.item.mask |= TVIF_PARAM; |
2536 GET_C_STRING_OS_DATA_ALLOCA (XGUI_ITEM (item)->name, | 2536 GET_C_STRING_OS_DATA_ALLOCA (XGUI_ITEM (item)->name, |
2537 tvitem.item.pszText); | 2537 tvitem.item.pszText); |
2538 } | 2538 } |
2539 else | 2539 else |
2540 GET_C_STRING_OS_DATA_ALLOCA (item, tvitem.item.pszText); | 2540 GET_C_STRING_OS_DATA_ALLOCA (item, tvitem.item.pszText); |
2541 | 2541 |
2542 tvitem.item.cchTextMax = strlen (tvitem.item.pszText); | 2542 tvitem.item.cchTextMax = strlen (tvitem.item.pszText); |
2543 | 2543 |
2544 if ((ret = (HTREEITEM)SendMessage (wnd, TVM_INSERTITEM, | 2544 if ((ret = (HTREEITEM)SendMessage (wnd, TVM_INSERTITEM, |
2545 0, (LPARAM)&tvitem)) == 0) | 2545 0, (LPARAM)&tvitem)) == 0) |
2546 signal_simple_error ("error adding tree view entry", item); | 2546 signal_simple_error ("error adding tree view entry", item); |
2547 | 2547 |
2548 return ret; | 2548 return ret; |
2549 } | 2549 } |
2574 Lisp_Object rest; | 2574 Lisp_Object rest; |
2575 HWND wnd; | 2575 HWND wnd; |
2576 HTREEITEM parent; | 2576 HTREEITEM parent; |
2577 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2577 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2578 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2578 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2579 pointer_bg, dest_mask, domain, WC_TREEVIEW, | 2579 pointer_bg, dest_mask, domain, WC_TREEVIEW, |
2580 WS_TABSTOP | WS_BORDER | PBS_SMOOTH | 2580 WS_TABSTOP | WS_BORDER | PBS_SMOOTH |
2581 | TVS_HASLINES | TVS_HASBUTTONS, | 2581 | TVS_HASLINES | TVS_HASBUTTONS, |
2582 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); | 2582 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); |
2583 | 2583 |
2584 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); | 2584 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); |
2585 | 2585 |
2586 /* define a root */ | 2586 /* define a root */ |
2587 parent = add_tree_item (image_instance, wnd, NULL, | 2587 parent = add_tree_item (image_instance, wnd, NULL, |
2588 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)), | 2588 XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)), |
2589 TRUE, domain); | 2589 TRUE, domain); |
2590 | 2590 |
2591 /* recursively add items to the tree view */ | 2591 /* recursively add items to the tree view */ |
2592 /* add items to the tab */ | 2592 /* add items to the tab */ |
2593 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))) | 2593 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))) |
2594 { | 2594 { |
2595 if (LISTP (XCAR (rest))) | 2595 if (LISTP (XCAR (rest))) |
2605 Lisp_Object domain, int index) | 2605 Lisp_Object domain, int index) |
2606 { | 2606 { |
2607 TC_ITEM tvitem, *ret; | 2607 TC_ITEM tvitem, *ret; |
2608 | 2608 |
2609 tvitem.mask = TCIF_TEXT; | 2609 tvitem.mask = TCIF_TEXT; |
2610 | 2610 |
2611 if (GUI_ITEMP (item)) | 2611 if (GUI_ITEMP (item)) |
2612 { | 2612 { |
2613 tvitem.lParam = mswindows_register_gui_item (item, domain); | 2613 tvitem.lParam = mswindows_register_gui_item (item, domain); |
2614 tvitem.mask |= TCIF_PARAM; | 2614 tvitem.mask |= TCIF_PARAM; |
2615 GET_C_STRING_OS_DATA_ALLOCA (XGUI_ITEM (item)->name, | 2615 GET_C_STRING_OS_DATA_ALLOCA (XGUI_ITEM (item)->name, |
2616 tvitem.pszText); | 2616 tvitem.pszText); |
2617 } | 2617 } |
2618 else | 2618 else |
2619 { | 2619 { |
2620 CHECK_STRING (item); | 2620 CHECK_STRING (item); |
2621 GET_C_STRING_OS_DATA_ALLOCA (item, tvitem.pszText); | 2621 GET_C_STRING_OS_DATA_ALLOCA (item, tvitem.pszText); |
2622 } | 2622 } |
2623 | 2623 |
2624 tvitem.cchTextMax = strlen (tvitem.pszText); | 2624 tvitem.cchTextMax = strlen (tvitem.pszText); |
2625 | 2625 |
2626 if ((ret = (TC_ITEM*)SendMessage (wnd, TCM_INSERTITEM, | 2626 if ((ret = (TC_ITEM*)SendMessage (wnd, TCM_INSERTITEM, |
2627 index, (LPARAM)&tvitem)) < 0) | 2627 index, (LPARAM)&tvitem)) < 0) |
2628 signal_simple_error ("error adding tab entry", item); | 2628 signal_simple_error ("error adding tab entry", item); |
2629 | 2629 |
2630 return ret; | 2630 return ret; |
2631 } | 2631 } |
2638 Lisp_Object rest; | 2638 Lisp_Object rest; |
2639 HWND wnd; | 2639 HWND wnd; |
2640 int index = 0; | 2640 int index = 0; |
2641 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); | 2641 struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); |
2642 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2642 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2643 pointer_bg, dest_mask, domain, WC_TABCONTROL, | 2643 pointer_bg, dest_mask, domain, WC_TABCONTROL, |
2644 /* borders don't suit tabs so well */ | 2644 /* borders don't suit tabs so well */ |
2645 WS_TABSTOP, | 2645 WS_TABSTOP, |
2646 WS_EX_CONTROLPARENT); | 2646 WS_EX_CONTROLPARENT); |
2647 | 2647 |
2648 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); | 2648 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); |
2668 Lisp_Object rest; | 2668 Lisp_Object rest; |
2669 check_valid_item_list_1 (val); | 2669 check_valid_item_list_1 (val); |
2670 | 2670 |
2671 /* delete the pre-existing items */ | 2671 /* delete the pre-existing items */ |
2672 SendMessage (wnd, TCM_DELETEALLITEMS, 0, 0); | 2672 SendMessage (wnd, TCM_DELETEALLITEMS, 0, 0); |
2673 | 2673 |
2674 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = | 2674 IMAGE_INSTANCE_WIDGET_ITEMS (ii) = |
2675 Fcons (XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)), | 2675 Fcons (XCAR (IMAGE_INSTANCE_WIDGET_ITEMS (ii)), |
2676 parse_gui_item_tree_children (val)); | 2676 parse_gui_item_tree_children (val)); |
2677 | 2677 |
2678 /* add items to the tab */ | 2678 /* add items to the tab */ |
2679 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))) | 2679 LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_ITEMS (ii))) |
2680 { | 2680 { |
2681 add_tab_item (image_instance, wnd, XCAR (rest), | 2681 add_tab_item (image_instance, wnd, XCAR (rest), |
2682 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii), index); | 2682 IMAGE_INSTANCE_SUBWINDOW_FRAME (ii), index); |
2683 index++; | 2683 index++; |
2684 } | 2684 } |
2685 | 2685 |
2686 return Qt; | 2686 return Qt; |
2693 mswindows_label_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2693 mswindows_label_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2694 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2694 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2695 int dest_mask, Lisp_Object domain) | 2695 int dest_mask, Lisp_Object domain) |
2696 { | 2696 { |
2697 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2697 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2698 pointer_bg, dest_mask, domain, "STATIC", | 2698 pointer_bg, dest_mask, domain, "STATIC", |
2699 0, WS_EX_STATICEDGE); | 2699 0, WS_EX_STATICEDGE); |
2700 } | 2700 } |
2701 | 2701 |
2702 /* instantiate a scrollbar control */ | 2702 /* instantiate a scrollbar control */ |
2703 static void | 2703 static void |
2704 mswindows_scrollbar_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, | 2704 mswindows_scrollbar_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, |
2705 Lisp_Object pointer_fg, Lisp_Object pointer_bg, | 2705 Lisp_Object pointer_fg, Lisp_Object pointer_bg, |
2706 int dest_mask, Lisp_Object domain) | 2706 int dest_mask, Lisp_Object domain) |
2707 { | 2707 { |
2708 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2708 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2709 pointer_bg, dest_mask, domain, "SCROLLBAR", | 2709 pointer_bg, dest_mask, domain, "SCROLLBAR", |
2710 0, | 2710 0, |
2711 WS_EX_CLIENTEDGE ); | 2711 WS_EX_CLIENTEDGE ); |
2712 } | 2712 } |
2713 | 2713 |
2714 /* instantiate a combo control */ | 2714 /* instantiate a combo control */ |
2733 thing. */ | 2733 thing. */ |
2734 widget_instantiate_1 (image_instance, instantiator, pointer_fg, | 2734 widget_instantiate_1 (image_instance, instantiator, pointer_fg, |
2735 pointer_bg, dest_mask, domain, len + 1, 0, 0); | 2735 pointer_bg, dest_mask, domain, len + 1, 0, 0); |
2736 | 2736 |
2737 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, | 2737 mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, |
2738 pointer_bg, dest_mask, domain, "COMBOBOX", | 2738 pointer_bg, dest_mask, domain, "COMBOBOX", |
2739 WS_BORDER | WS_TABSTOP | CBS_DROPDOWN | 2739 WS_BORDER | WS_TABSTOP | CBS_DROPDOWN |
2740 | CBS_AUTOHSCROLL | 2740 | CBS_AUTOHSCROLL |
2741 | CBS_HASSTRINGS | WS_VSCROLL, | 2741 | CBS_HASSTRINGS | WS_VSCROLL, |
2742 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); | 2742 WS_EX_CLIENTEDGE | WS_EX_CONTROLPARENT); |
2743 /* reset the height */ | 2743 /* reset the height */ |
2744 widget_text_to_pixel_conversion (domain, | 2744 widget_text_to_pixel_conversion (domain, |
2745 IMAGE_INSTANCE_WIDGET_FACE (ii), 1, 0, | 2745 IMAGE_INSTANCE_WIDGET_FACE (ii), 1, 0, |
2746 &IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii), 0); | 2746 &IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii), 0); |
2747 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); | 2747 wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii); |
2748 /* add items to the combo box */ | 2748 /* add items to the combo box */ |
2749 SendMessage (wnd, CB_RESETCONTENT, 0, 0); | 2749 SendMessage (wnd, CB_RESETCONTENT, 0, 0); |
2750 LIST_LOOP (rest, Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), Q_items, Qnil)) | 2750 LIST_LOOP (rest, Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), Q_items, Qnil)) |
2765 /* get the text from a control */ | 2765 /* get the text from a control */ |
2766 if (EQ (prop, Q_text)) | 2766 if (EQ (prop, Q_text)) |
2767 { | 2767 { |
2768 Extcount len = SendMessage (wnd, WM_GETTEXTLENGTH, 0, 0); | 2768 Extcount len = SendMessage (wnd, WM_GETTEXTLENGTH, 0, 0); |
2769 Extbyte* buf =alloca (len+1); | 2769 Extbyte* buf =alloca (len+1); |
2770 | 2770 |
2771 SendMessage (wnd, WM_GETTEXT, (WPARAM)len+1, (LPARAM) buf); | 2771 SendMessage (wnd, WM_GETTEXT, (WPARAM)len+1, (LPARAM) buf); |
2772 return build_ext_string (buf, FORMAT_OS); | 2772 return build_ext_string (buf, FORMAT_OS); |
2773 } | 2773 } |
2774 return Qunbound; | 2774 return Qunbound; |
2775 } | 2775 } |
2918 #ifdef HAVE_JPEG | 2918 #ifdef HAVE_JPEG |
2919 IIFORMAT_VALID_CONSOLE (mswindows, jpeg); | 2919 IIFORMAT_VALID_CONSOLE (mswindows, jpeg); |
2920 #endif | 2920 #endif |
2921 #ifdef HAVE_TIFF | 2921 #ifdef HAVE_TIFF |
2922 IIFORMAT_VALID_CONSOLE (mswindows, tiff); | 2922 IIFORMAT_VALID_CONSOLE (mswindows, tiff); |
2923 #endif | 2923 #endif |
2924 #ifdef HAVE_PNG | 2924 #ifdef HAVE_PNG |
2925 IIFORMAT_VALID_CONSOLE (mswindows, png); | 2925 IIFORMAT_VALID_CONSOLE (mswindows, png); |
2926 #endif | 2926 #endif |
2927 #ifdef HAVE_GIF | 2927 #ifdef HAVE_GIF |
2928 IIFORMAT_VALID_CONSOLE (mswindows, gif); | 2928 IIFORMAT_VALID_CONSOLE (mswindows, gif); |
2929 #endif | 2929 #endif |
2930 #ifdef HAVE_WIDGETS | 2930 #ifdef HAVE_WIDGETS |
2931 /* button widget */ | 2931 /* button widget */ |
2932 INITIALIZE_DEVICE_IIFORMAT (mswindows, button); | 2932 INITIALIZE_DEVICE_IIFORMAT (mswindows, button); |
2933 IIFORMAT_HAS_DEVMETHOD (mswindows, button, property); | 2933 IIFORMAT_HAS_DEVMETHOD (mswindows, button, property); |
2934 IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate); | 2934 IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate); |
2935 | 2935 |
2936 INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field); | 2936 INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field); |
2937 IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate); | 2937 IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate); |
2938 | 2938 |
2939 INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow); | 2939 INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow); |
2940 IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate); | 2940 IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate); |
2941 | 2941 |
2942 INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); | 2942 INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); |
2943 IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); | 2943 IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); |
2989 IIFORMAT_HAS_METHOD (mswindows_resource, validate); | 2989 IIFORMAT_HAS_METHOD (mswindows_resource, validate); |
2990 IIFORMAT_HAS_METHOD (mswindows_resource, normalize); | 2990 IIFORMAT_HAS_METHOD (mswindows_resource, normalize); |
2991 IIFORMAT_HAS_METHOD (mswindows_resource, possible_dest_types); | 2991 IIFORMAT_HAS_METHOD (mswindows_resource, possible_dest_types); |
2992 IIFORMAT_HAS_METHOD (mswindows_resource, instantiate); | 2992 IIFORMAT_HAS_METHOD (mswindows_resource, instantiate); |
2993 | 2993 |
2994 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_type, | 2994 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_type, |
2995 check_valid_resource_symbol); | 2995 check_valid_resource_symbol); |
2996 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_id, check_valid_resource_id); | 2996 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_id, check_valid_resource_id); |
2997 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_file, check_valid_string); | 2997 IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_file, check_valid_string); |
2998 IIFORMAT_VALID_CONSOLE (mswindows, mswindows_resource); | 2998 IIFORMAT_VALID_CONSOLE (mswindows, mswindows_resource); |
2999 } | 2999 } |