diff options
Diffstat (limited to 'git-gui/lib/option.tcl')
-rw-r--r-- | git-gui/lib/option.tcl | 91 |
1 files changed, 61 insertions, 30 deletions
diff --git a/git-gui/lib/option.tcl b/git-gui/lib/option.tcl index 1d55b49c9b..b5b6b2fea6 100644 --- a/git-gui/lib/option.tcl +++ b/git-gui/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 + global ui_comm_spell use_ttk NS array unset repo_config_new array unset global_config_new @@ -110,26 +110,28 @@ proc do_options {} { } set w .options_editor - toplevel $w + Dialog $w + wm withdraw $w + wm transient $w [winfo parent $w] wm geometry $w "+[winfo rootx .]+[winfo rooty .]" - frame $w.buttons - button $w.buttons.restore -text [mc "Restore Defaults"] \ + ${NS}::frame $w.buttons + ${NS}::button $w.buttons.restore -text [mc "Restore Defaults"] \ -default normal \ -command do_restore_defaults pack $w.buttons.restore -side left - button $w.buttons.save -text [mc Save] \ + ${NS}::button $w.buttons.save -text [mc Save] \ -default active \ -command [list do_save_config $w] pack $w.buttons.save -side right - button $w.buttons.cancel -text [mc "Cancel"] \ + ${NS}::button $w.buttons.cancel -text [mc "Cancel"] \ -default normal \ -command [list destroy $w] pack $w.buttons.cancel -side right -padx 5 pack $w.buttons -side bottom -fill x -pady 10 -padx 10 - labelframe $w.repo -text [mc "%s Repository" [reponame]] - labelframe $w.global -text [mc "Global (All Repositories)"] + ${NS}::labelframe $w.repo -text [mc "%s Repository" [reponame]] + ${NS}::labelframe $w.global -text [mc "Global (All Repositories)"] pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5 pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5 @@ -146,13 +148,20 @@ proc do_options {} { {b gui.trustmtime {mc "Trust File Modification Timestamps"}} {b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}} {b gui.matchtrackingbranch {mc "Match Tracking Branches"}} + {b gui.textconv {mc "Use Textconv For Diffs and Blames"}} {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}} + {i-0..100 gui.maxrecentrepo {mc "Maximum Length of Recent Repositories List"}} {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}} {i-0..300 gui.blamehistoryctx {mc "Blame History Context Radius (days)"}} {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}} + {t gui.diffopts {mc "Additional Diff Parameters"}} {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}} {t gui.newbranchtemplate {mc "New Branch Name Template"}} {c gui.encoding {mc "Default File Contents Encoding"}} + {b gui.warndetachedcommit {mc "Warn before committing to a detached head"}} + {s gui.stageuntracked {mc "Staging of untracked files"} {list "yes" "no" "ask"}} + {b gui.displayuntracked {mc "Show untracked files"}} + {i-1..99 gui.tabsize {mc "Tab spacing"}} } { set type [lindex $option 0] set name [lindex $option 1] @@ -161,7 +170,7 @@ proc do_options {} { foreach f {repo global} { switch -glob -- $type { b { - checkbutton $w.$f.$optid -text $text \ + ${NS}::checkbutton $w.$f.$optid -text $text \ -variable ${f}_config_new($name) \ -onvalue true \ -offvalue false @@ -169,10 +178,10 @@ proc do_options {} { } i-* { regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max - frame $w.$f.$optid - label $w.$f.$optid.l -text "$text:" + ${NS}::frame $w.$f.$optid + ${NS}::label $w.$f.$optid.l -text "$text:" pack $w.$f.$optid.l -side left -anchor w -fill x - spinbox $w.$f.$optid.v \ + tspinbox $w.$f.$optid.v \ -textvariable ${f}_config_new($name) \ -from $min \ -to $max \ @@ -184,11 +193,9 @@ proc do_options {} { } c - t { - frame $w.$f.$optid - label $w.$f.$optid.l -text "$text:" - entry $w.$f.$optid.v \ - -borderwidth 1 \ - -relief sunken \ + ${NS}::frame $w.$f.$optid + ${NS}::label $w.$f.$optid.l -text "$text:" + ${NS}::entry $w.$f.$optid.v \ -width 20 \ -textvariable ${f}_config_new($name) pack $w.$f.$optid.l -side left -anchor w @@ -199,7 +206,7 @@ proc do_options {} { menu $w.$f.$optid.m build_encoding_menu $w.$f.$optid.m \ [list set ${f}_config_new($name)] 1 - button $w.$f.$optid.b \ + ${NS}::button $w.$f.$optid.b \ -text [mc "Change"] \ -command [list popup_btn_menu \ $w.$f.$optid.m $w.$f.$optid.b] @@ -207,6 +214,23 @@ proc do_options {} { } pack $w.$f.$optid -side top -anchor w -fill x } + s { + set opts [eval [lindex $option 3]] + ${NS}::frame $w.$f.$optid + ${NS}::label $w.$f.$optid.l -text "$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 + } + 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 + } } } } @@ -226,11 +250,17 @@ proc do_options {} { set ${f}_config_new(gui.spellingdictionary) $value } - frame $w.$f.$optid - label $w.$f.$optid.l -text [mc "Spelling Dictionary:"] - eval tk_optionMenu $w.$f.$optid.v \ - ${f}_config_new(gui.spellingdictionary) \ - $all_dicts + ${NS}::frame $w.$f.$optid + ${NS}::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 + } 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 @@ -248,20 +278,20 @@ proc do_options {} { set global_config_new(gui.$font^^size) \ [font configure $font -size] - frame $w.global.$name - label $w.global.$name.l -text "$text:" - button $w.global.$name.b \ + ${NS}::frame $w.global.$name + ${NS}::label $w.global.$name.l -text "$text:" + ${NS}::button $w.global.$name.b \ -text [mc "Change Font"] \ -command [list \ - choose_font::pick \ + tchoosefont \ $w \ [mc "Choose %s" $text] \ global_config_new(gui.$font^^family) \ global_config_new(gui.$font^^size) \ ] - label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) - label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) - label $w.global.$name.pt -text [mc "pt."] + ${NS}::label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) + ${NS}::label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) + ${NS}::label $w.global.$name.pt -text [mc "pt."] pack $w.global.$name.l -side left -anchor w pack $w.global.$name.b -side right -anchor e pack $w.global.$name.pt -side right -anchor w @@ -280,6 +310,7 @@ proc do_options {} { set t [mc "Options"] } wm title $w "[appname] ([reponame]): $t" + wm deiconify $w tkwait window $w } |