From: Robin Rosenberg <robin.rosenberg@dewire.com>
To: paulus@samba.org
Cc: git@vger.kernel.org, Robin Rosenberg <robin.rosenberg@dewire.com>
Subject: [Gitk PATCH 1/6] gitk: Add procedure to create accelerated menus
Date: Thu, 9 Oct 2008 08:09:45 +0200 [thread overview]
Message-ID: <1223532590-8706-2-git-send-email-robin.rosenberg@dewire.com> (raw)
In-Reply-To: <1223532590-8706-1-git-send-email-robin.rosenberg@dewire.com>
These are the undescores menu items that can be selected with the Alt+letter,
key combination on Windows and Linux or Command+letter on Macs.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
gitk | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/gitk b/gitk
index 2eaa2ae..050019c 100755
--- a/gitk
+++ b/gitk
@@ -1750,6 +1750,33 @@ proc setoptions {} {
option add *Entry.font uifont startupFile
}
+# Menu command wrapper. Intercepts any -label arguments,
+# removes the & and adds the -underline argument necessary
+# to implement the menu accelerator.
+proc mcw {menubar args} {
+ set ai [lsearch $args "-label"]
+ if { $ai > 0 } {
+ set label [lindex $args [expr {$ai + 1}]]
+ foreach {l u} [::tk::UnderlineAmpersand $label] {
+ lset args [expr {$ai + 1}] $l
+ }
+ lappend args -underline
+ lappend args $u
+ }
+ set cmd [ list $menubar ]
+ foreach a $args {
+ lappend cmd $a
+ }
+ eval $cmd
+}
+
+# Wrapper for mc to remove ampersands used for accelerators.
+proc mca {label} {
+ set tl8 [mc $label]
+ foreach {l u} [::tk::UnderlineAmpersand $tl8] break
+ return $l
+}
+
proc makewindow {} {
global canv canv2 canv3 linespc charspc ctext cflist cscroll
global tabstop
--
1.6.0.2.308.gef4a
next prev parent reply other threads:[~2008-10-09 6:12 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 6:09 [Gitk Patch 0/6] Robin Rosenberg
2008-10-09 6:09 ` Robin Rosenberg [this message]
2008-10-09 6:09 ` [Gitk PATCH 2/6] gitk: Change menus to use accelerated design Robin Rosenberg
2008-10-09 6:09 ` [Gitk PATCH 3/6] gitk: regenerated po files Robin Rosenberg
2008-10-09 6:09 ` [Gitk PATCH 4/6] gitk: Add accelerator hints Robin Rosenberg
2008-10-09 6:09 ` [Gitk PATCH 5/6] gitk: regenerated po files Robin Rosenberg
2008-10-09 6:09 ` [Gitk PATCH 6/6] gitk: Add menu accelerators for Swedish translation Robin Rosenberg
2008-10-11 1:40 ` [Gitk PATCH 1/6] gitk: Add procedure to create accelerated menus Paul Mackerras
2008-10-11 11:39 ` Robin Rosenberg
2008-10-11 2:44 ` [Gitk Patch 0/6] Paul Mackerras
2008-10-11 11:14 ` Robin Rosenberg
2008-10-18 12:11 ` Paul Mackerras
2008-10-19 21:19 ` [GITK PATCH] Add menu accelerators Robin Rosenberg
2008-10-19 22:00 ` [GITK PATCH v2] " Robin Rosenberg
2008-10-20 23:21 ` Paul Mackerras
-- strict thread matches above, loose matches on Subject: below --
2008-10-07 21:56 [Gitk PATCH 0/6] Menu accelerators for Gitk Robin Rosenberg
2008-10-07 21:56 ` [Gitk PATCH 1/6] gitk: Add procedure to create accelerated menus Robin Rosenberg
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=1223532590-8706-2-git-send-email-robin.rosenberg@dewire.com \
--to=robin.rosenberg@dewire.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).