summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-07-27 12:30:15 (GMT)
committerPaul Mackerras <paulus@samba.org>2007-07-27 12:30:15 (GMT)
commit3244729aac7515ccda651d40f41cef94517ac089 (patch)
tree2ce5f1356f2dc59c46a1e197a5b5af6c1072859b
parent005a2f4e6df7060561817828d4fa4245f87ccadf (diff)
downloadgit-3244729aac7515ccda651d40f41cef94517ac089.zip
git-3244729aac7515ccda651d40f41cef94517ac089.tar.gz
git-3244729aac7515ccda651d40f41cef94517ac089.tar.bz2
gitk: Add a context menu for file list entries
At the moment this just has two entries, which allow you to add the file that you clicked on to the list of filenames to highlight, or replace the list with the file. Signed-off-by: Paul Mackerras <paulus@samba.org>
-rwxr-xr-xgitk36
1 files changed, 36 insertions, 0 deletions
diff --git a/gitk b/gitk
index f74ce51..6c2be3b 100755
--- a/gitk
+++ b/gitk
@@ -879,6 +879,7 @@ proc makewindow {} {
bind $cflist <1> {sel_flist %W %x %y; break}
bind $cflist <B1-Motion> {sel_flist %W %x %y; break}
bind $cflist <ButtonRelease-1> {treeclick %W %x %y}
+ bind $cflist <Button-3> {pop_flist_menu %W %X %Y %x %y}
set maincursor [. cget -cursor]
set textcursor [$ctext cget -cursor]
@@ -916,6 +917,14 @@ proc makewindow {} {
-command cobranch
$headctxmenu add command -label "Remove this branch" \
-command rmbranch
+
+ global flist_menu
+ set flist_menu .flistctxmenu
+ menu $flist_menu -tearoff 0
+ $flist_menu add command -label "Highlight this too" \
+ -command {flist_hl 0}
+ $flist_menu add command -label "Highlight this only" \
+ -command {flist_hl 1}
}
# mouse-2 makes all windows scan vertically, but only the one
@@ -1499,6 +1508,33 @@ proc sel_flist {w x y} {
}
}
+proc pop_flist_menu {w X Y x y} {
+ global ctext cflist cmitmode flist_menu flist_menu_file
+ global treediffs diffids
+
+ set l [lindex [split [$w index "@$x,$y"] "."] 0]
+ if {$l <= 1} return
+ if {$cmitmode eq "tree"} {
+ set e [linetoelt $l]
+ if {[string index $e end] eq "/"} return
+ } else {
+ set e [lindex $treediffs($diffids) [expr {$l-2}]]
+ }
+ set flist_menu_file $e
+ tk_popup $flist_menu $X $Y
+}
+
+proc flist_hl {only} {
+ global flist_menu_file highlight_files
+
+ set x [shellquote $flist_menu_file]
+ if {$only || $highlight_files eq {}} {
+ set highlight_files $x
+ } else {
+ append highlight_files " " $x
+ }
+}
+
# Functions for adding and removing shell-type quoting
proc shellquote {str} {