From: Mark Levedahl Date: Tue, 20 May 2025 17:53:52 +0000 (-0400) Subject: git-gui: remove non-ttk code X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b1c537fdbdf5bcad2f73bbad8eb06983889ff78;p=thirdparty%2Fgit.git git-gui: remove non-ttk code git-gui has code paths to support older non-ttk widgets, but this code is no longer reachable as ttk is always used. Remove that code. Signed-off-by: Mark Levedahl --- diff --git a/git-gui.sh b/git-gui.sh index 67d51126e7..9beb24e28e 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -912,9 +912,6 @@ proc apply_config {} { font configure ${font}italic -slant italic } - global use_ttk NS - set use_ttk 1 - set NS ttk bind [winfo class .] <> [list InitTheme] pave_toplevel . color::sync_with_theme @@ -2313,7 +2310,7 @@ proc do_quit {{rc {1}}} { 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 @@ -2371,13 +2368,8 @@ proc do_quit {{rc {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 {} } @@ -3260,7 +3252,6 @@ default { # -- Branch Control # ttk::frame .branch -if {!$use_ttk} {.branch configure -borderwidth 1 -relief sunken} ttk::label .branch.l1 \ -text [mc "Current Branch:"] \ -anchor w \ @@ -3277,11 +3268,7 @@ pack .branch -side top -fill x # 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 @@ -3331,10 +3318,6 @@ pack $ui_index -side left -fill both -expand 1 # .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] { @@ -3361,13 +3344,8 @@ ttk::frame .vpane.lower.diff -relief sunken -borderwidth 1 -height 500 .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 # @@ -3888,29 +3866,14 @@ proc on_ttk_pane_mapped {w pane pos} { bind $w {} after 0 [list after idle [list $w sashpos $pane $pos]] } -proc on_tk_pane_mapped {w pane x y} { - bind $w {} - 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 . {} set gm $repo_config(gui.geometry) - if {$use_ttk} { - bind .vpane \ - [list on_ttk_pane_mapped %W 0 [lindex $gm 1]] - bind .vpane.files \ - [list on_ttk_pane_mapped %W 0 [lindex $gm 2]] - } else { - bind .vpane \ - [list on_tk_pane_mapped %W 0 \ - [lindex $gm 1] \ - [lindex [.vpane sash coord 0] 1]] - bind .vpane.files \ - [list on_tk_pane_mapped %W 0 \ - [lindex [.vpane.files sash coord 0] 0] \ - [lindex $gm 2]] - } + bind .vpane \ + [list on_ttk_pane_mapped %W 0 [lindex $gm 1]] + bind .vpane.files \ + [list on_ttk_pane_mapped %W 0 [lindex $gm 2]] wm geometry . [lindex $gm 0] } if {[info exists repo_config(gui.geometry)]} { diff --git a/lib/about.tcl b/lib/about.tcl index 7c32482d63..90fda3915d 100644 --- a/lib/about.tcl +++ b/lib/about.tcl @@ -4,7 +4,7 @@ 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 diff --git a/lib/branch_checkout.tcl b/lib/branch_checkout.tcl index 756ced9ffa..1e6b757b35 100644 --- a/lib/branch_checkout.tcl +++ b/lib/branch_checkout.tcl @@ -10,7 +10,6 @@ field opt_fetch 1; # refetch tracking branch if used? 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]] diff --git a/lib/branch_create.tcl b/lib/branch_create.tcl index bb4676ddb9..9fded28b5c 100644 --- a/lib/branch_create.tcl +++ b/lib/branch_create.tcl @@ -16,7 +16,7 @@ field opt_fetch 1; # refetch tracking branch if used? 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 @@ -44,7 +44,6 @@ constructor dialog {} { -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 \ @@ -57,7 +56,6 @@ constructor dialog {} { -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 diff --git a/lib/branch_delete.tcl b/lib/branch_delete.tcl index 32979d46fd..deac74a644 100644 --- a/lib/branch_delete.tcl +++ b/lib/branch_delete.tcl @@ -9,7 +9,7 @@ field w_check ; # revision picker for merge test field w_delete ; # delete button constructor dialog {} { - global current_branch use_ttk + global current_branch make_dialog top w wm withdraw $w diff --git a/lib/branch_rename.tcl b/lib/branch_rename.tcl index d31a3de59f..7a3b39d6a3 100644 --- a/lib/branch_rename.tcl +++ b/lib/branch_rename.tcl @@ -8,7 +8,7 @@ field oldname field newname constructor dialog {} { - global current_branch use_ttk + global current_branch make_dialog top w wm withdraw $w @@ -36,12 +36,8 @@ constructor dialog {} { 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 \ diff --git a/lib/browser.tcl b/lib/browser.tcl index 2b8535715c..f53eb952cf 100644 --- a/lib/browser.tcl +++ b/lib/browser.tcl @@ -21,7 +21,7 @@ field browser_busy 1 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]] @@ -40,7 +40,6 @@ constructor new {commit {path {}}} { -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 @@ -66,7 +65,6 @@ constructor new {commit {path {}}} { -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 "[cb _click 0 @%x,%y];break" @@ -269,7 +267,6 @@ field w ; # widget path 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]] diff --git a/lib/choose_font.tcl b/lib/choose_font.tcl index 01b9ba5abf..a90908a8ec 100644 --- a/lib/choose_font.tcl +++ b/lib/choose_font.tcl @@ -17,7 +17,6 @@ variable all_families [list] ; # All fonts known to Tk constructor pick {path title a_family a_size} { variable all_families - global use_ttk set v_family $a_family set v_size $a_size diff --git a/lib/choose_repository.tcl b/lib/choose_repository.tcl index e71ec1732d..866161548b 100644 --- a/lib/choose_repository.tcl +++ b/lib/choose_repository.tcl @@ -35,7 +35,7 @@ field readtree_err ; # Error output from read-tree (if any) 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 @@ -378,7 +378,6 @@ proc _objdir {path} { ## Create New Repository method _do_new {} { - global use_ttk $w_next conf \ -state disabled \ -command [cb _do_new2] \ @@ -462,7 +461,6 @@ proc _new_ok {p} { ## Clone Existing Repository method _do_clone {} { - global use_ttk $w_next conf \ -state disabled \ -command [cb _do_clone2] \ diff --git a/lib/choose_rev.tcl b/lib/choose_rev.tcl index c1034eae11..7a9e3c83bb 100644 --- a/lib/choose_rev.tcl +++ b/lib/choose_rev.tcl @@ -32,7 +32,7 @@ proc new_unmerged {path {title {}}} { } 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 @@ -52,7 +52,6 @@ constructor _new {path unmerged_only title} { -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 } @@ -95,11 +94,7 @@ constructor _new {path unmerged_only title} { ] -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 \ @@ -109,9 +104,7 @@ constructor _new {path unmerged_only title} { -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 [cb _show_tooltip @%x,%y] @@ -238,12 +231,10 @@ constructor _new {path unmerged_only title} { } 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 diff --git a/lib/class.tcl b/lib/class.tcl index f08506f383..0b1e67103f 100644 --- a/lib/class.tcl +++ b/lib/class.tcl @@ -136,7 +136,6 @@ proc delete_this {{t {}}} { 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 diff --git a/lib/console.tcl b/lib/console.tcl index ad6804bc34..267699408c 100644 --- a/lib/console.tcl +++ b/lib/console.tcl @@ -27,7 +27,7 @@ constructor embed {path title} { } method _init {} { - global M1B use_ttk + global M1B if {$is_toplevel} { make_dialog top w -autodelete 0 diff --git a/lib/database.tcl b/lib/database.tcl index 8f200369a2..78732d8651 100644 --- a/lib/database.tcl +++ b/lib/database.tcl @@ -2,7 +2,6 @@ # 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]} { diff --git a/lib/error.tcl b/lib/error.tcl index 4e95b407bd..fc0b5ad5e0 100644 --- a/lib/error.tcl +++ b/lib/error.tcl @@ -71,7 +71,6 @@ proc ask_popup {msg} { } proc hook_failed_popup {hook msg {is_fatal 1}} { - global use_ttk set w .hookfail Dialog $w wm withdraw $w diff --git a/lib/index.tcl b/lib/index.tcl index ffede7bde2..377547034b 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -22,8 +22,6 @@ proc _close_updateindex {fd} { } proc rescan_on_error {err {after {}}} { - global use_ttk - set w .indexfried Dialog $w wm withdraw $w diff --git a/lib/line.tcl b/lib/line.tcl index 62eae258ee..5980ae805c 100644 --- a/lib/line.tcl +++ b/lib/line.tcl @@ -9,7 +9,6 @@ field ctext field linenum {} constructor new {i_w i_text args} { - global use_ttk set w $i_w set ctext $i_text diff --git a/lib/merge.tcl b/lib/merge.tcl index dfdd28b80f..61524ec9ca 100644 --- a/lib/merge.tcl +++ b/lib/merge.tcl @@ -145,7 +145,7 @@ method _finish {cons ok} { constructor dialog {} { global current_branch - global M1B use_ttk + global M1B if {![_can_merge $this]} { delete_this diff --git a/lib/option.tcl b/lib/option.tcl index 888e9dbc2a..487d70691d 100644 --- a/lib/option.tcl +++ b/lib/option.tcl @@ -91,7 +91,7 @@ proc save_config {} { 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 @@ -218,15 +218,9 @@ proc do_options {} { 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 @@ -252,15 +246,9 @@ proc do_options {} { 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 diff --git a/lib/remote_add.tcl b/lib/remote_add.tcl index a8a57b85b0..bff1376cb3 100644 --- a/lib/remote_add.tcl +++ b/lib/remote_add.tcl @@ -13,7 +13,7 @@ field location {}; # location of the remote the user has chosen 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 diff --git a/lib/remote_branch_delete.tcl b/lib/remote_branch_delete.tcl index 4d529f3d18..a07f367410 100644 --- a/lib/remote_branch_delete.tcl +++ b/lib/remote_branch_delete.tcl @@ -23,7 +23,7 @@ field full_cache 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]] @@ -51,12 +51,8 @@ constructor dialog {} { -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 diff --git a/lib/search.tcl b/lib/search.tcl index a801598465..47a0d8c961 100644 --- a/lib/search.tcl +++ b/lib/search.tcl @@ -21,7 +21,6 @@ field smarktop field smarkbot constructor new {i_w i_text args} { - global use_ttk set w $i_w set ctext $i_text diff --git a/lib/sshkey.tcl b/lib/sshkey.tcl index 6caf1fd458..7a6526d3db 100644 --- a/lib/sshkey.tcl +++ b/lib/sshkey.tcl @@ -18,7 +18,7 @@ proc find_ssh_key {} { } proc do_ssh_key {} { - global sshkey_title sshkey_fd use_ttk + global sshkey_title sshkey_fd set w .sshkey_dialog if {[winfo exists $w]} { @@ -48,8 +48,7 @@ proc do_ssh_key {} { 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 diff --git a/lib/status_bar.tcl b/lib/status_bar.tcl index d2e04ac427..f5c0204a2d 100644 --- a/lib/status_bar.tcl +++ b/lib/status_bar.tcl @@ -39,7 +39,6 @@ field operations ; # list of current ongoing operations field completed_operation_count constructor new {path} { - global use_ttk set w $path set w_l $w.l set w_c $w.c @@ -52,9 +51,6 @@ constructor new {path} { 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 \ diff --git a/lib/themed.tcl b/lib/themed.tcl index e9688527e5..8c4a0c2ee7 100644 --- a/lib/themed.tcl +++ b/lib/themed.tcl @@ -190,8 +190,7 @@ proc InitEntryFrame {} { } 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] @@ -199,8 +198,7 @@ proc gold_frame {w args} { } 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 { @@ -216,17 +214,7 @@ proc tlabel {w args} { # 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. @@ -242,8 +230,7 @@ proc Dialog {w args} { # 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 @@ -254,19 +241,10 @@ proc pave_toplevel {w} { # 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 @@ -285,67 +263,42 @@ proc slistbox {w args} { # 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 {[winfo parent %W] state focus} - bind $w {[winfo parent %W] state !focus} - } + if {[winfo class [winfo parent $w]] eq "EntryFrame"} { + bind $w {[winfo parent %W] state focus} + bind $w {[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 @@ -353,25 +306,14 @@ proc tentry {w args} { 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] } diff --git a/lib/tools_dlg.tcl b/lib/tools_dlg.tcl index ddb3092bac..73236215b5 100644 --- a/lib/tools_dlg.tcl +++ b/lib/tools_dlg.tcl @@ -16,7 +16,7 @@ field ask_branch 0; # ask for a revision 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]] @@ -179,7 +179,7 @@ field w ; # widget path 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 @@ -272,7 +272,7 @@ field is_ok 0; # ok to start field argstr {}; # arguments constructor dialog {fullname} { - global M1B use_ttk + global M1B set title [get_config "guitool.$fullname.title"] if {$title eq {}} { diff --git a/lib/transport.tcl b/lib/transport.tcl index a53a6b1a42..020d09e112 100644 --- a/lib/transport.tcl +++ b/lib/transport.tcl @@ -120,7 +120,7 @@ trace add variable push_remote write \ 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 @@ -165,14 +165,10 @@ proc do_push_anywhere {} { -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