Improve look-and-feel of the git-gui tool.
Made the default buttons on the dialog active and focused upon the dialog appearence. Bound 'Escape' and 'Return' keys to the dialog dismissal where it was appropriate: mainly for dialogs with only one button and no editable fields, but on console output dialogs as well. Signed-off-by: Eygene Ryabinkin <rea-git@codelabs.ru> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Eygene Ryabinkin committed
Mar 27, 2007 at 14:31 UTC
df0cd69558b826a0f43420ecc808557656961f62
1 file changed
+15
-4
git-gui.sh
+15
-4
@@ -2705,10 +2705,12 @@ proc do_push_anywhere {} {
2705
frame $w.buttons
2706
button $w.buttons.create -text Push \
2707
-font font_ui \
2708
+ -default active \
2709
-command [list start_push_anywhere_action $w]
2710
pack $w.buttons.create -side right
2711
button $w.buttons.cancel -text {Cancel} \
2712
-font font_ui \
2713
+ -default normal \
2714
-command [list destroy $w]
2715
pack $w.buttons.cancel -side right -padx 5
2716
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -2799,7 +2801,7 @@ proc do_push_anywhere {} {
2801
set push_thin 0
2802
set push_tags 0
2803
2802
- bind $w <Visibility> "grab $w"
2804
+ bind $w <Visibility> "grab $w; focus $w.buttons.create"
2805
bind $w <Key-Escape> "destroy $w"
2806
wm title $w "[appname] ([reponame]): Push"
2807
tkwait window $w
@@ -4131,6 +4133,7 @@ proc console_done {args} {
4133
if {[winfo exists $w]} {
4134
$w.m.s conf -background green -text {Success}
4135
$w.ok conf -state normal
4136
+ focus $w.ok
4137
}
4138
} else {
4139
if {![winfo exists $w]} {
@@ -4138,6 +4141,7 @@ proc console_done {args} {
4141
}
4142
$w.m.s conf -background red -text {Error: Command Failed}
4143
$w.ok conf -state normal
4144
+ focus $w.ok
4145
}
4146
4147
array unset console_cr $w
@@ -4205,9 +4209,11 @@ proc do_stats {} {
4209
frame $w.buttons -border 1
4210
button $w.buttons.close -text Close \
4211
-font font_ui \
4212
+ -default active \
4213
-command [list destroy $w]
4214
button $w.buttons.gc -text {Compress Database} \
4215
-font font_ui \
4216
+ -default normal \
4217
-command "destroy $w;do_gc"
4218
pack $w.buttons.close -side right
4219
pack $w.buttons.gc -side left
@@ -4236,7 +4242,7 @@ proc do_stats {} {
4242
}
4243
pack $w.stat -pady 10 -padx 10
4244
4239
- bind $w <Visibility> "grab $w; focus $w"
4245
+ bind $w <Visibility> "grab $w; focus $w.buttons.close"
4246
bind $w <Key-Escape> [list destroy $w]
4247
bind $w <Key-Return> [list destroy $w]
4248
wm title $w "[appname] ([reponame]): Database Statistics"
@@ -4533,6 +4539,7 @@ proc do_about {} {
4539
frame $w.buttons
4540
button $w.buttons.close -text {Close} \
4541
-font font_ui \
4542
+ -default active \
4543
-command [list destroy $w]
4544
pack $w.buttons.close -side right
4545
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -4578,8 +4585,9 @@ $copyright" \
4585
clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
4586
"
4587
4581
- bind $w <Visibility> "grab $w; focus $w"
4588
+ bind $w <Visibility> "grab $w; focus $w.buttons.close"
4589
bind $w <Key-Escape> "destroy $w"
4590
+ bind $w <Key-Return> "destroy $w"
4591
bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
4592
wm title $w "About [appname]"
4593
tkwait window $w
@@ -4616,14 +4624,17 @@ proc do_options {} {
4624
frame $w.buttons
4625
button $w.buttons.restore -text {Restore Defaults} \
4626
-font font_ui \
4627
+ -default normal \
4628
-command do_restore_defaults
4629
pack $w.buttons.restore -side left
4630
button $w.buttons.save -text Save \
4631
-font font_ui \
4632
+ -default active \
4633
-command [list do_save_config $w]
4634
pack $w.buttons.save -side right
4635
button $w.buttons.cancel -text {Cancel} \
4636
-font font_ui \
4637
+ -default normal \
4638
-command [list destroy $w]
4639
pack $w.buttons.cancel -side right -padx 5
4640
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
@@ -4726,7 +4737,7 @@ proc do_options {} {
4737
pack $w.global.$name -side top -anchor w -fill x
4738
}
4739
4729
- bind $w <Visibility> "grab $w; focus $w"
4740
+ bind $w <Visibility> "grab $w; focus $w.buttons.save"
4741
bind $w <Key-Escape> "destroy $w"
4742
wm title $w "[appname] ([reponame]): Options"
4743
tkwait window $w