]> git.eshelyaron.com Git - emacs.git/commitdiff
(enum image_value_type): New enumerator
authorGerd Moellmann <gerd@gnu.org>
Wed, 30 May 2001 15:30:19 +0000 (15:30 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 30 May 2001 15:30:19 +0000 (15:30 +0000)
IMAGE_STRING_OR_NIL_VALUE.
(parse_image_spec): Handle it.
(xbm_format, pbm_format): Use it for :foreground and :background.
(xbm_load, pbm_load): Check for nil color names.

src/ChangeLog
src/xfns.c

index 26ee254877ae12e627f188b1fa80dc501072c858..86932ba4e9ffdaeb5f132a8b5999b0605b4d2ca9 100644 (file)
@@ -1,5 +1,11 @@
 2001-05-30  Gerd Moellmann  <gerd@gnu.org>
 
+       * xfns.c (enum image_value_type): New enumerator
+       IMAGE_STRING_OR_NIL_VALUE.
+       (parse_image_spec): Handle it.
+       (xbm_format, pbm_format): Use it for :foreground and :background.
+       (xbm_load, pbm_load): Check for nil color names.
+
        * xterm.c (note_mouse_highlight): If an overlapping overlay
        exists, but we find that we highlight the same overlay as before,
        don't do the highlighting again.
index 485a2f9b4c72555f6ebd208455a97387b4c8f56b..53e7f090ef6e7ee55951dfd04e2635c09919259c 100644 (file)
@@ -5324,6 +5324,7 @@ enum image_value_type
 {
   IMAGE_DONT_CHECK_VALUE_TYPE,
   IMAGE_STRING_VALUE,
+  IMAGE_STRING_OR_NIL_VALUE,
   IMAGE_SYMBOL_VALUE,
   IMAGE_POSITIVE_INTEGER_VALUE,
   IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
@@ -5421,6 +5422,11 @@ parse_image_spec (spec, keywords, nkeywords, type)
            return 0;
          break;
 
+       case IMAGE_STRING_OR_NIL_VALUE:
+         if (!STRINGP (value) && !NILP (value))
+           return 0;
+         break;
+
        case IMAGE_SYMBOL_VALUE:
          if (!SYMBOLP (value))
            return 0;
@@ -6384,8 +6390,8 @@ static struct image_keyword xbm_format[XBM_LAST] =
   {":width",           IMAGE_POSITIVE_INTEGER_VALUE,           0},
   {":height",          IMAGE_POSITIVE_INTEGER_VALUE,           0},
   {":data",            IMAGE_DONT_CHECK_VALUE_TYPE,            0},
-  {":foreground",      IMAGE_STRING_VALUE,                     0},
-  {":background",      IMAGE_STRING_VALUE,                     0},
+  {":foreground",      IMAGE_STRING_OR_NIL_VALUE,              0},
+  {":background",      IMAGE_STRING_OR_NIL_VALUE,              0},
   {":ascent",          IMAGE_ASCENT_VALUE,                     0},
   {":margin",          IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,   0},
   {":relief",          IMAGE_INTEGER_VALUE,                    0},
@@ -6919,10 +6925,12 @@ xbm_load (f, img)
        }
 
       /* Get foreground and background colors, maybe allocate colors.  */
-      if (fmt[XBM_FOREGROUND].count)
+      if (fmt[XBM_FOREGROUND].count
+         && STRINGP (fmt[XBM_FOREGROUND].value))
        foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value,
                                          foreground);
-      if (fmt[XBM_BACKGROUND].count)
+      if (fmt[XBM_BACKGROUND].count
+         && STRINGP (fmt[XBM_BACKGROUND].value))
        background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value,
                                          background);
 
@@ -8110,8 +8118,8 @@ static struct image_keyword pbm_format[PBM_LAST] =
   {":conversion",      IMAGE_DONT_CHECK_VALUE_TYPE,            0},
   {":heuristic-mask",  IMAGE_DONT_CHECK_VALUE_TYPE,            0},
   {":mask",            IMAGE_DONT_CHECK_VALUE_TYPE,            0},
-  {":foreground",      IMAGE_STRING_VALUE,                     0},
-  {":background",      IMAGE_STRING_VALUE,                     0}
+  {":foreground",      IMAGE_STRING_OR_NIL_VALUE,              0},
+  {":background",      IMAGE_STRING_OR_NIL_VALUE,              0}
 };
 
 /* Structure describing the image type `pbm'.  */
@@ -8309,9 +8317,11 @@ pbm_load (f, img)
       parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
       
       /* Get foreground and background colors, maybe allocate colors.  */
-      if (fmt[PBM_FOREGROUND].count)
+      if (fmt[PBM_FOREGROUND].count
+         && STRINGP (fmt[PBM_FOREGROUND].value))
        fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg);
-      if (fmt[PBM_BACKGROUND].count)
+      if (fmt[PBM_BACKGROUND].count
+         && STRINGP (fmt[PBM_BACKGROUND].value))
        bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg);
       
       for (y = 0; y < height; ++y)