aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Djärv2010-11-20 15:51:25 +0100
committerJan Djärv2010-11-20 15:51:25 +0100
commitd2bd51898e48c2fd47a98a42654842a65feea7ad (patch)
tree445b7d1580622915a8b4d0e2886be772640face3
parent0e7c0582af3a7ee210dfa6a1ab6c41b23bea1951 (diff)
downloademacs-d2bd51898e48c2fd47a98a42654842a65feea7ad.tar.gz
emacs-d2bd51898e48c2fd47a98a42654842a65feea7ad.zip
Add keyword :vert-only for tool bar items with labels not shown horizontally.
* lisp/info.el (info-tool-bar-map): Add some :vert-only keywords. * lisp/tool-bar.el (tool-bar-setup): Add some :vert-only keywords. * src/dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY. * src/gtkutil.c (xg_make_tool_item): Take vert_only as argument. Set important to ! vert_only. (xg_show_toolbar_item): Don't show label horizontally if tool item isn't important. (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to xg_make_tool_item, or update important on existing tool item. * src/keyboard.c (QCvert_only): New variable. (parse_tool_bar_item): Check for QCvert_only. (syms_of_keyboard): Initialize QCvert_only.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/info.el9
-rw-r--r--lisp/tool-bar.el22
-rw-r--r--src/ChangeLog15
-rw-r--r--src/dispextern.h3
-rw-r--r--src/gtkutil.c18
-rw-r--r--src/keyboard.c11
7 files changed, 63 insertions, 21 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 345f31fc8ff..0594cca0b8d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12010-11-20 Jan Djärv <jan.h.d@swipnet.se>
2
3 * tool-bar.el (tool-bar-setup): Add some :vert-only keywords.
4
5 * info.el (info-tool-bar-map): Add some :vert-only keywords.
6
12010-11-20 Eli Zaretskii <eliz@gnu.org> 72010-11-20 Eli Zaretskii <eliz@gnu.org>
2 8
3 * international/characters.el (glyphless-char-display-control): 9 * international/characters.el (glyphless-char-display-control):
diff --git a/lisp/info.el b/lisp/info.el
index 3e3ecc131cf..7c0333f6b8e 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -3763,15 +3763,18 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
3763 (let ((map (make-sparse-keymap))) 3763 (let ((map (make-sparse-keymap)))
3764 (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map 3764 (tool-bar-local-item-from-menu 'Info-history-back "left-arrow" map Info-mode-map
3765 :rtl "right-arrow" 3765 :rtl "right-arrow"
3766 :label "Back") 3766 :label "Back"
3767 :vert-only t)
3767 (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map 3768 (tool-bar-local-item-from-menu 'Info-history-forward "right-arrow" map Info-mode-map
3768 :rtl "left-arrow" 3769 :rtl "left-arrow"
3769 :label "Forward") 3770 :label "Forward"
3771 :vert-only t)
3770 (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map 3772 (tool-bar-local-item-from-menu 'Info-prev "prev-node" map Info-mode-map
3771 :rtl "next-node") 3773 :rtl "next-node")
3772 (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map 3774 (tool-bar-local-item-from-menu 'Info-next "next-node" map Info-mode-map
3773 :rtl "prev-node") 3775 :rtl "prev-node")
3774 (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map) 3776 (tool-bar-local-item-from-menu 'Info-up "up-node" map Info-mode-map
3777 :vert-only t)
3775 (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map) 3778 (tool-bar-local-item-from-menu 'Info-top-node "home" map Info-mode-map)
3776 (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map) 3779 (tool-bar-local-item-from-menu 'Info-goto-node "jump-to" map Info-mode-map)
3777 (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map 3780 (tool-bar-local-item-from-menu 'Info-index "index" map Info-mode-map
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index 6630d85cd3e..4b6fd970d8a 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -260,31 +260,33 @@ holds a keymap."
260 ;; People say it's bad to have EXIT on the tool bar, since users 260 ;; People say it's bad to have EXIT on the tool bar, since users
261 ;; might inadvertently click that button. 261 ;; might inadvertently click that button.
262 ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit") 262 ;;(tool-bar-add-item-from-menu 'save-buffers-kill-emacs "exit")
263 (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File") 263 (tool-bar-add-item-from-menu 'find-file "new" nil :label "New File"
264 (tool-bar-add-item-from-menu 'menu-find-file-existing "open") 264 :vert-only t)
265 (tool-bar-add-item-from-menu 'dired "diropen") 265 (tool-bar-add-item-from-menu 'menu-find-file-existing "open" nil
266 (tool-bar-add-item-from-menu 'kill-this-buffer "close") 266 :vert-only t)
267 (tool-bar-add-item-from-menu 'save-buffer "save" nil 267 (tool-bar-add-item-from-menu 'dired "diropen" nil :vert-only t)
268 (tool-bar-add-item-from-menu 'kill-this-buffer "close" nil :vert-only t)
269 (tool-bar-add-item-from-menu 'save-buffer "save" nil :vert-only t
268 :visible '(or buffer-file-name 270 :visible '(or buffer-file-name
269 (not (eq 'special 271 (not (eq 'special
270 (get major-mode 272 (get major-mode
271 'mode-class))))) 273 'mode-class)))))
272 (tool-bar-add-item-from-menu 'write-file "saveas" nil 274 (tool-bar-add-item-from-menu 'write-file "saveas" nil :vert-only t
273 :visible '(or buffer-file-name 275 :visible '(or buffer-file-name
274 (not (eq 'special 276 (not (eq 'special
275 (get major-mode 277 (get major-mode
276 'mode-class))))) 278 'mode-class)))))
277 (tool-bar-add-item-from-menu 'undo "undo" nil 279 (tool-bar-add-item-from-menu 'undo "undo" nil :vert-only t
278 :visible '(not (eq 'special (get major-mode 280 :visible '(not (eq 'special (get major-mode
279 'mode-class)))) 281 'mode-class))))
280 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut]) 282 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [cut])
281 "cut" nil 283 "cut" nil :vert-only t
282 :visible '(not (eq 'special (get major-mode 284 :visible '(not (eq 'special (get major-mode
283 'mode-class)))) 285 'mode-class))))
284 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy]) 286 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [copy])
285 "copy") 287 "copy" nil :vert-only t)
286 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste]) 288 (tool-bar-add-item-from-menu (lookup-key menu-bar-edit-menu [paste])
287 "paste" nil 289 "paste" nil :vert-only t
288 :visible '(not (eq 'special (get major-mode 290 :visible '(not (eq 'special (get major-mode
289 'mode-class)))) 291 'mode-class))))
290 (tool-bar-add-item-from-menu 'nonincremental-search-forward "search" 292 (tool-bar-add-item-from-menu 'nonincremental-search-forward "search"
diff --git a/src/ChangeLog b/src/ChangeLog
index b7c1ef2c93c..552d8efe6f1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,18 @@
12010-11-20 Jan Djärv <jan.h.d@swipnet.se>
2
3 * gtkutil.c (xg_make_tool_item): Take vert_only as argument.
4 Set important to ! vert_only.
5 (xg_show_toolbar_item): Don't show label horizontally if
6 tool item isn't important.
7 (update_frame_tool_bar): Get TOOL_BAR_ITEM_VERT_ONLY and pass it to
8 xg_make_tool_item, or update important on existing tool item.
9
10 * keyboard.c (QCvert_only): New variable.
11 (parse_tool_bar_item): Check for QCvert_only.
12 (syms_of_keyboard): Initialize QCvert_only.
13
14 * dispextern.h (tool_bar_item_idx): Add TOOL_BAR_ITEM_VERT_ONLY.
15
12010-11-20 Eli Zaretskii <eliz@gnu.org> 162010-11-20 Eli Zaretskii <eliz@gnu.org>
2 17
3 * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the 18 * msdos.c (dos_rawgetc): Use gen_help_event, instead of doing the
diff --git a/src/dispextern.h b/src/dispextern.h
index 0030aa8f184..7426c03b5ec 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2887,6 +2887,9 @@ enum tool_bar_item_idx
2887 /* Label to show when text labels are enabled. */ 2887 /* Label to show when text labels are enabled. */
2888 TOOL_BAR_ITEM_LABEL, 2888 TOOL_BAR_ITEM_LABEL,
2889 2889
2890 /* If we shall show the label only below the icon and not beside it. */
2891 TOOL_BAR_ITEM_VERT_ONLY,
2892
2890 /* Sentinel = number of slots in tool_bar_items occupied by one 2893 /* Sentinel = number of slots in tool_bar_items occupied by one
2891 tool-bar item. */ 2894 tool-bar item. */
2892 TOOL_BAR_ITEM_NSLOTS 2895 TOOL_BAR_ITEM_NSLOTS
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 7103d2b1991..89b16a10fbc 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4059,7 +4059,8 @@ xg_make_tool_item (FRAME_PTR f,
4059 GtkWidget *wimage, 4059 GtkWidget *wimage,
4060 GtkWidget **wbutton, 4060 GtkWidget **wbutton,
4061 const char *label, 4061 const char *label,
4062 int i) 4062 int i,
4063 int vert_only)
4063{ 4064{
4064 GtkToolItem *ti = gtk_tool_item_new (); 4065 GtkToolItem *ti = gtk_tool_item_new ();
4065 Lisp_Object style = Ftool_bar_get_system_style (); 4066 Lisp_Object style = Ftool_bar_get_system_style ();
@@ -4071,6 +4072,10 @@ xg_make_tool_item (FRAME_PTR f,
4071 GtkWidget *wb = gtk_button_new (); 4072 GtkWidget *wb = gtk_button_new ();
4072 GtkWidget *weventbox = gtk_event_box_new (); 4073 GtkWidget *weventbox = gtk_event_box_new ();
4073 4074
4075 /* We are not letting Gtk+ alter display on this, we only keep it here
4076 so we can get it later in xg_show_toolbar_item. */
4077 gtk_tool_item_set_is_important (ti, !vert_only);
4078
4074 if (wimage && ! text_image) 4079 if (wimage && ! text_image)
4075 gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0); 4080 gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
4076 4081
@@ -4144,7 +4149,8 @@ xg_show_toolbar_item (GtkToolItem *ti)
4144 int text_image = EQ (style, Qtext_image_horiz); 4149 int text_image = EQ (style, Qtext_image_horiz);
4145 4150
4146 int horiz = both_horiz || text_image; 4151 int horiz = both_horiz || text_image;
4147 int show_label = ! EQ (style, Qimage); 4152 int vert_only = ! gtk_tool_item_get_is_important (ti);
4153 int show_label = ! EQ (style, Qimage) && ! (vert_only && horiz);
4148 int show_image = ! EQ (style, Qtext); 4154 int show_image = ! EQ (style, Qtext);
4149 4155
4150 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti)); 4156 GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
@@ -4301,7 +4307,8 @@ update_frame_tool_bar (FRAME_PTR f)
4301 Lisp_Object specified_file; 4307 Lisp_Object specified_file;
4302 const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) 4308 const char *label = (STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
4303 ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : ""); 4309 ? SSDATA (PROP (TOOL_BAR_ITEM_LABEL)) : "");
4304 4310 int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
4311
4305 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i); 4312 ti = gtk_toolbar_get_nth_item (GTK_TOOLBAR (wtoolbar), i);
4306 4313
4307 if (ti) 4314 if (ti)
@@ -4391,7 +4398,7 @@ update_frame_tool_bar (FRAME_PTR f)
4391 else 4398 else
4392 { 4399 {
4393 /* Insert an empty (non-image) button */ 4400 /* Insert an empty (non-image) button */
4394 ti = xg_make_tool_item (f, NULL, NULL, "", i); 4401 ti = xg_make_tool_item (f, NULL, NULL, "", i, 0);
4395 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); 4402 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
4396 } 4403 }
4397 continue; 4404 continue;
@@ -4425,7 +4432,7 @@ update_frame_tool_bar (FRAME_PTR f)
4425 } 4432 }
4426 4433
4427 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin); 4434 gtk_misc_set_padding (GTK_MISC (w), hmargin, vmargin);
4428 ti = xg_make_tool_item (f, w, &wbutton, label, i); 4435 ti = xg_make_tool_item (f, w, &wbutton, label, i, vert_only);
4429 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1); 4436 gtk_toolbar_insert (GTK_TOOLBAR (wtoolbar), ti, -1);
4430 gtk_widget_set_sensitive (wbutton, enabled_p); 4437 gtk_widget_set_sensitive (wbutton, enabled_p);
4431 } 4438 }
@@ -4442,6 +4449,7 @@ update_frame_tool_bar (FRAME_PTR f)
4442 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage), 4449 gpointer old_icon_name = g_object_get_data (G_OBJECT (wimage),
4443 XG_TOOL_BAR_ICON_NAME); 4450 XG_TOOL_BAR_ICON_NAME);
4444 gtk_label_set_text (GTK_LABEL (wlbl), label); 4451 gtk_label_set_text (GTK_LABEL (wlbl), label);
4452 gtk_tool_item_set_is_important (ti, !vert_only);
4445 if (stock_name && 4453 if (stock_name &&
4446 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0)) 4454 (! old_stock_name || strcmp (old_stock_name, stock_name) != 0))
4447 { 4455 {
diff --git a/src/keyboard.c b/src/keyboard.c
index ec5c24511c4..e96d0167fd4 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -489,10 +489,10 @@ Lisp_Object Qconfig_changed_event;
489Lisp_Object Qevent_kind; 489Lisp_Object Qevent_kind;
490Lisp_Object Qevent_symbol_elements; 490Lisp_Object Qevent_symbol_elements;
491 491
492/* menu item parts */ 492/* menu and tool bar item parts */
493Lisp_Object Qmenu_enable; 493Lisp_Object Qmenu_enable;
494Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; 494Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
495Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; 495Lisp_Object QCbutton, QCtoggle, QCradio, QClabel, QCvert_only;
496 496
497/* An event header symbol HEAD may have a property named 497/* An event header symbol HEAD may have a property named
498 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS); 498 Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
@@ -8269,9 +8269,12 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8269 if (NILP (menu_item_eval_property (value))) 8269 if (NILP (menu_item_eval_property (value)))
8270 return 0; 8270 return 0;
8271 } 8271 }
8272 else if (EQ (key, QChelp)) 8272 else if (EQ (key, QChelp))
8273 /* `:help HELP-STRING'. */ 8273 /* `:help HELP-STRING'. */
8274 PROP (TOOL_BAR_ITEM_HELP) = value; 8274 PROP (TOOL_BAR_ITEM_HELP) = value;
8275 else if (EQ (key, QCvert_only))
8276 /* `:vert-only t/nil'. */
8277 PROP (TOOL_BAR_ITEM_VERT_ONLY) = value;
8275 else if (EQ (key, QClabel)) 8278 else if (EQ (key, QClabel))
8276 { 8279 {
8277 const char *bad_label = "!!?GARBLED ITEM?!!"; 8280 const char *bad_label = "!!?GARBLED ITEM?!!";
@@ -11629,6 +11632,8 @@ syms_of_keyboard (void)
11629 staticpro (&QCradio); 11632 staticpro (&QCradio);
11630 QClabel = intern_c_string (":label"); 11633 QClabel = intern_c_string (":label");
11631 staticpro (&QClabel); 11634 staticpro (&QClabel);
11635 QCvert_only = intern_c_string (":vert-only");
11636 staticpro (&QCvert_only);
11632 11637
11633 Qmode_line = intern_c_string ("mode-line"); 11638 Qmode_line = intern_c_string ("mode-line");
11634 staticpro (&Qmode_line); 11639 staticpro (&Qmode_line);