Skip to content

Commit e51b17e

Browse files
committed
Merge branch 'ml/abandon-old-version'
* ml/abandon-old-version: gitk: restore ui colors after cancelling config dialog gitk: set config dialog color swatches in one place Signed-off-by: Johannes Sixt <[email protected]>
2 parents cb5607e + fdaba07 commit e51b17e

File tree

1 file changed

+48
-25
lines changed

1 file changed

+48
-25
lines changed

gitk

Lines changed: 48 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11720,57 +11720,63 @@ proc prefspage_colors {notebook} {
1172011720
grid $page.cdisp - -sticky w -pady 10
1172111721
label $page.ui -padx 40 -relief sunk -background $uicolor
1172211722
ttk::button $page.uibut -text [mc "Interface"] \
11723-
-command [list choosecolor uicolor {} $page.ui [mc "interface"] setui]
11723+
-command [list choosecolor uicolor {} $page [mc "interface"]]
1172411724
grid x $page.uibut $page.ui -sticky w
1172511725
label $page.bg -padx 40 -relief sunk -background $bgcolor
1172611726
ttk::button $page.bgbut -text [mc "Background"] \
11727-
-command [list choosecolor bgcolor {} $page.bg [mc "background"] setbg]
11727+
-command [list choosecolor bgcolor {} $page [mc "background"]]
1172811728
grid x $page.bgbut $page.bg -sticky w
1172911729
label $page.fg -padx 40 -relief sunk -background $fgcolor
1173011730
ttk::button $page.fgbut -text [mc "Foreground"] \
11731-
-command [list choosecolor fgcolor {} $page.fg [mc "foreground"] setfg]
11731+
-command [list choosecolor fgcolor {} $page [mc "foreground"]]
1173211732
grid x $page.fgbut $page.fg -sticky w
1173311733
label $page.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]
1173411734
ttk::button $page.diffoldbut -text [mc "Diff: old lines"] \
11735-
-command [list choosecolor diffcolors 0 $page.diffold [mc "diff old lines"] \
11736-
[list $ctext tag conf d0 -foreground]]
11735+
-command [list choosecolor diffcolors 0 $page [mc "diff old lines"]]
1173711736
grid x $page.diffoldbut $page.diffold -sticky w
1173811737
label $page.diffoldbg -padx 40 -relief sunk -background [lindex $diffbgcolors 0]
1173911738
ttk::button $page.diffoldbgbut -text [mc "Diff: old lines bg"] \
11740-
-command [list choosecolor diffbgcolors 0 $page.diffoldbg \
11741-
[mc "diff old lines bg"] \
11742-
[list $ctext tag conf d0 -background]]
11739+
-command [list choosecolor diffbgcolors 0 $page [mc "diff old lines bg"]]
1174311740
grid x $page.diffoldbgbut $page.diffoldbg -sticky w
1174411741
label $page.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]
1174511742
ttk::button $page.diffnewbut -text [mc "Diff: new lines"] \
11746-
-command [list choosecolor diffcolors 1 $page.diffnew [mc "diff new lines"] \
11747-
[list $ctext tag conf dresult -foreground]]
11743+
-command [list choosecolor diffcolors 1 $page [mc "diff new lines"]]
1174811744
grid x $page.diffnewbut $page.diffnew -sticky w
1174911745
label $page.diffnewbg -padx 40 -relief sunk -background [lindex $diffbgcolors 1]
1175011746
ttk::button $page.diffnewbgbut -text [mc "Diff: new lines bg"] \
11751-
-command [list choosecolor diffbgcolors 1 $page.diffnewbg \
11752-
[mc "diff new lines bg"] \
11753-
[list $ctext tag conf dresult -background]]
11747+
-command [list choosecolor diffbgcolors 1 $page [mc "diff new lines bg"]]
1175411748
grid x $page.diffnewbgbut $page.diffnewbg -sticky w
1175511749
label $page.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]
1175611750
ttk::button $page.hunksepbut -text [mc "Diff: hunk header"] \
11757-
-command [list choosecolor diffcolors 2 $page.hunksep \
11758-
[mc "diff hunk header"] \
11759-
[list $ctext tag conf hunksep -foreground]]
11751+
-command [list choosecolor diffcolors 2 $page [mc "diff hunk header"]]
1176011752
grid x $page.hunksepbut $page.hunksep -sticky w
1176111753
label $page.markbgsep -padx 40 -relief sunk -background $markbgcolor
1176211754
ttk::button $page.markbgbut -text [mc "Marked line bg"] \
11763-
-command [list choosecolor markbgcolor {} $page.markbgsep \
11764-
[mc "marked line background"] \
11765-
[list $ctext tag conf omark -background]]
11755+
-command [list choosecolor markbgcolor {} $page [mc "marked line background"]]
1176611756
grid x $page.markbgbut $page.markbgsep -sticky w
1176711757
label $page.selbgsep -padx 40 -relief sunk -background $selectbgcolor
1176811758
ttk::button $page.selbgbut -text [mc "Select bg"] \
11769-
-command [list choosecolor selectbgcolor {} $page.selbgsep [mc "background"] setselbg]
11759+
-command [list choosecolor selectbgcolor {} $page [mc "background"]]
1177011760
grid x $page.selbgbut $page.selbgsep -sticky w
1177111761
return $page
1177211762
}
1177311763
11764+
proc prefspage_set_colorswatches {page} {
11765+
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
11766+
global diffbgcolors
11767+
11768+
$page.ui configure -background $uicolor
11769+
$page.bg configure -background $bgcolor
11770+
$page.fg configure -background $fgcolor
11771+
$page.diffold configure -background [lindex $diffcolors 0]
11772+
$page.diffoldbg configure -background [lindex $diffbgcolors 0]
11773+
$page.diffnew configure -background [lindex $diffcolors 1]
11774+
$page.diffnewbg configure -background [lindex $diffbgcolors 1]
11775+
$page.hunksep configure -background [lindex $diffcolors 2]
11776+
$page.markbgsep configure -background $markbgcolor
11777+
$page.selbgsep configure -background $selectbgcolor
11778+
}
11779+
1177411780
proc prefspage_fonts {notebook} {
1177511781
set page [create_prefs_page $notebook.fonts]
1177611782
ttk::label $page.cfont -text [mc "Fonts: press to choose"] -font mainfontbold
@@ -11838,15 +11844,15 @@ proc choose_extdiff {} {
1183811844
}
1183911845
}
1184011846
11841-
proc choosecolor {v vi w x cmd} {
11847+
proc choosecolor {v vi prefspage x} {
1184211848
global $v
1184311849
1184411850
set c [tk_chooseColor -initialcolor [lindex [set $v] $vi] \
1184511851
-title [mc "Gitk: choose color for %s" $x]]
1184611852
if {$c eq {}} return
11847-
$w conf -background $c
1184811853
lset $v $vi $c
11849-
eval $cmd $c
11854+
set_gui_colors
11855+
prefspage_set_colorswatches $prefspage
1185011856
}
1185111857
1185211858
proc setselbg {c} {
@@ -11899,6 +11905,22 @@ proc setfg {c} {
1189911905
$canv itemconf markid -outline $c
1190011906
}
1190111907
11908+
proc set_gui_colors {} {
11909+
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
11910+
global diffbgcolors
11911+
11912+
setui $uicolor
11913+
setbg $bgcolor
11914+
setfg $fgcolor
11915+
$ctext tag conf d0 -foreground [lindex $diffcolors 0]
11916+
$ctext tag conf d0 -background [lindex $diffbgcolors 0]
11917+
$ctext tag conf dresult -foreground [lindex $diffcolors 1]
11918+
$ctext tag conf dresult -background [lindex $diffbgcolors 1]
11919+
$ctext tag conf hunksep -foreground [lindex $diffcolors 2]
11920+
$ctext tag conf omark -background $markbgcolor
11921+
setselbg $selectbgcolor
11922+
}
11923+
1190211924
proc prefscan {} {
1190311925
global oldprefs prefstop
1190411926
global {*}$::config_variables
@@ -11909,6 +11931,7 @@ proc prefscan {} {
1190911931
catch {destroy $prefstop}
1191011932
unset prefstop
1191111933
fontcan
11934+
set_gui_colors
1191211935
}
1191311936
1191411937
proc prefsok {} {
@@ -12624,8 +12647,6 @@ eval font create textfontbold [fontflags textfont 1]
1262412647
parsefont uifont $uifont
1262512648
eval font create uifont [fontflags uifont]
1262612649
12627-
setui $uicolor
12628-
1262912650
setoptions
1263012651
1263112652
# check that we can find a .git directory somewhere...
@@ -12814,6 +12835,8 @@ if {[tk windowingsystem] eq "win32"} {
1281412835
focus -force .
1281512836
}
1281612837
12838+
set_gui_colors
12839+
1281712840
getcommits {}
1281812841
1281912842
# Local variables:

0 commit comments

Comments
 (0)