1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-13 20:53:02 +01:00
git/lib/about.tcl
Pat Thoyts c80d7be5e1 git-gui: use themed tk widgets with Tk 8.5
This patch enables the use of themed Tk widgets with Tk 8.5 and above.
These make a significant difference on Windows in making the
application appear native. On Windows and MacOSX ttk defaults to the
native look as much as possible. On X11 the user may select a theme
using the TkTheme XRDB resource class by adding an line to the
.Xresources file. The set of installed theme names is available using
the Tk command 'ttk::themes'. The default on X11 is similar to the current
un-themed style - a kind of thin bordered motif look.

A new git config variable 'gui.usettk' may be set to disable this if
the user prefers the classic Tk look. Using Tk 8.4 will also avoid the
use of themed widgets as these are only available since 8.5.

Some support is included for Tk 8.6 features (themed spinbox and native
font chooser for MacOSX and Windows).

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2010-01-27 17:13:52 -08:00

70 lines
1.9 KiB
Tcl

# git-gui about git-gui dialog
# Copyright (C) 2006, 2007 Shawn Pearce
proc do_about {} {
global appvers copyright oguilib
global tcl_patchLevel tk_patchLevel
global ui_comm_spell NS use_ttk
set w .about_dialog
Dialog $w
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
pack [git_logo $w.git_logo] -side left -fill y -padx 10 -pady 10
${NS}::label $w.header -text [mc "About %s" [appname]] \
-font font_uibold -anchor center
pack $w.header -side top -fill x
${NS}::frame $w.buttons
${NS}::button $w.buttons.close -text {Close} \
-default active \
-command [list destroy $w]
pack $w.buttons.close -side right
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
paddedlabel $w.desc \
-text "[mc "git-gui - a graphical user interface for Git."]\n$copyright"
pack $w.desc -side top -fill x -padx 5 -pady 5
set v {}
append v "git-gui version $appvers\n"
append v "[git version]\n"
append v "\n"
if {$tcl_patchLevel eq $tk_patchLevel} {
append v "Tcl/Tk version $tcl_patchLevel"
} else {
append v "Tcl version $tcl_patchLevel"
append v ", Tk version $tk_patchLevel"
}
if {[info exists ui_comm_spell]
&& [$ui_comm_spell version] ne {}} {
append v "\n"
append v [$ui_comm_spell version]
}
set d {}
append d "git wrapper: $::_git\n"
append d "git exec dir: [gitexec]\n"
append d "git-gui lib: $oguilib"
paddedlabel $w.vers -text $v
pack $w.vers -side top -fill x -padx 5 -pady 5
paddedlabel $w.dirs -text $d
pack $w.dirs -side top -fill x -padx 5 -pady 5
menu $w.ctxm -tearoff 0
$w.ctxm add command \
-label {Copy} \
-command "
clipboard clear
clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
"
bind $w <Visibility> "grab $w; focus $w.buttons.close"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> "destroy $w"
bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
wm title $w "About [appname]"
tkwait window $w
}