* 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 "
|
"This is useful in conjunction with the "
|
||||||
"frame classes. After instantiating the class and adding ones own menus,"
|
"frame classes. After instantiating the class and adding ones own menus,"
|
||||||
"the menus will be mis-ordered. This function fixes them up.")
|
"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
|
(group:get-the-frame-group
|
||||||
(-> (is-a?/c group:%))
|
(-> (is-a?/c group:%))
|
||||||
()
|
()
|
||||||
|
|
|
@ -49,13 +49,19 @@
|
||||||
[help-menu (find-menu (string-constant help-menu))]
|
[help-menu (find-menu (string-constant help-menu))]
|
||||||
[other-items
|
[other-items
|
||||||
(remq* (list file-menu edit-menu windows-menu help-menu) 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
|
,@other-items
|
||||||
,(? windows-menu) ,(? help-menu)))])
|
,windows-menu ,help-menu))])
|
||||||
(for-each (λ (item) (send item delete)) items)
|
(for-each (λ (item) (send item delete)) items)
|
||||||
(for-each (λ (item) (send item restore)) re-ordered)))
|
(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%)
|
(define (add-snip-menu-items edit-menu c%)
|
||||||
(let* ([get-edit-target-object
|
(let* ([get-edit-target-object
|
||||||
(λ ()
|
(λ ()
|
||||||
|
|
|
@ -417,6 +417,7 @@
|
||||||
pasteboard-info-mixin))
|
pasteboard-info-mixin))
|
||||||
(define-signature framework:frame-fun^
|
(define-signature framework:frame-fun^
|
||||||
(reorder-menus
|
(reorder-menus
|
||||||
|
remove-empty-menus
|
||||||
add-snip-menu-items
|
add-snip-menu-items
|
||||||
setup-size-pref))
|
setup-size-pref))
|
||||||
(define-signature framework:frame^
|
(define-signature framework:frame^
|
||||||
|
|
|
@ -506,6 +506,9 @@
|
||||||
(send (send collections get-editor) auto-wrap #t)
|
(send (send collections get-editor) auto-wrap #t)
|
||||||
(send (send docs-installed 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)
|
(align-labels)
|
||||||
(switch-to-compose-view)
|
(switch-to-compose-view)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user