Be wary that the default-shortcut-prefix might be

duplicated in a menu item prefix
This commit is contained in:
Robby Findler 2013-12-27 17:33:24 -06:00
parent ec75e9ae08
commit c12a6bea0e
2 changed files with 41 additions and 21 deletions

View File

@ -687,14 +687,15 @@
(send item enable (and frame (> (length (send frame get-tabs)) 1)))))])
(group:add-to-windows-menu
(λ (windows-menu)
(define shortcut? (not (equal? 'shift (get-default-shortcut-prefix))))
(define sprefix (if (eq? (system-type) 'windows)
(cons 'shift (get-default-shortcut-prefix))
(get-default-shortcut-prefix)))
(new menu-item%
[parent windows-menu]
[label (string-constant prev-tab)]
[shortcut #\[]
[shortcut-prefix sprefix]
[shortcut (and shortcut? #\[)]
[shortcut-prefix (if shortcut? sprefix (get-default-shortcut-prefix))]
[demand-callback dc]
[callback (λ (item _)
(let ([frame (find-frame item)])
@ -711,18 +712,21 @@
(when frame
(send frame next-tab))))])
(define mprefix (case (system-type)
[(windows unix)
(list* 'alt 'shift (get-default-shortcut-prefix))]
[(macosx)
(list* 'option (get-default-shortcut-prefix))]))
(define-values (mprefix use-shortcut?)
(case (system-type)
[(windows unix)
(if (equal? (get-default-shortcut-prefix) 'ctl)
(values (list* 'alt 'shift (get-default-shortcut-prefix)) #f)
(values (get-default-shortcut-prefix) #t))]
[(macosx)
(values (cons 'option (get-default-shortcut-prefix)) #t)]))
(new menu-item%
[parent windows-menu]
[label (string-constant move-current-tab-right)]
[demand-callback dc]
[shortcut-prefix mprefix]
[shortcut #\]]
[shortcut-prefix mprefix]
[shortcut (and use-shortcut? #\])]
[callback (λ (item _)
(let ([frame (find-frame item)])
(when frame
@ -732,8 +736,8 @@
[parent windows-menu]
[label (string-constant move-current-tab-left)]
[demand-callback dc]
[shortcut-prefix mprefix]
[shortcut #\[]
[shortcut-prefix mprefix]
[shortcut (and shortcut? #\[)]
[callback (λ (item _)
(let ([frame (find-frame item)])
(when frame

View File

@ -3370,8 +3370,12 @@
(λ (mi) (send mi set-label (if (send resizable-panel get-vertical?)
(string-constant use-horizontal-layout)
(string-constant use-vertical-layout))))]
[shortcut #\l]
[shortcut-prefix (cons 'shift (get-default-shortcut-prefix))])])
[shortcut (if (member 'shift (get-default-shortcut-prefix))
#f
#\l)]
[shortcut-prefix (if (member 'shift (get-default-shortcut-prefix))
(get-default-shortcut-prefix)
(cons 'shift (get-default-shortcut-prefix)))])])
(set-show-menu-sort-key layout-item 103))
(let ([overview-menu-item
@ -3514,10 +3518,16 @@
(demand-callback (λ (item) (split-demand item))))]
[collapse
(new menu:can-restore-menu-item%
(shortcut (if (eq? (system-type) 'macosx) #f #\m))
(shortcut-prefix (if (eq? (system-type) 'macosx)
(get-default-shortcut-prefix)
(cons 'shift (get-default-shortcut-prefix))))
(shortcut (if (or (equal? (system-type) 'macosx)
(member 'shift (get-default-shortcut-prefix)))
#f
#\m))
(shortcut-prefix (cond
[(or (equal? (system-type) 'macosx)
(member 'shift (get-default-shortcut-prefix)))
(get-default-shortcut-prefix)]
[else
(cons 'shift (get-default-shortcut-prefix))]))
(label (string-constant collapse-menu-item-label))
(parent (get-show-menu))
(callback (λ (x y) (collapse)))
@ -3758,8 +3768,10 @@
(lambda (file-menu)
(new menu:can-restore-menu-item%
[label (string-constant open-collection-path)]
[shortcut #\o]
[shortcut-prefix (cons 'shift (get-default-shortcut-prefix))]
[shortcut (if (member 'shift (get-default-shortcut-prefix)) #f #\o)]
[shortcut-prefix (if (member 'shift (get-default-shortcut-prefix))
(get-default-shortcut-prefix)
(cons 'shift (get-default-shortcut-prefix)))]
[parent file-menu]
[callback
(λ (x y)
@ -3862,8 +3874,12 @@
label)
(new menu:can-restore-checkable-menu-item%
[label label]
[shortcut shortcut]
[shortcut-prefix (cons 'shift (get-default-shortcut-prefix))]
[shortcut (if (member 'shift (get-default-shortcut-prefix))
#f
shortcut)]
[shortcut-prefix (if (member 'shift (get-default-shortcut-prefix))
(get-default-shortcut-prefix)
(cons 'shift (get-default-shortcut-prefix)))]
[parent edit-menu]
[demand-callback
(λ (item)