1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-06 09:13:01 +01:00

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 <paulus@samba.org>
This commit is contained in:
Paul Mackerras 2009-09-05 22:06:46 +10:00
parent eae7d64a2d
commit 0cc08ff7dd

36
gitk
View file

@ -2606,7 +2606,7 @@ proc savestuff {w} {
global cmitmode wrapcomment datetimeformat limitdiffs global cmitmode wrapcomment datetimeformat limitdiffs
global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor global colors bgcolor fgcolor diffcolors diffcontext selectbgcolor
global autoselect extdifftool perfile_attrs markbgcolor use_ttk global autoselect extdifftool perfile_attrs markbgcolor use_ttk
global hideremotes global hideremotes want_ttk
if {$stuffsaved} return if {$stuffsaved} return
if {![winfo viewable .]} return if {![winfo viewable .]} return
@ -2630,6 +2630,7 @@ proc savestuff {w} {
puts $f [list set showlocalchanges $showlocalchanges] puts $f [list set showlocalchanges $showlocalchanges]
puts $f [list set datetimeformat $datetimeformat] puts $f [list set datetimeformat $datetimeformat]
puts $f [list set limitdiffs $limitdiffs] puts $f [list set limitdiffs $limitdiffs]
puts $f [list set want_ttk $want_ttk]
puts $f [list set bgcolor $bgcolor] puts $f [list set bgcolor $bgcolor]
puts $f [list set fgcolor $fgcolor] puts $f [list set fgcolor $fgcolor]
puts $f [list set colors $colors] puts $f [list set colors $colors]
@ -10586,7 +10587,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges global oldprefs prefstop showneartags showlocalchanges
global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect extdifftool perfile_attrs global tabstop limitdiffs autoselect extdifftool perfile_attrs
global hideremotes global hideremotes want_ttk have_ttk
set top .gitkprefs set top .gitkprefs
set prefstop $top set prefstop $top
@ -10595,7 +10596,7 @@ proc doprefs {} {
return return
} }
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs hideremotes} { limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
set oldprefs($v) [set $v] set oldprefs($v) [set $v]
} }
ttk_toplevel $top ttk_toplevel $top
@ -10616,6 +10617,9 @@ proc doprefs {} {
${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \ ${NS}::checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
-variable autoselect -variable autoselect
grid x $top.autoselect -sticky w grid x $top.autoselect -sticky w
${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
-variable hideremotes
grid x $top.hideremotes -sticky w
${NS}::label $top.ddisp -text [mc "Diff display options"] ${NS}::label $top.ddisp -text [mc "Diff display options"]
grid $top.ddisp - -sticky w -pady 10 grid $top.ddisp - -sticky w -pady 10
@ -10625,9 +10629,6 @@ proc doprefs {} {
${NS}::checkbutton $top.ntag -text [mc "Display nearby tags"] \ ${NS}::checkbutton $top.ntag -text [mc "Display nearby tags"] \
-variable showneartags -variable showneartags
grid x $top.ntag -sticky w grid x $top.ntag -sticky w
${NS}::checkbutton $top.hideremotes -text [mc "Hide remote refs"] \
-variable hideremotes
grid x $top.hideremotes -sticky w
${NS}::checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \ ${NS}::checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
-variable limitdiffs -variable limitdiffs
grid x $top.ldiff -sticky w grid x $top.ldiff -sticky w
@ -10643,6 +10644,17 @@ proc doprefs {} {
pack configure $top.extdifff.l -padx 10 pack configure $top.extdifff.l -padx 10
grid x $top.extdifff $top.extdifft -sticky ew grid x $top.extdifff $top.extdifft -sticky ew
${NS}::label $top.lgen -text [mc "General options"]
grid $top.lgen - -sticky w -pady 10
${NS}::checkbutton $top.want_ttk -variable want_ttk \
-text [mc "Use themed widgets"]
if {$have_ttk} {
${NS}::label $top.ttk_note -text [mc "(change requires restart)"]
} else {
${NS}::label $top.ttk_note -text [mc "(currently unavailable)"]
}
grid x $top.want_ttk $top.ttk_note -sticky w
${NS}::label $top.cdisp -text [mc "Colors: press to choose"] ${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
grid $top.cdisp - -sticky w -pady 10 grid $top.cdisp - -sticky w -pady 10
label $top.bg -padx 40 -relief sunk -background $bgcolor label $top.bg -padx 40 -relief sunk -background $bgcolor
@ -10689,7 +10701,8 @@ proc doprefs {} {
if {!$use_ttk} { if {!$use_ttk} {
foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag foreach w {maxpctl maxwidthl showlocal autoselect tabstopl ntag
ldiff lattr extdifff.l extdifff.b bgbut fgbut ldiff lattr extdifff.l extdifff.b bgbut fgbut
diffoldbut diffnewbut hunksepbut markbgbut selbgbut} { diffoldbut diffnewbut hunksepbut markbgbut selbgbut
want_ttk ttk_note} {
$top.$w configure -font optionfont $top.$w configure -font optionfont
} }
} }
@ -10760,7 +10773,7 @@ proc prefscan {} {
global oldprefs prefstop global oldprefs prefstop
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \ foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
limitdiffs tabstop perfile_attrs hideremotes} { limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
global $v global $v
set $v $oldprefs($v) set $v $oldprefs($v)
} }
@ -11236,6 +11249,7 @@ set limitdiffs 1
set datetimeformat "%Y-%m-%d %H:%M:%S" set datetimeformat "%Y-%m-%d %H:%M:%S"
set autoselect 1 set autoselect 1
set perfile_attrs 0 set perfile_attrs 0
set want_ttk 1
if {[tk windowingsystem] eq "aqua"} { if {[tk windowingsystem] eq "aqua"} {
set extdifftool "opendiff" set extdifftool "opendiff"
@ -11372,10 +11386,12 @@ set nullid2 "0000000000000000000000000000000000000001"
set nullfile "/dev/null" set nullfile "/dev/null"
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}] set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
if {![info exists use_ttk]} { if {![info exists have_ttk]} {
set use_ttk [llength [info commands ::ttk::style]] set have_ttk [llength [info commands ::ttk::style]]
} }
set use_ttk [expr {$have_ttk && $want_ttk}]
set NS [expr {$use_ttk ? "ttk" : ""}] set NS [expr {$use_ttk ? "ttk" : ""}]
set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .] set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
set runq {} set runq {}