From: Alexander Gavrilov <angavrilov@gmail.com>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>
Subject: [PATCH (GITK) v3 3/6] gitk: Add accelerators to frequently used menu commands.
Date: Sun, 2 Nov 2008 21:59:46 +0300 [thread overview]
Message-ID: <1225652389-22082-4-git-send-email-angavrilov@gmail.com> (raw)
In-Reply-To: <1225652389-22082-3-git-send-email-angavrilov@gmail.com>
This commit documents keyboard accelerators used for menu
commands in the menu, as it is usually done, and adds some
more, e.g. F4 to invoke Edit View.
The changes include a workaround for handling Shift-F4 on
systems where XKB binds special XF86_Switch_VT_* symbols
to Ctrl-Alt-F* combinations. Tk often receives these codes
when Shift-F* is pressed, so it is necessary to bind the
relevant actions to them as well.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
gitk | 36 +++++++++++++++++++++++++++++-------
1 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/gitk b/gitk
index 41d3d2d..f747c70 100755
--- a/gitk
+++ b/gitk
@@ -1801,6 +1801,11 @@ proc setoptions {} {
# command to invoke for command, or {variable value} for radiobutton
proc makemenu {m items} {
menu $m
+ if {[tk windowingsystem] eq {aqua}} {
+ set M1T Cmd
+ } else {
+ set M1T Ctrl
+ }
foreach i $items {
set name [mc [lindex $i 1]]
set type [lindex $i 2]
@@ -1826,7 +1831,9 @@ proc makemenu {m items} {
-value [lindex $thing 1]
}
}
- eval $m add $params [lrange $i 4 end]
+ set tail [lrange $i 4 end]
+ regsub -all {\$M1T\y} $tail $M1T tail
+ eval $m add $params $tail
if {$type eq "cascade"} {
makemenu $m.$submenu $thing
}
@@ -1860,17 +1867,17 @@ proc makewindow {} {
makemenu .bar {
{mc "File" cascade {
{mc "Update" command updatecommits -accelerator F5}
- {mc "Reload" command reloadcommits}
+ {mc "Reload" command reloadcommits -accelerator $M1T-F5}
{mc "Reread references" command rereadrefs}
- {mc "List references" command showrefs}
- {mc "Quit" command doquit}
+ {mc "List references" command showrefs -accelerator F2}
+ {mc "Quit" command doquit -accelerator $M1T-Q}
}}
{mc "Edit" cascade {
{mc "Preferences" command doprefs}
}}
{mc "View" cascade {
- {mc "New view..." command {newview 0}}
- {mc "Edit view..." command editview -state disabled}
+ {mc "New view..." command {newview 0} -accelerator Shift-F4}
+ {mc "Edit view..." command editview -state disabled -accelerator F4}
{mc "Delete view" command delview -state disabled}
{xx "" separator}
{mc "All files" radiobutton {selectedview 0} -command {showview 0}}
@@ -2232,7 +2239,12 @@ proc makewindow {} {
bindkey <Key-Return> {dofind 1 1}
bindkey ? {dofind -1 1}
bindkey f nextfile
- bindkey <F5> updatecommits
+ bind . <F5> updatecommits
+ bind . <$M1B-F5> reloadcommits
+ bind . <F2> showrefs
+ bind . <Shift-F4> {newview 0}
+ catch { bind . <Shift-Key-XF86_Switch_VT_4> {newview 0} }
+ bind . <F4> edit_or_newview
bind . <$M1B-q> doquit
bind . <$M1B-f> {dofind 1 1}
bind . <$M1B-g> {dofind 1 0}
@@ -3483,6 +3495,16 @@ proc newview {ishighlight} {
vieweditor $top $nextviewnum [mc "Gitk view definition"]
}
+proc edit_or_newview {} {
+ global curview
+
+ if {$curview > 0} {
+ editview
+ } else {
+ newview 0
+ }
+}
+
proc editview {} {
global curview
global viewname viewperm newviewname newviewperm
--
1.6.0.3.15.gb8d36
next prev parent reply other threads:[~2008-11-02 19:03 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-02 18:59 [PATCH (GITK) v3 0/6] Enhance popup dialogs in gitk Alexander Gavrilov
2008-11-02 18:59 ` [PATCH (GITK) v3 1/6] gitk: Add Return and Escape bindings to dialogs Alexander Gavrilov
2008-11-02 18:59 ` [PATCH (GITK) v3 2/6] gitk: Make gitk dialog windows transient Alexander Gavrilov
2008-11-02 18:59 ` Alexander Gavrilov [this message]
2008-11-02 18:59 ` [PATCH (GITK) v3 4/6] gitk: Make cherry-pick call git-citool on conflicts Alexander Gavrilov
2008-11-02 18:59 ` [PATCH (GITK) v3 5/6] gitk: Implement a user-friendly Edit View dialog Alexander Gavrilov
2008-11-02 18:59 ` [PATCH (GITK) v3 6/6] gitk: Explicitly position popup windows Alexander Gavrilov
2008-11-07 11:57 ` Paul Mackerras
2008-11-07 14:39 ` Alex Riesen
2008-11-07 16:37 ` Johannes Sixt
2008-11-09 10:26 ` Alex Riesen
2008-11-09 11:12 ` Paul Mackerras
2008-11-09 14:53 ` Alexander Gavrilov
2008-11-10 11:47 ` Paul Mackerras
2008-11-10 12:15 ` Alexander Gavrilov
2008-11-11 11:00 ` Alexander Gavrilov
2008-11-07 11:51 ` [PATCH (GITK) v3 4/6] gitk: Make cherry-pick call git-citool on conflicts Paul Mackerras
2008-11-07 11:50 ` [PATCH (GITK) v3 3/6] gitk: Add accelerators to frequently used menu commands Paul Mackerras
2008-11-09 11:21 ` Alexander Gavrilov
2008-11-07 11:41 ` [PATCH (GITK) v3 2/6] gitk: Make gitk dialog windows transient Paul Mackerras
2008-11-07 11:41 ` [PATCH (GITK) v3 1/6] gitk: Add Return and Escape bindings to dialogs Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1225652389-22082-4-git-send-email-angavrilov@gmail.com \
--to=angavrilov@gmail.com \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).