Skip to content

Commit 0cc08ff

Browse files
committed
gitk: Add a user preference to enable/disable use of themed widgets
Also move the hide-remotes option up into the commit display options in the Edit->Preferences panel, since it affects the commit display more than the diff display. Signed-off-by: Paul Mackerras <[email protected]>
1 parent eae7d64 commit 0cc08ff

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

gitk

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2606,7 +2606,7 @@ proc savestuff {w} {
26062606
global cmitmode wrapcomment datetimeformat limitdiffs
26072607
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
26082608
global autoselect extdifftool perfile_attrs markbgcolor use_ttk
2609-
global hideremotes
2609+
global hideremotes want_ttk
26102610

26112611
if {$stuffsaved} return
26122612
if {![winfo viewable .]} return
@@ -2630,6 +2630,7 @@ proc savestuff {w} {
26302630
puts $f [list set showlocalchanges $showlocalchanges]
26312631
puts $f [list set datetimeformat $datetimeformat]
26322632
puts $f [list set limitdiffs $limitdiffs]
2633+
puts $f [list set want_ttk $want_ttk]
26332634
puts $f [list set bgcolor $bgcolor]
26342635
puts $f [list set fgcolor $fgcolor]
26352636
puts $f [list set colors $colors]
@@ -10586,7 +10587,7 @@ proc doprefs {} {
1058610587
global oldprefs prefstop showneartags showlocalchanges
1058710588
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
1058810589
global tabstop limitdiffs autoselect extdifftool perfile_attrs
10589-
global hideremotes
10590+
global hideremotes want_ttk have_ttk
1059010591

1059110592
set top .gitkprefs
1059210593
set prefstop $top
@@ -10595,7 +10596,7 @@ proc doprefs {} {
1059510596
return
1059610597
}
1059710598
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10598-
limitdiffs tabstop perfile_attrs hideremotes} {
10599+
limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
1059910600
set oldprefs($v) [set $v]
1060010601
}
1060110602
ttk_toplevel $top
@@ -10616,6 +10617,9 @@ proc doprefs {} {
1061610617
${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
1061710618
-variable autoselect
1061810619
grid x $top.autoselect -sticky w
10620+
${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10621+
-variable hideremotes
10622+
grid x $top.hideremotes -sticky w
1061910623

1062010624
${NS}::label $top.ddisp -text [mc "Diff display options"]
1062110625
grid $top.ddisp - -sticky w -pady 10
@@ -10625,9 +10629,6 @@ proc doprefs {} {
1062510629
${NS}::checkbutton $top.ntag -text [mc "Display nearby tags"] \
1062610630
-variable showneartags
1062710631
grid x $top.ntag -sticky w
10628-
${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
10629-
-variable hideremotes
10630-
grid x $top.hideremotes -sticky w
1063110632
${NS}::checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
1063210633
-variable limitdiffs
1063310634
grid x $top.ldiff -sticky w
@@ -10643,6 +10644,17 @@ proc doprefs {} {
1064310644
pack configure $top.extdifff.l -padx 10
1064410645
grid x $top.extdifff $top.extdifft -sticky ew
1064510646

10647+
${NS}::label $top.lgen -text [mc "General options"]
10648+
grid $top.lgen - -sticky w -pady 10
10649+
${NS}::checkbutton $top.want_ttk -variable want_ttk \
10650+
-text [mc "Use themed widgets"]
10651+
if {$have_ttk} {
10652+
${NS}::label $top.ttk_note -text [mc "(change requires restart)"]
10653+
} else {
10654+
${NS}::label $top.ttk_note -text [mc "(currently unavailable)"]
10655+
}
10656+
grid x $top.want_ttk $top.ttk_note -sticky w
10657+
1064610658
${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
1064710659
grid $top.cdisp - -sticky w -pady 10
1064810660
label $top.bg -padx 40 -relief sunk -background $bgcolor
@@ -10689,7 +10701,8 @@ proc doprefs {} {
1068910701
if {!$use_ttk} {
1069010702
foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag
1069110703
ldiff lattr extdifff.l extdifff.b bgbut fgbut
10692-
diffoldbut diffnewbut hunksepbut markbgbut selbgbut} {
10704+
diffoldbut diffnewbut hunksepbut markbgbut selbgbut
10705+
want_ttk ttk_note} {
1069310706
$top.$w configure -font optionfont
1069410707
}
1069510708
}
@@ -10760,7 +10773,7 @@ proc prefscan {} {
1076010773
global oldprefs prefstop
1076110774

1076210775
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
10763-
limitdiffs tabstop perfile_attrs hideremotes} {
10776+
limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
1076410777
global $v
1076510778
set $v $oldprefs($v)
1076610779
}
@@ -11236,6 +11249,7 @@ set limitdiffs 1
1123611249
set datetimeformat "%Y-%m-%d %H:%M:%S"
1123711250
set autoselect 1
1123811251
set perfile_attrs 0
11252+
set want_ttk 1
1123911253

1124011254
if {[tk windowingsystem] eq "aqua"} {
1124111255
set extdifftool "opendiff"
@@ -11372,10 +11386,12 @@ set nullid2 "0000000000000000000000000000000000000001"
1137211386
set nullfile "/dev/null"
1137311387

1137411388
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
11375-
if {![info exists use_ttk]} {
11376-
set use_ttk [llength [info commands ::ttk::style]]
11389+
if {![info exists have_ttk]} {
11390+
set have_ttk [llength [info commands ::ttk::style]]
1137711391
}
11392+
set use_ttk [expr {$have_ttk && $want_ttk}]
1137811393
set NS [expr {$use_ttk ? "ttk" : ""}]
11394+
1137911395
set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
1138011396

1138111397
set runq {}

0 commit comments

Comments
 (0)