Mercurial > emacs
comparison lisp/menu-bar.el @ 109581:06384b3caebf
Add ability to put Gtk+ tool bar on the left/right/bottom or top. Default top.
* lisp/menu-bar.el (menu-bar-showhide-tool-bar-menu-customize-enable-left)
(menu-bar-showhide-tool-bar-menu-customize-disable)
(menu-bar-showhide-tool-bar-menu-customize-enable-right)
(menu-bar-showhide-tool-bar-menu-customize-enable-top)
(menu-bar-showhide-tool-bar-menu-customize-enable-bottom): New functions
(menu-bar-showhide-tool-bar-menu): If tool bar is moveable,
make a menu for Options => toolbar that can move it.
* src/frame.c (Qtool_bar_position): New variable.
(make_frame): Set tool_bar_position to Qtop.
(frame_parms): Add tool-bar-position.
(x_report_frame_params): Store tool_bar_position.
(x_set_fringe_width): Reset wm size hint after fringe changes.
* src/frame.h (struct frame): Add tool_bar_position.
(Qbottom): Declare.
* src/gtkutil.c (FRAME_TOTAL_PIXEL_WIDTH): New macro.
(xg_frame_set_char_size): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
(xg_height_or_width_changed): Use FRAME_TOTAL_PIXEL_WIDTH.
(xg_create_frame_widgets): Create a hobox for placing widgets
vertically. Use gtk_box_pack_start.
(xg_height_or_width_changed): Renamed from xg_height_changed.
(x_wm_set_size_hint): Add FRAME_TOOLBAR_WIDTH to base_width.
(xg_update_frame_menubar, free_frame_menubar): Change to
xg_height_or_width_changed.
(xg_tool_bar_detach_callback): Update left/right/top/bottom tool bar
size correctly. Remove hardcoded 4, instead use handlebox size -
toolbar size.
(xg_tool_bar_attach_callback): Update left/right/top/bottom tool bar
size correctly. Use handlebox size + toolbar size as additional
size.
(xg_pack_tool_bar): POS is a new parameter.
Set orientation of tool bar based on pos.
Only make handlebox_widget if NULL.
Check if tool bar goes to vbox or hbox depending on pos.
(xg_update_tool_bar_sizes): New function.
(update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar
height, call xg_update_tool_bar_sizes instead.
(free_frame_tool_bar): Remove from hbox or vbox depending on
toolbar_in_hbox, Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero.
(xg_change_toolbar_position): New function.
* src/gtkutil.h (xg_change_toolbar_position): Declare.
* src/window.c (calc_absolute_offset): Check for FRAME_TOOLBAR_TOP_HEIGHT
and FRAME_TOOLBAR_LEFT_WIDTH.
* src/xfns.c (x_set_tool_bar_position): New function.
(xic_set_statusarea): Use FRAME_TOOLBAR_TOP_HEIGHT.
(x_frame_parm_handlers): Add x_set_tool_bar_position.
(syms_of_xfns): if USE_GTK, provide move-toolbar.
* src/xterm.c (x_set_window_size_1): Add FRAME_TOOLBAR_WIDTH to pixelwidth.
* src/xterm.h (struct x_output): Add toolbar_top_height,
toolbar_bottom_height, toolbar_left_width, toolbar_right_width. Remove
toolbar_height.
if USE_GTK: Add hbox_widget and toolbar_in_hbox.
(FRAME_TOOLBAR_TOP_HEIGHT, FRAME_TOOLBAR_BOTTOM_HEIGHT)
(FRAME_TOOLBAR_LEFT_WIDTH, FRAME_TOOLBAR_RIGHT_WIDTH): New macros.
(FRAME_TOOLBAR_HEIGHT): Is now TOP_HEIGHT + BOTTOM_HEIGHT.
author | Jan D. <jan.h.d@swipnet.se> |
---|---|
date | Thu, 29 Jul 2010 18:49:59 +0200 |
parents | c9970d4bfd62 |
children | 3c2274d0da65 |
comparison
equal
deleted
inserted
replaced
109580:3021343b766a | 109581:06384b3caebf |
---|---|
966 (define-key menu-bar-showhide-menu [menu-bar-mode] | 966 (define-key menu-bar-showhide-menu [menu-bar-mode] |
967 `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame | 967 `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame |
968 :help ,(purecopy "Turn menu-bar on/off") | 968 :help ,(purecopy "Turn menu-bar on/off") |
969 :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0)))) | 969 :button (:toggle . (> (frame-parameter nil 'menu-bar-lines) 0)))) |
970 | 970 |
971 (define-key menu-bar-showhide-menu [showhide-tool-bar] | 971 (defun menu-bar-showhide-tool-bar-menu-customize-disable () |
972 `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame | 972 "Do not display tool bars." |
973 :help ,(purecopy "Turn tool-bar on/off") | 973 (interactive) |
974 :visible (display-graphic-p) | 974 (customize-set-variable 'tool-bar-mode nil)) |
975 :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0)))) | 975 (defun menu-bar-showhide-tool-bar-menu-customize-enable-left () |
976 "Display tool bars on the left side." | |
977 (interactive) | |
978 (customize-set-variable 'tool-bar-mode t) | |
979 (set-frame-parameter nil 'tool-bar-position 'left)) | |
980 | |
981 (defun menu-bar-showhide-tool-bar-menu-customize-enable-right () | |
982 "Display tool bars on the right side." | |
983 (interactive) | |
984 (customize-set-variable 'tool-bar-mode t) | |
985 (set-frame-parameter nil 'tool-bar-position 'right)) | |
986 (defun menu-bar-showhide-tool-bar-menu-customize-enable-top () | |
987 "Display tool bars on the top side." | |
988 (interactive) | |
989 (customize-set-variable 'tool-bar-mode t) | |
990 (set-frame-parameter nil 'tool-bar-position 'top)) | |
991 (defun menu-bar-showhide-tool-bar-menu-customize-enable-bottom () | |
992 "Display tool bars on the bottom side." | |
993 (interactive) | |
994 (customize-set-variable 'tool-bar-mode t) | |
995 (set-frame-parameter nil 'tool-bar-position 'bottom)) | |
996 | |
997 (if (featurep 'move-toolbar) | |
998 (progn | |
999 (defvar menu-bar-showhide-tool-bar-menu (make-sparse-keymap "Tool-bar")) | |
1000 | |
1001 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-left] | |
1002 `(menu-item ,(purecopy "On the left") | |
1003 menu-bar-showhide-tool-bar-menu-customize-enable-left | |
1004 :help ,(purecopy "Tool-bar at the left side") | |
1005 :visible (display-graphic-p) | |
1006 :button | |
1007 (:radio . (and tool-bar-mode | |
1008 (eq (frame-parameter nil 'tool-bar-position) | |
1009 'left))))) | |
1010 | |
1011 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-right] | |
1012 `(menu-item ,(purecopy "On the right") | |
1013 menu-bar-showhide-tool-bar-menu-customize-enable-right | |
1014 :help ,(purecopy "Tool-bar at the right side") | |
1015 :visible (display-graphic-p) | |
1016 :button | |
1017 (:radio . (and tool-bar-mode | |
1018 (eq (frame-parameter nil 'tool-bar-position) | |
1019 'right))))) | |
1020 | |
1021 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-bottom] | |
1022 `(menu-item ,(purecopy "On the bottom") | |
1023 menu-bar-showhide-tool-bar-menu-customize-enable-bottom | |
1024 :help ,(purecopy "Tool-bar at the bottom") | |
1025 :visible (display-graphic-p) | |
1026 :button | |
1027 (:radio . (and tool-bar-mode | |
1028 (eq (frame-parameter nil 'tool-bar-position) | |
1029 'bottom))))) | |
1030 | |
1031 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-top] | |
1032 `(menu-item ,(purecopy "On the top") | |
1033 menu-bar-showhide-tool-bar-menu-customize-enable-top | |
1034 :help ,(purecopy "Tool-bar at the top") | |
1035 :visible (display-graphic-p) | |
1036 :button | |
1037 (:radio . (and tool-bar-mode | |
1038 (eq (frame-parameter nil 'tool-bar-position) | |
1039 'top))))) | |
1040 | |
1041 (define-key menu-bar-showhide-tool-bar-menu [showhide-tool-bar-none] | |
1042 `(menu-item ,(purecopy "None") | |
1043 menu-bar-showhide-tool-bar-menu-customize-disable | |
1044 :help ,(purecopy "Turn tool-bar off") | |
1045 :visible (display-graphic-p) | |
1046 :button (:radio . (eq tool-bar-mode nil)))) | |
1047 | |
1048 (define-key menu-bar-showhide-menu [showhide-tool-bar] | |
1049 `(menu-item ,(purecopy "Tool-bar") ,menu-bar-showhide-tool-bar-menu | |
1050 :visible (display-graphic-p))) | |
1051 | |
1052 ) | |
1053 ;; else not tool bar that can move. | |
1054 (define-key menu-bar-showhide-menu [showhide-tool-bar] | |
1055 `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame | |
1056 :help ,(purecopy "Turn tool-bar on/off") | |
1057 :visible (display-graphic-p) | |
1058 :button (:toggle . (> (frame-parameter nil 'tool-bar-lines) 0)))) | |
1059 ) | |
976 | 1060 |
977 (define-key menu-bar-options-menu [showhide] | 1061 (define-key menu-bar-options-menu [showhide] |
978 `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu)) | 1062 `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu)) |
979 | 1063 |
980 (define-key menu-bar-options-menu [showhide-separator] | 1064 (define-key menu-bar-options-menu [showhide-separator] |