diff options
| author | Jan Djärv | 2010-11-20 15:51:25 +0100 |
|---|---|---|
| committer | Jan Djärv | 2010-11-20 15:51:25 +0100 |
| commit | d2bd51898e48c2fd47a98a42654842a65feea7ad (patch) | |
| tree | 445b7d1580622915a8b4d0e2886be772640face3 /src | |
| parent | 0e7c0582af3a7ee210dfa6a1ab6c41b23bea1951 (diff) | |
| download | emacs-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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/gtkutil.c | 18 | ||||
| -rw-r--r-- | src/keyboard.c | 11 |
4 files changed, 39 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index b7c1ef2c93c..552d8efe6f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2010-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 | |||
| 1 | 2010-11-20 Eli Zaretskii <eliz@gnu.org> | 16 | 2010-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; | |||
| 489 | Lisp_Object Qevent_kind; | 489 | Lisp_Object Qevent_kind; |
| 490 | Lisp_Object Qevent_symbol_elements; | 490 | Lisp_Object Qevent_symbol_elements; |
| 491 | 491 | ||
| 492 | /* menu item parts */ | 492 | /* menu and tool bar item parts */ |
| 493 | Lisp_Object Qmenu_enable; | 493 | Lisp_Object Qmenu_enable; |
| 494 | Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; | 494 | Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence; |
| 495 | Lisp_Object QCbutton, QCtoggle, QCradio, QClabel; | 495 | Lisp_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); |