aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2006-12-29 23:29:45 +0000
committerKim F. Storm2006-12-29 23:29:45 +0000
commitd689ee257cfb9764c7bdd26c745d54ce1ff6a306 (patch)
tree7df300782990b73cf5c41c54eab9bfd0318231a1 /src
parent7d1d98ee4be3868f134e222dac56e88adee331ce (diff)
downloademacs-d689ee257cfb9764c7bdd26c745d54ce1ff6a306.tar.gz
emacs-d689ee257cfb9764c7bdd26c745d54ce1ff6a306.zip
(auto_resize_tool_bars_p): Replace with ...
(Vauto_resize_tool_bars): ... this. (syms_of_xdisp): DEFVAR_LISP and initialize it. Update doc string to describe new value `grow-only', and use of C-l. (display_tool_bar_line): Only use default face for border below toolbar if not grow-only (to get acceptable visual appearence). Explicitly set visible_height for empty toolbar lines. (redisplay_tool_bar): Handle `grow-only' setting. Check and clear minimize_tool_bar_window_p flag.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c75
1 files changed, 48 insertions, 27 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 9cb3d26a49d..e4b5dec7959 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -283,10 +283,12 @@ Lisp_Object Vtool_bar_button_margin;
283 283
284EMACS_INT tool_bar_button_relief; 284EMACS_INT tool_bar_button_relief;
285 285
286/* Non-zero means automatically resize tool-bars so that all tool-bar 286/* Non-nil means automatically resize tool-bars so that all tool-bar
287 items are visible, and no blank lines remain. */ 287 items are visible, and no blank lines remain.
288 288
289int auto_resize_tool_bars_p; 289 If value is `grow-only', only make tool-bar bigger. */
290
291Lisp_Object Vauto_resize_tool_bars;
290 292
291/* Non-zero means draw block and hollow cursor as wide as the glyph 293/* Non-zero means draw block and hollow cursor as wide as the glyph
292 under it. For example, if a block cursor is over a tab, it will be 294 under it. For example, if a block cursor is over a tab, it will be
@@ -9694,9 +9696,16 @@ display_tool_bar_line (it, height)
9694 out:; 9696 out:;
9695 9697
9696 row->displays_text_p = row->used[TEXT_AREA] != 0; 9698 row->displays_text_p = row->used[TEXT_AREA] != 0;
9697 /* Use default face for the border below the tool bar. */ 9699
9698 if (!row->displays_text_p) 9700 /* Use default face for the border below the tool bar.
9701
9702 FIXME: When auto-resize-tool-bars is grow-only, there is
9703 no additional border below the possibly empty tool-bar lines.
9704 So to make the extra empty lines look "normal", we have to
9705 use the tool-bar face for the border too. */
9706 if (!row->displays_text_p && !EQ (Vauto_resize_tool_bars, Qgrow_only))
9699 it->face_id = DEFAULT_FACE_ID; 9707 it->face_id = DEFAULT_FACE_ID;
9708
9700 extend_face_to_end_of_line (it); 9709 extend_face_to_end_of_line (it);
9701 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1; 9710 last = row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1;
9702 last->right_box_line_p = 1; 9711 last->right_box_line_p = 1;
@@ -9718,6 +9727,7 @@ display_tool_bar_line (it, height)
9718 if (!row->displays_text_p) 9727 if (!row->displays_text_p)
9719 { 9728 {
9720 row->height = row->phys_height = it->last_visible_y - row->y; 9729 row->height = row->phys_height = it->last_visible_y - row->y;
9730 row->visible_height = row->height;
9721 row->ascent = row->phys_ascent = 0; 9731 row->ascent = row->phys_ascent = 0;
9722 row->extra_line_spacing = 0; 9732 row->extra_line_spacing = 0;
9723 } 9733 }
@@ -9820,7 +9830,6 @@ redisplay_tool_bar (f)
9820 struct window *w; 9830 struct window *w;
9821 struct it it; 9831 struct it it;
9822 struct glyph_row *row; 9832 struct glyph_row *row;
9823 int change_height_p = 0;
9824 9833
9825#ifdef USE_GTK 9834#ifdef USE_GTK
9826 if (FRAME_EXTERNAL_TOOL_BAR (f)) 9835 if (FRAME_EXTERNAL_TOOL_BAR (f))
@@ -9915,10 +9924,10 @@ redisplay_tool_bar (f)
9915 w->desired_matrix->no_scrolling_p = 1; 9924 w->desired_matrix->no_scrolling_p = 1;
9916 w->must_be_updated_p = 1; 9925 w->must_be_updated_p = 1;
9917 9926
9918 if (auto_resize_tool_bars_p) 9927 if (!NILP (Vauto_resize_tool_bars))
9919 { 9928 {
9920 int nlines, nrows;
9921 int max_tool_bar_height = MAX_FRAME_TOOL_BAR_HEIGHT (f); 9929 int max_tool_bar_height = MAX_FRAME_TOOL_BAR_HEIGHT (f);
9930 int change_height_p = 0;
9922 9931
9923 /* If we couldn't display everything, change the tool-bar's 9932 /* If we couldn't display everything, change the tool-bar's
9924 height if there is room for more. */ 9933 height if there is room for more. */
@@ -9944,29 +9953,40 @@ redisplay_tool_bar (f)
9944 9953
9945 /* Resize windows as needed by changing the `tool-bar-lines' 9954 /* Resize windows as needed by changing the `tool-bar-lines'
9946 frame parameter. */ 9955 frame parameter. */
9947 if (change_height_p 9956 if (change_height_p)
9948 && (nlines = tool_bar_lines_needed (f, &nrows),
9949 nlines != WINDOW_TOTAL_LINES (w)))
9950 { 9957 {
9951 extern Lisp_Object Qtool_bar_lines; 9958 extern Lisp_Object Qtool_bar_lines;
9952 Lisp_Object frame; 9959 Lisp_Object frame;
9953 int old_height = WINDOW_TOTAL_LINES (w); 9960 int old_height = WINDOW_TOTAL_LINES (w);
9961 int nrows;
9962 int nlines = tool_bar_lines_needed (f, &nrows);
9954 9963
9955 XSETFRAME (frame, f); 9964 change_height_p = ((EQ (Vauto_resize_tool_bars, Qgrow_only)
9956 Fmodify_frame_parameters (frame, 9965 && !f->minimize_tool_bar_window_p)
9957 Fcons (Fcons (Qtool_bar_lines, 9966 ? (nlines > old_height)
9958 make_number (nlines)), 9967 : (nlines != old_height));
9959 Qnil)); 9968 f->minimize_tool_bar_window_p = 0;
9960 if (WINDOW_TOTAL_LINES (w) != old_height) 9969
9970 if (change_height_p)
9961 { 9971 {
9962 clear_glyph_matrix (w->desired_matrix); 9972 XSETFRAME (frame, f);
9963 f->n_tool_bar_rows = nrows; 9973 Fmodify_frame_parameters (frame,
9964 fonts_changed_p = 1; 9974 Fcons (Fcons (Qtool_bar_lines,
9975 make_number (nlines)),
9976 Qnil));
9977 if (WINDOW_TOTAL_LINES (w) != old_height)
9978 {
9979 clear_glyph_matrix (w->desired_matrix);
9980 f->n_tool_bar_rows = nrows;
9981 fonts_changed_p = 1;
9982 return 1;
9983 }
9965 } 9984 }
9966 } 9985 }
9967 } 9986 }
9968 9987
9969 return change_height_p; 9988 f->minimize_tool_bar_window_p = 0;
9989 return 0;
9970} 9990}
9971 9991
9972 9992
@@ -13447,7 +13467,7 @@ redisplay_window (window, just_this_one_p)
13447#else 13467#else
13448 redisplay_tool_bar_p = WINDOWP (f->tool_bar_window) 13468 redisplay_tool_bar_p = WINDOWP (f->tool_bar_window)
13449 && (FRAME_TOOL_BAR_LINES (f) > 0 13469 && (FRAME_TOOL_BAR_LINES (f) > 0
13450 || auto_resize_tool_bars_p); 13470 || !NILP (Vauto_resize_tool_bars));
13451 13471
13452#endif 13472#endif
13453 13473
@@ -24077,12 +24097,13 @@ Autoselection selects the minibuffer only if it is active, and never
24077unselects the minibuffer if it is active. */); 24097unselects the minibuffer if it is active. */);
24078 Vmouse_autoselect_window = Qnil; 24098 Vmouse_autoselect_window = Qnil;
24079 24099
24080 DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p, 24100 DEFVAR_LISP ("auto-resize-tool-bars", &Vauto_resize_tool_bars,
24081 doc: /* *Non-nil means automatically resize tool-bars. 24101 doc: /* *Non-nil means automatically resize tool-bars.
24082This increases a tool-bar's height if not all tool-bar items are visible. 24102This dynamically changes the tool-bar's height to the minimum height
24083It decreases a tool-bar's height when it would display blank lines 24103that is needed to make all tool-bar items visible.
24084otherwise. */); 24104If value is `grow-only', the tool-bar's height is only increased
24085 auto_resize_tool_bars_p = 1; 24105automatically; to decreace the tool-bar height, use \\[recenter]. */);
24106 Vauto_resize_tool_bars = Qt;
24086 24107
24087 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p, 24108 DEFVAR_BOOL ("auto-raise-tool-bar-buttons", &auto_raise_tool_bar_buttons_p,
24088 doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */); 24109 doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them. */);