Mercurial > emacs
comparison src/xdisp.c @ 31650:8b3846ae64fe
(build_desired_tool_bar_string): For a toolbar item in
disabled state, don't apply an image transformation algorithm if
the user specified an image for the disabled state. Use
`:algorthm disabled' for creating a disabled item's image if the
user hasn't specified an image.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 15 Sep 2000 21:01:14 +0000 |
parents | 29c6825c59a8 |
children | 2c8c52a67b91 |
comparison
equal
deleted
inserted
replaced
31649:fe990a5df9d3 | 31650:8b3846ae64fe |
---|---|
6844 (XVECTOR (f->desired_tool_bar_items) \ | 6844 (XVECTOR (f->desired_tool_bar_items) \ |
6845 ->contents[i * TOOL_BAR_ITEM_NSLOTS + (IDX)]) | 6845 ->contents[i * TOOL_BAR_ITEM_NSLOTS + (IDX)]) |
6846 | 6846 |
6847 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); | 6847 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); |
6848 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); | 6848 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); |
6849 int margin, relief; | 6849 int margin, relief, idx; |
6850 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; | 6850 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; |
6851 extern Lisp_Object Qlaplace; | 6851 extern Lisp_Object Qlaplace; |
6852 | 6852 |
6853 /* If image is a vector, choose the image according to the | 6853 /* If image is a vector, choose the image according to the |
6854 button state. */ | 6854 button state. */ |
6855 image = PROP (TOOL_BAR_ITEM_IMAGES); | 6855 image = PROP (TOOL_BAR_ITEM_IMAGES); |
6856 if (VECTORP (image)) | 6856 if (VECTORP (image)) |
6857 { | 6857 { |
6858 enum tool_bar_item_image idx; | |
6859 | |
6860 if (enabled_p) | 6858 if (enabled_p) |
6861 idx = (selected_p | 6859 idx = (selected_p |
6862 ? TOOL_BAR_IMAGE_ENABLED_SELECTED | 6860 ? TOOL_BAR_IMAGE_ENABLED_SELECTED |
6863 : TOOL_BAR_IMAGE_ENABLED_DESELECTED); | 6861 : TOOL_BAR_IMAGE_ENABLED_DESELECTED); |
6864 else | 6862 else |
6865 idx = (selected_p | 6863 idx = (selected_p |
6866 ? TOOL_BAR_IMAGE_DISABLED_SELECTED | 6864 ? TOOL_BAR_IMAGE_DISABLED_SELECTED |
6867 : TOOL_BAR_IMAGE_DISABLED_DESELECTED); | 6865 : TOOL_BAR_IMAGE_DISABLED_DESELECTED); |
6868 | 6866 |
6869 xassert (XVECTOR (image)->size >= idx); | 6867 xassert (ASIZE (image) >= idx); |
6870 image = XVECTOR (image)->contents[idx]; | 6868 image = AREF (image, idx); |
6871 } | 6869 } |
6870 else | |
6871 idx = -1; | |
6872 | 6872 |
6873 /* Ignore invalid image specifications. */ | 6873 /* Ignore invalid image specifications. */ |
6874 if (!valid_image_p (image)) | 6874 if (!valid_image_p (image)) |
6875 continue; | 6875 continue; |
6876 | 6876 |
6905 | 6905 |
6906 /* Put a margin around the image. */ | 6906 /* Put a margin around the image. */ |
6907 if (margin) | 6907 if (margin) |
6908 plist = Fplist_put (plist, QCmargin, make_number (margin)); | 6908 plist = Fplist_put (plist, QCmargin, make_number (margin)); |
6909 | 6909 |
6910 /* If button is not enabled, make the image appear disabled by | 6910 /* If button is not enabled, and we don't have special images |
6911 for the disabled state, make the image appear disabled by | |
6911 applying an appropriate algorithm to it. */ | 6912 applying an appropriate algorithm to it. */ |
6912 if (!enabled_p) | 6913 if (!enabled_p && idx < 0) |
6913 plist = Fplist_put (plist, QCalgorithm, Qlaplace); | 6914 plist = Fplist_put (plist, QCalgorithm, Qdisabled); |
6914 | 6915 |
6915 /* Put a `display' text property on the string for the image to | 6916 /* Put a `display' text property on the string for the image to |
6916 display. Put a `menu-item' property on the string that gives | 6917 display. Put a `menu-item' property on the string that gives |
6917 the start of this item's properties in the tool-bar items | 6918 the start of this item's properties in the tool-bar items |
6918 vector. */ | 6919 vector. */ |