Mercurial > hg > xemacs-beta
comparison src/glyphs.c @ 278:90d73dddcdc4 r21-0b37
Import from CVS: tag r21-0b37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:31:29 +0200 |
parents | 6330739388db |
children | 7df0dd720c89 |
comparison
equal
deleted
inserted
replaced
277:cfdf3ff11843 | 278:90d73dddcdc4 |
---|---|
69 | 69 |
70 DEFINE_IMAGE_INSTANTIATOR_FORMAT (nothing); | 70 DEFINE_IMAGE_INSTANTIATOR_FORMAT (nothing); |
71 DEFINE_IMAGE_INSTANTIATOR_FORMAT (inherit); | 71 DEFINE_IMAGE_INSTANTIATOR_FORMAT (inherit); |
72 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string); | 72 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string); |
73 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); | 73 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); |
74 | |
75 Lisp_Object x_locate_pixmap_file (Lisp_Object name); | |
76 Lisp_Object mswindows_locate_pixmap_file (Lisp_Object name); | |
74 | 77 |
75 #ifdef HAVE_XPM | 78 #ifdef HAVE_XPM |
76 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm); | 79 DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm); |
77 Lisp_Object Qxpm; | 80 Lisp_Object Qxpm; |
78 Lisp_Object Q_color_symbols; | 81 Lisp_Object Q_color_symbols; |
1448 else | 1451 else |
1449 incompatible_image_types (instantiator, dest_mask, IMAGE_TEXT_MASK); | 1452 incompatible_image_types (instantiator, dest_mask, IMAGE_TEXT_MASK); |
1450 } | 1453 } |
1451 | 1454 |
1452 | 1455 |
1456 /************************************************************************/ | |
1457 /* pixmap file functions */ | |
1458 /************************************************************************/ | |
1459 | |
1460 /* If INSTANTIATOR refers to inline data, return Qnil. | |
1461 If INSTANTIATOR refers to data in a file, return the full filename | |
1462 if it exists; otherwise, return a cons of (filename). | |
1463 | |
1464 FILE_KEYWORD and DATA_KEYWORD are symbols specifying the | |
1465 keywords used to look up the file and inline data, | |
1466 respectively, in the instantiator. Normally these would | |
1467 be Q_file and Q_data, but might be different for mask data. */ | |
1468 | |
1469 Lisp_Object | |
1470 potential_pixmap_file_instantiator (Lisp_Object instantiator, | |
1471 Lisp_Object file_keyword, | |
1472 Lisp_Object data_keyword, | |
1473 Lisp_Object console_type) | |
1474 { | |
1475 Lisp_Object file; | |
1476 Lisp_Object data; | |
1477 | |
1478 assert (VECTORP (instantiator)); | |
1479 | |
1480 data = find_keyword_in_vector (instantiator, data_keyword); | |
1481 file = find_keyword_in_vector (instantiator, file_keyword); | |
1482 | |
1483 if (!NILP (file) && NILP (data)) | |
1484 { | |
1485 Lisp_Object retval = MAYBE_LISP_CONTYPE_METH | |
1486 (decode_console_type(console_type, ERROR_ME), | |
1487 locate_pixmap_file, (file)); | |
1488 | |
1489 if (!NILP (retval)) | |
1490 return retval; | |
1491 else | |
1492 return Fcons (file, Qnil); /* should have been file */ | |
1493 } | |
1494 | |
1495 return Qnil; | |
1496 } | |
1497 | |
1498 Lisp_Object | |
1499 simple_image_type_normalize (Lisp_Object inst, Lisp_Object console_type, | |
1500 Lisp_Object image_type_tag) | |
1501 { | |
1502 /* This function can call lisp */ | |
1503 Lisp_Object file = Qnil; | |
1504 struct gcpro gcpro1, gcpro2; | |
1505 Lisp_Object alist = Qnil; | |
1506 | |
1507 GCPRO2 (file, alist); | |
1508 | |
1509 /* Now, convert any file data into inline data. At the end of this, | |
1510 `data' will contain the inline data (if any) or Qnil, and `file' | |
1511 will contain the name this data was derived from (if known) or | |
1512 Qnil. | |
1513 | |
1514 Note that if we cannot generate any regular inline data, we | |
1515 skip out. */ | |
1516 | |
1517 file = potential_pixmap_file_instantiator (inst, Q_file, Q_data, | |
1518 console_type); | |
1519 | |
1520 if (CONSP (file)) /* failure locating filename */ | |
1521 signal_double_file_error ("Opening pixmap file", | |
1522 "no such file or directory", | |
1523 Fcar (file)); | |
1524 | |
1525 if (NILP (file)) /* no conversion necessary */ | |
1526 RETURN_UNGCPRO (inst); | |
1527 | |
1528 alist = tagged_vector_to_alist (inst); | |
1529 | |
1530 { | |
1531 Lisp_Object data = make_string_from_file (file); | |
1532 alist = remassq_no_quit (Q_file, alist); | |
1533 /* there can't be a :data at this point. */ | |
1534 alist = Fcons (Fcons (Q_file, file), | |
1535 Fcons (Fcons (Q_data, data), alist)); | |
1536 } | |
1537 | |
1538 { | |
1539 Lisp_Object result = alist_to_tagged_vector (image_type_tag, alist); | |
1540 free_alist (alist); | |
1541 RETURN_UNGCPRO (result); | |
1542 } | |
1543 } | |
1544 | |
1545 | |
1453 #ifdef HAVE_XPM | 1546 #ifdef HAVE_XPM |
1454 | 1547 |
1455 /********************************************************************** | 1548 /********************************************************************** |
1456 * XPM * | 1549 * XPM * |
1457 **********************************************************************/ | 1550 **********************************************************************/ |