font configure ${font}italic -slant italic
}
- global use_ttk NS
- set use_ttk 1
- set NS ttk
bind [winfo class .] <<ThemeChanged>> [list InitTheme]
pave_toplevel .
color::sync_with_theme
global ui_comm is_quitting repo_config commit_type
global GITGUI_BCK_exists GITGUI_BCK_i
global ui_comm_spell
- global ret_code use_ttk
+ global ret_code
if {$is_quitting} return
set is_quitting 1
}
set cfg_geometry [list]
lappend cfg_geometry [wm geometry .]
- if {$use_ttk} {
- lappend cfg_geometry [.vpane sashpos 0]
- lappend cfg_geometry [.vpane.files sashpos 0]
- } else {
- lappend cfg_geometry [lindex [.vpane sash coord 0] 0]
- lappend cfg_geometry [lindex [.vpane.files sash coord 0] 1]
- }
+ lappend cfg_geometry [.vpane sashpos 0]
+ lappend cfg_geometry [.vpane.files sashpos 0]
if {[catch {set rc_geometry $repo_config(gui.geometry)}]} {
set rc_geometry {}
}
# -- Branch Control
#
ttk::frame .branch
-if {!$use_ttk} {.branch configure -borderwidth 1 -relief sunken}
ttk::label .branch.l1 \
-text [mc "Current Branch:"] \
-anchor w \
#
ttk::panedwindow .vpane -orient horizontal
ttk::panedwindow .vpane.files -orient vertical
-if {$use_ttk} {
- .vpane add .vpane.files
-} else {
- .vpane add .vpane.files -sticky nsew -height 100 -width 200
-}
+.vpane add .vpane.files
pack .vpane -anchor n -side top -fill both -expand 1
# -- Working Directory File List
#
.vpane.files add .vpane.files.workdir
.vpane.files add .vpane.files.index
-if {!$use_ttk} {
- .vpane.files paneconfigure .vpane.files.workdir -sticky news
- .vpane.files paneconfigure .vpane.files.index -sticky news
-}
proc set_selection_colors {w has_focus} {
foreach tag [list in_diff in_sel] {
.vpane.lower add .vpane.lower.diff
.vpane.lower add .vpane.lower.commarea
.vpane add .vpane.lower
-if {$use_ttk} {
- .vpane.lower pane .vpane.lower.diff -weight 1
- .vpane.lower pane .vpane.lower.commarea -weight 0
-} else {
- .vpane.lower paneconfigure .vpane.lower.diff -stretch always
- .vpane.lower paneconfigure .vpane.lower.commarea -stretch never
-}
+.vpane.lower pane .vpane.lower.diff -weight 1
+.vpane.lower pane .vpane.lower.commarea -weight 0
# -- Commit Area Buttons
#
bind $w <Map> {}
after 0 [list after idle [list $w sashpos $pane $pos]]
}
-proc on_tk_pane_mapped {w pane x y} {
- bind $w <Map> {}
- after 0 [list after idle [list $w sash place $pane $x $y]]
-}
proc on_application_mapped {} {
- global repo_config use_ttk
+ global repo_config
bind . <Map> {}
set gm $repo_config(gui.geometry)
- if {$use_ttk} {
- bind .vpane <Map> \
- [list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
- bind .vpane.files <Map> \
- [list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
- } else {
- bind .vpane <Map> \
- [list on_tk_pane_mapped %W 0 \
- [lindex $gm 1] \
- [lindex [.vpane sash coord 0] 1]]
- bind .vpane.files <Map> \
- [list on_tk_pane_mapped %W 0 \
- [lindex [.vpane.files sash coord 0] 0] \
- [lindex $gm 2]]
- }
+ bind .vpane <Map> \
+ [list on_ttk_pane_mapped %W 0 [lindex $gm 1]]
+ bind .vpane.files <Map> \
+ [list on_ttk_pane_mapped %W 0 [lindex $gm 2]]
wm geometry . [lindex $gm 0]
}
if {[info exists repo_config(gui.geometry)]} {
proc do_about {} {
global appvers copyright oguilib
global tcl_patchLevel tk_patchLevel
- global ui_comm_spell use_ttk
+ global ui_comm_spell
set w .about_dialog
Dialog $w
field opt_detach 0; # force a detached head case?
constructor dialog {} {
- global use_ttk
make_dialog top w
wm withdraw $w
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
field reset_ok 0; # did the user agree to reset?
constructor dialog {} {
- global repo_config use_ttk
+ global repo_config
make_dialog top w
wm withdraw $w
-text [mc "Name:"] \
-value user \
-variable @name_type
- if {!$use_ttk} {$w.desc.name_r configure -anchor w}
set w_name $w.desc.name_t
ttk::entry $w_name \
-width 40 \
-text [mc "Match Tracking Branch Name"] \
-value match \
-variable @name_type
- if {!$use_ttk} {$w.desc.match_r configure -anchor w}
grid $w.desc.match_r -sticky we -padx {0 5} -columnspan 2
grid columnconfigure $w.desc 1 -weight 1
field w_delete ; # delete button
constructor dialog {} {
- global current_branch use_ttk
+ global current_branch
make_dialog top w
wm withdraw $w
field newname
constructor dialog {} {
- global current_branch use_ttk
+ global current_branch
make_dialog top w
wm withdraw $w
ttk::frame $w.rename
ttk::label $w.rename.oldname_l -text [mc "Branch:"]
- if {$use_ttk} {
- ttk::combobox $w.rename.oldname_m -textvariable @oldname \
- -values [load_all_heads] -state readonly
- } else {
- eval tk_optionMenu $w.rename.oldname_m @oldname [load_all_heads]
- }
+ ttk::combobox $w.rename.oldname_m -textvariable @oldname \
+ -values [load_all_heads] -state readonly
ttk::label $w.rename.newname_l -text [mc "New Name:"]
ttk::entry $w.rename.newname_t \
field ls_buf {}; # Buffered record output from ls-tree
constructor new {commit {path {}}} {
- global cursor_ptr M1B use_ttk
+ global cursor_ptr M1B
make_dialog top w
wm withdraw $top
wm title $top [mc "%s (%s): File Browser" [appname] [reponame]]
-anchor w \
-justify left \
-font font_uibold
- if {!$use_ttk} { $w.path configure -borderwidth 1 -relief sunken}
pack $w.path -anchor w -side top -fill x
ttk::frame $w.list
-textvariable @browser_status \
-anchor w \
-justify left
- if {!$use_ttk} { $w.status configure -borderwidth 1 -relief sunken}
pack $w.status -anchor w -side bottom -fill x
bind $w_list <Button-1> "[cb _click 0 @%x,%y];break"
field w_rev ; # mega-widget to pick the initial revision
constructor dialog {} {
- global use_ttk
make_dialog top w
wm withdraw $top
wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]]
constructor pick {path title a_family a_size} {
variable all_families
- global use_ttk
set v_family $a_family
set v_size $a_size
field sorted_recent ; # recent repositories (sorted)
constructor pick {} {
- global M1T M1B use_ttk
+ global M1T M1B
if {[set maxrecent [get_config gui.maxrecentrepo]] eq {}} {
set maxrecent 10
## Create New Repository
method _do_new {} {
- global use_ttk
$w_next conf \
-state disabled \
-command [cb _do_new2] \
## Clone Existing Repository
method _do_clone {} {
- global use_ttk
$w_next conf \
-state disabled \
-command [cb _do_clone2] \
}
constructor _new {path unmerged_only title} {
- global current_branch is_detached use_ttk
+ global current_branch is_detached
if {![info exists ::all_remotes]} {
load_all_remotes
-text [mc "This Detached Checkout"] \
-value HEAD \
-variable @revtype
- if {!$use_ttk} {$w.detachedhead_r configure -anchor w}
grid $w.detachedhead_r -sticky we -padx {0 5} -columnspan 2
}
] -side right
grid $w.types -sticky we -padx {0 5} -columnspan 2
- if {$use_ttk} {
- ttk::frame $w.list -style SListbox.TFrame -padding 2
- } else {
- frame $w.list
- }
+ ttk::frame $w.list -style SListbox.TFrame -padding 2
set w_list $w.list.l
listbox $w_list \
-font font_diff \
-exportselection false \
-xscrollcommand [cb _sb_set $w.list.sbx h] \
-yscrollcommand [cb _sb_set $w.list.sby v]
- if {$use_ttk} {
- $w_list configure -relief flat -highlightthickness 0 -borderwidth 0
- }
+ $w_list configure -relief flat -highlightthickness 0 -borderwidth 0
pack $w_list -fill both -expand 1
grid $w.list -sticky nswe -padx {20 5} -columnspan 2
bind $w_list <Any-Motion> [cb _show_tooltip @%x,%y]
}
method none {text} {
- global use_ttk
if {![winfo exists $w.none_r]} {
ttk::radiobutton $w.none_r \
-value none \
-variable @revtype
- if {!$use_ttk} {$w.none_r configure -anchor w}
grid $w.none_r -sticky we -padx {0 5} -columnspan 2
}
$w.none_r configure -text $text
proc make_dialog {t w args} {
upvar $t top $w pfx this this
- global use_ttk
uplevel [linsert $args 0 make_toplevel $t $w]
catch {wm attributes $top -type dialog}
pave_toplevel $pfx
}
method _init {} {
- global M1B use_ttk
+ global M1B
if {$is_toplevel} {
make_dialog top w -autodelete 0
# Copyright (C) 2006, 2007 Shawn Pearce
proc do_stats {} {
- global use_ttk
set fd [git_read [list count-objects -v]]
while {[gets $fd line] > 0} {
if {[regexp {^([^:]+): (\d+)$} $line _ name value]} {
}
proc hook_failed_popup {hook msg {is_fatal 1}} {
- global use_ttk
set w .hookfail
Dialog $w
wm withdraw $w
}
proc rescan_on_error {err {after {}}} {
- global use_ttk
-
set w .indexfried
Dialog $w
wm withdraw $w
field linenum {}
constructor new {i_w i_text args} {
- global use_ttk
set w $i_w
set ctext $i_text
constructor dialog {} {
global current_branch
- global M1B use_ttk
+ global M1B
if {![_can_merge $this]} {
delete_this
proc do_options {} {
global repo_config global_config font_descs
global repo_config_new global_config_new
- global ui_comm_spell use_ttk
+ global ui_comm_spell
array unset repo_config_new
array unset global_config_new
set opts [eval [lindex $option 3]]
ttk::frame $w.$f.$optid
ttk::label $w.$f.$optid.l -text [mc "%s:" $text]
- if {$use_ttk} {
- ttk::combobox $w.$f.$optid.v \
- -textvariable ${f}_config_new($name) \
- -values $opts -state readonly
- } else {
- eval tk_optionMenu $w.$f.$optid.v \
- ${f}_config_new($name) \
- $opts
- }
+ ttk::combobox $w.$f.$optid.v \
+ -textvariable ${f}_config_new($name) \
+ -values $opts -state readonly
pack $w.$f.$optid.l -side left -anchor w -fill x
pack $w.$f.$optid.v -side right -anchor e -padx 5
pack $w.$f.$optid -side top -anchor w -fill x
ttk::frame $w.$f.$optid
ttk::label $w.$f.$optid.l -text [mc "Spelling Dictionary:"]
- if {$use_ttk} {
- ttk::combobox $w.$f.$optid.v \
- -textvariable ${f}_config_new(gui.spellingdictionary) \
- -values $all_dicts -state readonly
- } else {
- eval tk_optionMenu $w.$f.$optid.v \
- ${f}_config_new(gui.spellingdictionary) \
- $all_dicts
- }
+ ttk::combobox $w.$f.$optid.v \
+ -textvariable ${f}_config_new(gui.spellingdictionary) \
+ -values $all_dicts -state readonly
pack $w.$f.$optid.l -side left -anchor w -fill x
pack $w.$f.$optid.v -side right -anchor e -padx 5
pack $w.$f.$optid -side top -anchor w -fill x
field opt_action fetch; # action to do after registering the remote locally
constructor dialog {} {
- global repo_config use_ttk
+ global repo_config
make_dialog top w
wm withdraw $top
field cached
constructor dialog {} {
- global all_remotes M1B use_ttk
+ global all_remotes M1B
make_dialog top w
wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]]
-text [mc "Remote:"] \
-value remote \
-variable @urltype
- if {$use_ttk} {
- ttk::combobox $w.dest.remote_m -textvariable @remote \
- -values $all_remotes -state readonly
- } else {
- eval tk_optionMenu $w.dest.remote_m @remote $all_remotes
- }
+ ttk::combobox $w.dest.remote_m -textvariable @remote \
+ -values $all_remotes -state readonly
grid $w.dest.remote_r $w.dest.remote_m -sticky w
if {[lsearch -sorted -exact $all_remotes origin] != -1} {
set remote origin
field smarkbot
constructor new {i_w i_text args} {
- global use_ttk
set w $i_w
set ctext $i_text
}
proc do_ssh_key {} {
- global sshkey_title sshkey_fd use_ttk
+ global sshkey_title sshkey_fd
set w .sshkey_dialog
if {[winfo exists $w]} {
text $w.contents -width 60 -height 10 -wrap char -relief sunken
pack $w.contents -fill both -expand 1
- set clr darkblue
- if {$use_ttk} { set clr [ttk::style lookup . -selectbackground] }
+ set clr [ttk::style lookup . -selectbackground]
$w.contents configure -inactiveselectbackground $clr
ttk::frame $w.buttons
field completed_operation_count
constructor new {path} {
- global use_ttk
set w $path
set w_l $w.l
set w_c $w.c
set completed_operation_count 0
ttk::frame $w
- if {!$use_ttk} {
- $w configure -borderwidth 1 -relief sunken
- }
ttk::label $w_l \
-textvariable @status_bar_text \
-anchor w \
}
proc gold_frame {w args} {
- global use_ttk
- if {$use_ttk && ![is_MacOSX]} {
+ if {![is_MacOSX]} {
eval [linsert $args 0 ttk::frame $w -style Gold.TFrame]
} else {
eval [linsert $args 0 frame $w -background gold]
}
proc tlabel {w args} {
- global use_ttk
- if {$use_ttk && ![is_MacOSX]} {
+ if {![is_MacOSX]} {
set cmd [list ttk::label $w -style Color.TLabel]
foreach {k v} $args {
switch -glob -- $k {
# The padded label gets used in the about class.
proc paddedlabel {w args} {
- global use_ttk
- if {$use_ttk} {
- eval [linsert $args 0 ttk::label $w -style Padded.TLabel]
- } else {
- eval [linsert $args 0 label $w \
- -padx 5 -pady 5 \
- -justify left \
- -anchor w \
- -borderwidth 1 \
- -relief solid]
- }
+ eval [linsert $args 0 ttk::label $w -style Padded.TLabel]
}
# Create a toplevel for use as a dialog.
# Tk toplevels are not themed - so pave it over with a themed frame to get
# the base color correct per theme.
proc pave_toplevel {w} {
- global use_ttk
- if {$use_ttk && ![winfo exists $w.!paving]} {
+ if {![winfo exists $w.!paving]} {
set paving [ttk::frame $w.!paving]
place $paving -x 0 -y 0 -relwidth 1 -relheight 1
lower $paving
# On many themes the border for a scrolled listbox needs to go around the
# listbox and the scrollbar.
proc slistbox {w args} {
- global use_ttk
- if {$use_ttk} {
- set f [ttk::frame $w -style SListbox.TFrame -padding 2]
- } else {
- set f [frame $w -relief flat]
- }
+ set f [ttk::frame $w -style SListbox.TFrame -padding 2]
if {[catch {
- if {$use_ttk} {
- eval [linsert $args 0 listbox $f.list -relief flat \
- -highlightthickness 0 -borderwidth 0]
- } else {
- eval [linsert $args 0 listbox $f.list]
- }
+ eval [linsert $args 0 listbox $f.list -relief flat \
+ -highlightthickness 0 -borderwidth 0]
ttk::scrollbar $f.vs -command [list $f.list yview]
$f.list configure -yscrollcommand [list $f.vs set]
grid $f.list $f.vs -sticky news
# fetch the background color from a widget.
proc get_bg_color {w} {
- global use_ttk
- if {$use_ttk} {
- set bg [ttk::style lookup [winfo class $w] -background]
- } else {
- set bg [$w cget -background]
- }
+ set bg [ttk::style lookup [winfo class $w] -background]
return $bg
}
-# ttk::spinbox didn't get added until 8.6
+# ttk::spinbox
proc tspinbox {w args} {
- global use_ttk
- if {$use_ttk && [llength [info commands ttk::spinbox]] > 0} {
- eval [linsert $args 0 ttk::spinbox $w]
- } else {
- eval [linsert $args 0 spinbox $w]
- }
+ eval [linsert $args 0 ttk::spinbox $w]
}
# Create a text widget with any theme specific properties.
proc ttext {w args} {
- global use_ttk
- if {$use_ttk} {
- switch -- [ttk_get_current_theme] {
- "vista" - "xpnative" {
- lappend args -highlightthickness 0 -borderwidth 0
- }
+ switch -- [ttk_get_current_theme] {
+ "vista" - "xpnative" {
+ lappend args -highlightthickness 0 -borderwidth 0
}
}
set w [eval [linsert $args 0 text $w]]
- if {$use_ttk} {
- if {[winfo class [winfo parent $w]] eq "EntryFrame"} {
- bind $w <FocusIn> {[winfo parent %W] state focus}
- bind $w <FocusOut> {[winfo parent %W] state !focus}
- }
+ if {[winfo class [winfo parent $w]] eq "EntryFrame"} {
+ bind $w <FocusIn> {[winfo parent %W] state focus}
+ bind $w <FocusOut> {[winfo parent %W] state !focus}
}
return $w
}
# themed frame suitable for surrounding a text field.
proc textframe {w args} {
- global use_ttk
- if {$use_ttk} {
- if {[catch {ttk::style layout EntryFrame}]} {
- InitEntryFrame
- }
- eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame]
- } else {
- eval [linsert $args 0 frame $w]
+ if {[catch {ttk::style layout EntryFrame}]} {
+ InitEntryFrame
}
+ eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame]
return $w
}
proc tentry {w args} {
- global use_ttk
- if {$use_ttk} {
- InitTheme
- ttk::entry $w -style Edged.Entry
- } else {
- entry $w
- }
+ InitTheme
+ ttk::entry $w -style Edged.Entry
rename $w _$w
interp alias {} $w {} tentry_widgetproc $w
return $w
}
proc tentry_widgetproc {w cmd args} {
- global use_ttk
switch -- $cmd {
state {
- if {$use_ttk} {
- return [uplevel 1 [list _$w $cmd] $args]
- } else {
- if {[lsearch -exact $args pressed] != -1} {
- _$w configure -background lightpink
- } else {
- _$w configure -background lightgreen
- }
- }
+ return [uplevel 1 [list _$w $cmd] $args]
}
configure {
- if {$use_ttk} {
- if {[set n [lsearch -exact $args -background]] != -1} {
- set args [lreplace $args $n [incr n]]
- if {[llength $args] == 0} {return}
- }
+ if {[set n [lsearch -exact $args -background]] != -1} {
+ set args [lreplace $args $n [incr n]]
+ if {[llength $args] == 0} {return}
}
return [uplevel 1 [list _$w $cmd] $args]
}
field ask_args 0; # ask for additional args
constructor dialog {} {
- global repo_config use_ttk
+ global repo_config
make_dialog top w
wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]]
field w_names ; # name list
constructor dialog {} {
- global repo_config global_config system_config use_ttk
+ global repo_config global_config system_config
load_config 1
field argstr {}; # arguments
constructor dialog {fullname} {
- global M1B use_ttk
+ global M1B
set title [get_config "guitool.$fullname.title"]
if {$title eq {}} {
proc do_push_anywhere {} {
global all_remotes current_branch
global push_urltype push_remote push_url push_thin push_tags
- global push_force use_ttk
+ global push_force
set w .push_setup
toplevel $w
-text [mc "Remote:"] \
-value remote \
-variable push_urltype
- if {$use_ttk} {
- ttk::combobox $w.dest.remote_m -state readonly \
- -exportselection false \
- -textvariable push_remote \
- -values $all_remotes
- } else {
- eval tk_optionMenu $w.dest.remote_m push_remote $all_remotes
- }
+ ttk::combobox $w.dest.remote_m -state readonly \
+ -exportselection false \
+ -textvariable push_remote \
+ -values $all_remotes
grid $w.dest.remote_r $w.dest.remote_m -sticky w
if {[lsearch -sorted -exact $all_remotes origin] != -1} {
set push_remote origin