Commit 08f00c01 authored by Stephen Berman's avatar Stephen Berman

Fix and improve UI of scroll bar menu (bug#27047)

In addition, since the Emacs manual writes "scroll bar", "tool
bar" and "menu bar", use this convention in the Show/Hide menues
and tooltips as well.

* lisp/menu-bar.el (menu-bar-showhide-scroll-bar-menu): Make
pressing a radio button in the menu actually show that it was
pressed.  Replace the two radio buttons to turn the horizontal
scroll bar on and off with a single check-box toggle and add a
separator between this and the vertical scroll bar radio
buttons.  Use conventional spelling.
(menu-bar-horizontal-scroll-bar)
(menu-bar-no-horizontal-scroll-bar): Remove, since now unused.
(menu-bar-showhide-tool-bar-menu, menu-bar-showhide-menu)
(menu-bar-mode): Use conventional spelling.
parent bba99172
......@@ -970,54 +970,40 @@ The selected font will be the default on both the existing and future frames."
(interactive)
(customize-set-variable 'scroll-bar-mode nil))
(defun menu-bar-horizontal-scroll-bar ()
"Display horizontal scroll bars on each window."
(interactive)
(customize-set-variable 'horizontal-scroll-bar-mode t))
(defun menu-bar-no-horizontal-scroll-bar ()
"Turn off horizontal scroll bars."
(interactive)
(customize-set-variable 'horizontal-scroll-bar-mode nil))
(defvar menu-bar-showhide-scroll-bar-menu
(let ((menu (make-sparse-keymap "Scroll-bar"))
(vsb (frame-parameter nil 'vertical-scroll-bars))
(hsb (frame-parameter nil 'horizontal-scroll-bars)))
(let ((menu (make-sparse-keymap "Scroll Bar")))
(bindings--define-key menu [horizontal]
`(menu-item "Horizontal"
menu-bar-horizontal-scroll-bar
:help "Horizontal scroll bar"
:visible (horizontal-scroll-bars-available-p)
:button (:radio . ,hsb)))
(bindings--define-key menu [none-horizontal]
`(menu-item "None-horizontal"
menu-bar-no-horizontal-scroll-bar
:help "Turn off horizontal scroll bars"
:visible (horizontal-scroll-bars-available-p)
:button (:radio . (not ,hsb))))
(menu-bar-make-mm-toggle horizontal-scroll-bar-mode
"Horizontal"
"Horizontal scroll bar"))
(bindings--define-key menu [scrollbar-separator]
menu-bar-separator)
(bindings--define-key menu [right]
`(menu-item "On the Right"
menu-bar-right-scroll-bar
:help "Scroll-bar on the right side"
'(menu-item "On the Right" menu-bar-right-scroll-bar
:help "Scroll bar on the right side"
:visible (display-graphic-p)
:button (:radio . (eq ,vsb 'right))))
:button (:radio . (and scroll-bar-mode
(eq (frame-parameter
nil 'vertical-scroll-bars)
'right)))))
(bindings--define-key menu [left]
`(menu-item "On the Left"
menu-bar-left-scroll-bar
:help "Scroll-bar on the left side"
'(menu-item "On the Left" menu-bar-left-scroll-bar
:help "Scroll bar on the left side"
:visible (display-graphic-p)
:button (:radio . (eq ,vsb 'left))))
:button (:radio . (and scroll-bar-mode
(eq (frame-parameter
nil 'vertical-scroll-bars)
'left)))))
(bindings--define-key menu [none]
`(menu-item "None"
menu-bar-no-scroll-bar
:help "Turn off scroll-bar"
'(menu-item "No Vertical Scroll Bar" menu-bar-no-scroll-bar
:help "Turn off vertical scroll bar"
:visible (display-graphic-p)
:button (:radio . (not ,vsb))))
:button (:radio . (eq scroll-bar-mode nil))))
menu))
(defun menu-bar-frame-for-menubar ()
......@@ -1057,24 +1043,24 @@ The selected font will be the default on both the existing and future frames."
(when (featurep 'move-toolbar)
(defvar menu-bar-showhide-tool-bar-menu
(let ((menu (make-sparse-keymap "Tool-bar")))
(let ((menu (make-sparse-keymap "Tool Bar")))
(bindings--define-key menu [showhide-tool-bar-left]
'(menu-item "On the Left"
menu-bar-showhide-tool-bar-menu-customize-enable-left
:help "Tool-bar at the left side"
:help "Tool bar at the left side"
:visible (display-graphic-p)
:button
(:radio . (and tool-bar-mode
(eq (frame-parameter
(frame-parameter
(menu-bar-frame-for-menubar)
'tool-bar-position)
'left)))))
'left))))
(bindings--define-key menu [showhide-tool-bar-right]
'(menu-item "On the Right"
menu-bar-showhide-tool-bar-menu-customize-enable-right
:help "Tool-bar at the right side"
:help "Tool bar at the right side"
:visible (display-graphic-p)
:button
(:radio . (and tool-bar-mode
......@@ -1086,7 +1072,7 @@ The selected font will be the default on both the existing and future frames."
(bindings--define-key menu [showhide-tool-bar-bottom]
'(menu-item "On the Bottom"
menu-bar-showhide-tool-bar-menu-customize-enable-bottom
:help "Tool-bar at the bottom"
:help "Tool bar at the bottom"
:visible (display-graphic-p)
:button
(:radio . (and tool-bar-mode
......@@ -1098,7 +1084,7 @@ The selected font will be the default on both the existing and future frames."
(bindings--define-key menu [showhide-tool-bar-top]
'(menu-item "On the Top"
menu-bar-showhide-tool-bar-menu-customize-enable-top
:help "Tool-bar at the top"
:help "Tool bar at the top"
:visible (display-graphic-p)
:button
(:radio . (and tool-bar-mode
......@@ -1110,7 +1096,7 @@ The selected font will be the default on both the existing and future frames."
(bindings--define-key menu [showhide-tool-bar-none]
'(menu-item "None"
menu-bar-showhide-tool-bar-menu-customize-disable
:help "Turn tool-bar off"
:help "Turn tool bar off"
:visible (display-graphic-p)
:button (:radio . (eq tool-bar-mode nil))))
menu)))
......@@ -1168,7 +1154,7 @@ mail status in mode line"))
:visible (display-graphic-p)))
(bindings--define-key menu [showhide-scroll-bar]
`(menu-item "Scroll-bar" ,menu-bar-showhide-scroll-bar-menu
`(menu-item "Scroll Bar" ,menu-bar-showhide-scroll-bar-menu
:visible (display-graphic-p)))
(bindings--define-key menu [showhide-tooltip-mode]
......@@ -1178,8 +1164,8 @@ mail status in mode line"))
:button (:toggle . tooltip-mode)))
(bindings--define-key menu [menu-bar-mode]
'(menu-item "Menu-bar" toggle-menu-bar-mode-from-frame
:help "Turn menu-bar on/off"
'(menu-item "Menu Bar" toggle-menu-bar-mode-from-frame
:help "Turn menu bar on/off"
:button
(:toggle . (menu-bar-positive-p
(frame-parameter (menu-bar-frame-for-menubar)
......@@ -1188,12 +1174,12 @@ mail status in mode line"))
(if (and (boundp 'menu-bar-showhide-tool-bar-menu)
(keymapp menu-bar-showhide-tool-bar-menu))
(bindings--define-key menu [showhide-tool-bar]
`(menu-item "Tool-bar" ,menu-bar-showhide-tool-bar-menu
`(menu-item "Tool Bar" ,menu-bar-showhide-tool-bar-menu
:visible (display-graphic-p)))
;; else not tool bar that can move.
(bindings--define-key menu [showhide-tool-bar]
'(menu-item "Tool-bar" toggle-tool-bar-mode-from-frame
:help "Turn tool-bar on/off"
'(menu-item "Tool Bar" toggle-tool-bar-mode-from-frame
:help "Turn tool bar on/off"
:visible (display-graphic-p)
:button
(:toggle . (menu-bar-positive-p
......@@ -2268,11 +2254,11 @@ created in the future."
(assq-delete-all 'menu-bar-lines
default-frame-alist)))))
;; Make the message appear when Emacs is idle. We can not call message
;; directly. The minor-mode message "Menu-bar mode disabled" comes
;; directly. The minor-mode message "Menu Bar mode disabled" comes
;; after this function returns, overwriting any message we do here.
(when (and (called-interactively-p 'interactive) (not menu-bar-mode))
(run-with-idle-timer 0 nil 'message
"Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")))
"Menu Bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")))
;;;###autoload
;; (This does not work right unless it comes after the above definition.)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment