* Added remove-empty-menus', same places as
reorder-menus'.
* Use it in bug-report.ss, since it currently has nothing in its help menu. svn: r3061
This commit is contained in:
parent
ebd2227be5
commit
b690f6cea1
|
@ -685,6 +685,14 @@
|
|||
"This is useful in conjunction with the "
|
||||
"frame classes. After instantiating the class and adding ones own menus,"
|
||||
"the menus will be mis-ordered. This function fixes them up.")
|
||||
|
||||
(frame:remove-empty-menus
|
||||
((is-a?/c frame%) . -> . void?)
|
||||
(frame)
|
||||
"Removes empty menus in a frame."
|
||||
""
|
||||
"This is useful if you have code that might leave empty menus.")
|
||||
|
||||
(group:get-the-frame-group
|
||||
(-> (is-a?/c group:%))
|
||||
()
|
||||
|
|
|
@ -49,13 +49,19 @@
|
|||
[help-menu (find-menu (string-constant help-menu))]
|
||||
[other-items
|
||||
(remq* (list file-menu edit-menu windows-menu help-menu) items)]
|
||||
[? (λ (menu) (and menu (pair? (send menu get-items)) menu))]
|
||||
[re-ordered (filter values `(,(? file-menu) ,(? edit-menu)
|
||||
[re-ordered (filter values `(,file-menu ,edit-menu
|
||||
,@other-items
|
||||
,(? windows-menu) ,(? help-menu)))])
|
||||
,windows-menu ,help-menu))])
|
||||
(for-each (λ (item) (send item delete)) items)
|
||||
(for-each (λ (item) (send item restore)) re-ordered)))
|
||||
|
||||
(define (remove-empty-menus frame)
|
||||
(define menus (send (send frame get-menu-bar) get-items))
|
||||
(for-each (λ (menu) (send menu delete)) menus)
|
||||
(for-each (λ (menu)
|
||||
(when (pair? (send menu get-items)) (send menu restore)))
|
||||
menus))
|
||||
|
||||
(define (add-snip-menu-items edit-menu c%)
|
||||
(let* ([get-edit-target-object
|
||||
(λ ()
|
||||
|
|
|
@ -417,6 +417,7 @@
|
|||
pasteboard-info-mixin))
|
||||
(define-signature framework:frame-fun^
|
||||
(reorder-menus
|
||||
remove-empty-menus
|
||||
add-snip-menu-items
|
||||
setup-size-pref))
|
||||
(define-signature framework:frame^
|
||||
|
|
|
@ -506,6 +506,9 @@
|
|||
(send (send collections get-editor) auto-wrap #t)
|
||||
(send (send docs-installed get-editor) auto-wrap #t)
|
||||
|
||||
;; Currently, the help-menu is left empty
|
||||
(frame:remove-empty-menus bug-frame)
|
||||
|
||||
(align-labels)
|
||||
(switch-to-compose-view)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user