aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2010-12-20 08:17:26 +0800
committerChong Yidong2010-12-20 08:17:26 +0800
commit949752705efd6a4b7478623d41b3552f93e9596c (patch)
tree3f41f09628f8c7ac17c1c771c69cdb2916cc5fb8 /src
parentef1b0ba7e5a82308514b8427cd84994805e61a4f (diff)
downloademacs-949752705efd6a4b7478623d41b3552f93e9596c.tar.gz
emacs-949752705efd6a4b7478623d41b3552f93e9596c.zip
Implement tool-bar separators for non-GTK tool-bars.
* lisp/tool-bar.el (tool-bar--image-expression): New function. (tool-bar-local-item, tool-bar--image-exp): Use it. (tool-bar-setup): Initialize tool-bar-separator-image-expression. Use :enable instead of :visible to avoid changing the tool-bar configuration unnecessarily. * src/keyboard.c (Vtool_bar_separator_image_expression): New variable. (parse_tool_bar_item): Use it to obtain image separators for displays not using native tool-bar separators. * src/xdisp.c (build_desired_tool_bar_string): Don't handle separators specially, since this is now done in parse_tool_bar_item. * lisp/info.el (info-tool-bar-map): Add separators.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/keyboard.c21
-rw-r--r--src/xdisp.c8
3 files changed, 32 insertions, 6 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 4313c68f593..a6ee107422c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12010-12-20 Chong Yidong <cyd@stupidchicken.com>
2
3 * keyboard.c (Vtool_bar_separator_image_expression): New variable.
4 (parse_tool_bar_item): Use it to obtain image separators for
5 displays not using native tool-bar separators.
6
7 * xdisp.c (build_desired_tool_bar_string): Don't handle separators
8 specially, since this is now done in parse_tool_bar_item.
9
12010-12-19 Stefan Monnier <monnier@iro.umontreal.ca> 102010-12-19 Stefan Monnier <monnier@iro.umontreal.ca>
2 11
3 Minor clean up to silence some gcc warnings. 12 Minor clean up to silence some gcc warnings.
diff --git a/src/keyboard.c b/src/keyboard.c
index 959c57a81e3..27c311d72e2 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -212,6 +212,12 @@ Lisp_Object Vprefix_help_command;
212/* List of items that should move to the end of the menu bar. */ 212/* List of items that should move to the end of the menu bar. */
213Lisp_Object Vmenu_bar_final_items; 213Lisp_Object Vmenu_bar_final_items;
214 214
215/* Expression to evaluate for the tool bar separator image.
216 This is used for build_desired_tool_bar_string only. For GTK, we
217 use GTK tool bar seperators. */
218
219Lisp_Object Vtool_bar_separator_image_expression;
220
215/* Non-nil means show the equivalent key-binding for 221/* Non-nil means show the equivalent key-binding for
216 any M-x command that has one. 222 any M-x command that has one.
217 The value can be a length of time to show the message for. 223 The value can be a length of time to show the message for.
@@ -8294,6 +8300,15 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8294 if (menu_separator_name_p (SDATA (caption))) 8300 if (menu_separator_name_p (SDATA (caption)))
8295 { 8301 {
8296 PROP (TOOL_BAR_ITEM_TYPE) = Qt; 8302 PROP (TOOL_BAR_ITEM_TYPE) = Qt;
8303#if !defined (USE_GTK) && !defined (HAVE_NS)
8304 /* If we use build_desired_tool_bar_string to render the
8305 tool bar, the separator is rendered as an image. */
8306 PROP (TOOL_BAR_ITEM_IMAGES)
8307 = menu_item_eval_property (Vtool_bar_separator_image_expression);
8308 PROP (TOOL_BAR_ITEM_ENABLED_P) = Qnil;
8309 PROP (TOOL_BAR_ITEM_SELECTED_P) = Qnil;
8310 PROP (TOOL_BAR_ITEM_CAPTION) = Qnil;
8311#endif
8297 return 1; 8312 return 1;
8298 } 8313 }
8299 return 0; 8314 return 0;
@@ -12151,6 +12166,12 @@ might happen repeatedly and make Emacs nonfunctional. */);
12151The elements of the list are event types that may have menu bar bindings. */); 12166The elements of the list are event types that may have menu bar bindings. */);
12152 Vmenu_bar_final_items = Qnil; 12167 Vmenu_bar_final_items = Qnil;
12153 12168
12169 DEFVAR_LISP ("tool-bar-separator-image-expression", &Vtool_bar_separator_image_expression,
12170 doc: /* Expression evaluating to the image spec for a tool-bar separator.
12171This is used internally by graphical displays that do not render
12172tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
12173 Vtool_bar_separator_image_expression = Qnil;
12174
12154 DEFVAR_KBOARD ("overriding-terminal-local-map", 12175 DEFVAR_KBOARD ("overriding-terminal-local-map",
12155 Voverriding_terminal_local_map, 12176 Voverriding_terminal_local_map,
12156 doc: /* Per-terminal keymap that overrides all other local keymaps. 12177 doc: /* Per-terminal keymap that overrides all other local keymaps.
diff --git a/src/xdisp.c b/src/xdisp.c
index 41204e0a5b4..7a299055185 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10317,10 +10317,6 @@ build_desired_tool_bar_string (struct frame *f)
10317 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 10317 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
10318 int hmargin, vmargin, relief, idx, end; 10318 int hmargin, vmargin, relief, idx, end;
10319 10319
10320 /* Ignore separator items. */
10321 if (EQ (PROP (TOOL_BAR_ITEM_TYPE), Qt))
10322 continue;
10323
10324 /* If image is a vector, choose the image according to the 10320 /* If image is a vector, choose the image according to the
10325 button state. */ 10321 button state. */
10326 image = PROP (TOOL_BAR_ITEM_IMAGES); 10322 image = PROP (TOOL_BAR_ITEM_IMAGES);
@@ -10495,7 +10491,7 @@ display_tool_bar_line (struct it *it, int height)
10495 row->used[TEXT_AREA] = n_glyphs_before; 10491 row->used[TEXT_AREA] = n_glyphs_before;
10496 *it = it_before; 10492 *it = it_before;
10497 /* If this is the only glyph on this line, it will never fit on the 10493 /* If this is the only glyph on this line, it will never fit on the
10498 toolbar, so skip it. But ensure there is at least one glyph, 10494 tool-bar, so skip it. But ensure there is at least one glyph,
10499 so we don't accidentally disable the tool-bar. */ 10495 so we don't accidentally disable the tool-bar. */
10500 if (n_glyphs_before == 0 10496 if (n_glyphs_before == 0
10501 && (it->vpos > 0 || IT_STRING_CHARPOS (*it) < it->end_charpos-1)) 10497 && (it->vpos > 0 || IT_STRING_CHARPOS (*it) < it->end_charpos-1))
@@ -26885,7 +26881,7 @@ vertical margin. */);
26885 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF; 26881 tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
26886 26882
26887 DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style, 26883 DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
26888 doc: /* *Tool bar style to use. 26884 doc: /* Tool bar style to use.
26889It can be one of 26885It can be one of
26890 image - show images only 26886 image - show images only
26891 text - show text only 26887 text - show text only