added keyboard shortcuts for the first 9 tabs to the windows menu (on the mac)

svn: r18245
This commit is contained in:
Robby Findler 2010-02-21 02:06:57 +00:00
parent 5ad04e3b2c
commit 95debe6353
4 changed files with 32 additions and 6 deletions

View File

@ -561,6 +561,17 @@
(let ([frame (find-frame item)])
(when frame
(send frame next-tab))))])
(let ([frame (find-frame windows-menu)])
(unless (= 1 (send frame get-tab-count))
(for ([i (in-range 0 (send frame get-tab-count))]
#:when (< i 9))
(new menu-item%
[parent windows-menu]
[label (format "Tab ~a: ~a" (+ i 1) (send frame get-tab-filename i))]
[shortcut (integer->char (+ (char->integer #\1) i))]
[callback
(λ (a b)
(send frame change-to-nth-tab i))]))))
(new separator-menu-item% [parent windows-menu]))))
;; Check for any files lost last time.

View File

@ -2080,6 +2080,9 @@ module browser threading seems wrong.
(unless (equal? label (send tabs-panel get-item-label (send tab get-i)))
(send tabs-panel set-item-label (send tab get-i) label))))
(define/public (get-tab-filename i)
(get-defs-tab-filename (send (list-ref tabs i) get-defs)))
(define/private (get-defs-tab-label defs tab)
(let ([fn (send defs get-filename)]
[i-prefix (or (for/or ([i (in-list tabs)]
@ -2090,11 +2093,13 @@ module browser threading seems wrong.
"")])
(string-append
i-prefix
(add-modified-flag
defs
(if fn
(get-tab-label-from-filename fn)
(send defs get-filename/untitled-name))))))
(get-defs-tab-filename defs))))
(define/private (get-defs-tab-filename defs)
(let ([fn (send defs get-filename)])
(if fn
(get-tab-label-from-filename fn)
(send defs get-filename/untitled-name))))
(define/private (get-tab-label-from-filename fn)
(let* ([take-n

View File

@ -574,7 +574,16 @@ Shows the interactions window
Returns the currently active tab.
}
@defmethod[(get-tab-filename [i (<=/c 0 (#,(method drscheme:unit:frame% get-tab-count)))]) string?]{
Returns a string naming the file in the @scheme[i]th tab or, if
the file is not saved, something like ``Untitled''.
}
@defmethod[(get-tab-count) exact-positive-integer?]{
Returns the number of open tabs in the frame.
}
@defmethod[(open-in-new-tab [filename (or/c path-string? #f)]) void?]{
Opens a new tab in this frame. If @scheme[filename] is a @scheme[path-string?],
It loads that file in the definitions window of the new tab.

View File

@ -730,6 +730,7 @@ please adhere to these guidelines:
(most-recent-window "Most Recent Window")
(next-tab "Next Tab")
(prev-tab "Previous Tab")
(tab-i "Tab ~a") ;; menu item in the windows menu under mac os x. ~a is filled with a number between 1 and 9.
(view-menu-label "&View")
(show-overview "Show &Program Contour")