aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2001-01-12 15:12:10 +0000
committerGerd Moellmann2001-01-12 15:12:10 +0000
commit35a415071e4b38acd205aea572bb084707237589 (patch)
tree4fce2093119d20157030ca53b64400db70ab89bd /src
parent22d650b85106da5329b270858126562b0dd3faa0 (diff)
downloademacs-35a415071e4b38acd205aea572bb084707237589.tar.gz
emacs-35a415071e4b38acd205aea572bb084707237589.zip
(Vtool_bar_button_margin): Replaces tool_bar_button_margin.
(build_desired_tool_bar_string): Handle Vtool_bar_button_margin being a pair of margins. (syms_of_xdisp): Change DEFVAR_INT of tool-bar-button-margins to DEFVAR_LISP. Extend doc.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c50
1 files changed, 40 insertions, 10 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index ebb80afd11a..4a3abe5bc13 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -239,7 +239,7 @@ int auto_raise_tool_bar_buttons_p;
239 239
240/* Margin around tool bar buttons in pixels. */ 240/* Margin around tool bar buttons in pixels. */
241 241
242int tool_bar_button_margin; 242Lisp_Object Vtool_bar_button_margin;
243 243
244/* Thickness of shadow to draw around tool bar buttons. */ 244/* Thickness of shadow to draw around tool bar buttons. */
245 245
@@ -7186,7 +7186,7 @@ build_desired_tool_bar_string (f)
7186 7186
7187 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 7187 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
7188 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 7188 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
7189 int margin, relief, idx, end; 7189 int hmargin, vmargin, relief, idx, end;
7190 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage; 7190 extern Lisp_Object QCrelief, QCmargin, QCalgorithm, Qimage;
7191 extern Lisp_Object Qlaplace; 7191 extern Lisp_Object Qlaplace;
7192 7192
@@ -7219,7 +7219,24 @@ build_desired_tool_bar_string (f)
7219 7219
7220 /* Compute margin and relief to draw. */ 7220 /* Compute margin and relief to draw. */
7221 relief = tool_bar_button_relief > 0 ? tool_bar_button_relief : 3; 7221 relief = tool_bar_button_relief > 0 ? tool_bar_button_relief : 3;
7222 margin = relief + max (0, tool_bar_button_margin); 7222 hmargin = vmargin = relief;
7223
7224 if (INTEGERP (Vtool_bar_button_margin)
7225 && XINT (Vtool_bar_button_margin) > 0)
7226 {
7227 hmargin += XFASTINT (Vtool_bar_button_margin);
7228 vmargin += XFASTINT (Vtool_bar_button_margin);
7229 }
7230 else if (CONSP (Vtool_bar_button_margin))
7231 {
7232 if (INTEGERP (XCAR (Vtool_bar_button_margin))
7233 && XINT (XCAR (Vtool_bar_button_margin)) > 0)
7234 hmargin += XFASTINT (XCAR (Vtool_bar_button_margin));
7235
7236 if (INTEGERP (XCDR (Vtool_bar_button_margin))
7237 && XINT (XCDR (Vtool_bar_button_margin)) > 0)
7238 vmargin += XFASTINT (XCDR (Vtool_bar_button_margin));
7239 }
7223 7240
7224 if (auto_raise_tool_bar_buttons_p) 7241 if (auto_raise_tool_bar_buttons_p)
7225 { 7242 {
@@ -7228,7 +7245,8 @@ build_desired_tool_bar_string (f)
7228 if (selected_p) 7245 if (selected_p)
7229 { 7246 {
7230 plist = Fplist_put (plist, QCrelief, make_number (-relief)); 7247 plist = Fplist_put (plist, QCrelief, make_number (-relief));
7231 margin -= relief; 7248 hmargin -= relief;
7249 vmargin -= relief;
7232 } 7250 }
7233 } 7251 }
7234 else 7252 else
@@ -7240,12 +7258,20 @@ build_desired_tool_bar_string (f)
7240 (selected_p 7258 (selected_p
7241 ? make_number (-relief) 7259 ? make_number (-relief)
7242 : make_number (relief))); 7260 : make_number (relief)));
7243 margin -= relief; 7261 hmargin -= relief;
7262 vmargin -= relief;
7244 } 7263 }
7245 7264
7246 /* Put a margin around the image. */ 7265 /* Put a margin around the image. */
7247 if (margin) 7266 if (hmargin || vmargin)
7248 plist = Fplist_put (plist, QCmargin, make_number (margin)); 7267 {
7268 if (hmargin == vmargin)
7269 plist = Fplist_put (plist, QCmargin, make_number (hmargin));
7270 else
7271 plist = Fplist_put (plist, QCmargin,
7272 Fcons (make_number (hmargin),
7273 make_number (vmargin)));
7274 }
7249 7275
7250 /* If button is not enabled, and we don't have special images 7276 /* If button is not enabled, and we don't have special images
7251 for the disabled state, make the image appear disabled by 7277 for the disabled state, make the image appear disabled by
@@ -14088,9 +14114,13 @@ otherwise.");
14088 "*Non-nil means raise tool-bar buttons when the mouse moves over them."); 14114 "*Non-nil means raise tool-bar buttons when the mouse moves over them.");
14089 auto_raise_tool_bar_buttons_p = 1; 14115 auto_raise_tool_bar_buttons_p = 1;
14090 14116
14091 DEFVAR_INT ("tool-bar-button-margin", &tool_bar_button_margin, 14117 DEFVAR_LISP ("tool-bar-button-margin", &Vtool_bar_button_margin,
14092 "*Margin around tool-bar buttons in pixels."); 14118 "*Margin around tool-bar buttons in pixels.\n\
14093 tool_bar_button_margin = 1; 14119If an integer, use that for both horizontal and vertical margins.\n\
14120Otherwise, value should be a pair of integers `(HORZ : VERT)' with\n\
14121HORZ specifying the horizontal margin, and VERT specifying the\n\
14122vertical margin.");
14123 Vtool_bar_button_margin = make_number (1);
14094 14124
14095 DEFVAR_INT ("tool-bar-button-relief", &tool_bar_button_relief, 14125 DEFVAR_INT ("tool-bar-button-relief", &tool_bar_button_relief,
14096 "Relief thickness of tool-bar buttons."); 14126 "Relief thickness of tool-bar buttons.");