{"thread":{"id":"18054","subject":"[PATCH] gitk: make use of themed widgets where available","startedAt":"2009-02-28T00:18:00Z","lastAt":"2009-03-23T23:28:25Z","messageCount":7,"participants":["Pat Thoyts","Sverre Rabbelier","Paul Mackerras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"106491","messageId":"87ljrre7nr.fsf@users.sourceforge.net","threadId":"18054","inReplyTo":null,"subject":"[PATCH] gitk: make use of themed widgets where available","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-02-28T00:18:00Z","receivedAt":"2009-02-28T00:18:00Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"\n    This patch improves the appearence of gitk on Windows XP and Vista\n    by making use of the themed widgets that are provided in Tk 8.5\n    and above. For good Vista support 8.6 will be needed.\n\nSigned-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n---\n gitk |  432 ++++++++++++++++++++++++++++++++++++++++--------------------------\n 1 files changed, 262 insertions(+), 170 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex f8c3c73..2b5265a 100755\n--- a/gitk\n+++ b/gitk\n@@ -1765,6 +1765,15 @@ proc removehead {id name} {\n     unset headids($name)\n }\n \n+proc ttk_toplevel {w args} {\n+    variable use_ttk\n+    eval [linsert $args 0 ::toplevel $w]\n+    if {$use_ttk} {\n+        place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1\n+    }\n+    return $w\n+}\n+\n proc make_transient {window origin} {\n     global have_tk85\n \n@@ -1784,14 +1793,16 @@ proc make_transient {window origin} {\n }\n \n proc show_error {w top msg} {\n+    variable use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n     message $w.m -text $msg -justify center -aspect 400\n     pack $w.m -side top -fill x -padx 20 -pady 20\n-    button $w.ok -text [mc OK] -command \"destroy $top\"\n+    ${ttk}::button $w.ok -default active -text [mc OK] -command \"destroy $top\"\n     pack $w.ok -side bottom -fill x\n     bind $top <Visibility> \"grab $top; focus $top\"\n-    bind $top <Key-Return> \"destroy $top\"\n-    bind $top <Key-space>  \"destroy $top\"\n-    bind $top <Key-Escape> \"destroy $top\"\n+    bind $top <Key-Return> [list $w.ok invoke]\n+    bind $top <Key-space>  [list $w.ok invoke]\n+    bind $top <Key-Escape> [list $w.ok invoke]\n     tkwait window $top\n }\n \n@@ -1801,18 +1812,29 @@ proc error_popup {msg {owner .}} {\n             -parent $owner -message $msg\n     } else {\n         set w .error\n-        toplevel $w\n+        ttk_toplevel $w\n         make_transient $w $owner\n         show_error $w $w $msg\n     }\n }\n \n+variable fullscreen 0\n+proc togglefullscreen {} {\n+    variable fullscreen\n+    if {[catch {\n+        set ofs [wm attribute . -fullscreen]\n+        if {$ofs} {set fs 0} else {set fs 1}\n+        wm attribute . -fullscreen $fs\n+        set fullscreen $fs\n+    } err]} { error_popup \"fullscreen error: $err\" }\n+}\n+\n proc confirm_popup {msg {owner .}} {\n     global confirm_ok use_ttk\n     set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n     set confirm_ok 0\n     set w .confirm\n-    toplevel $w\n+    ttk_toplevel $w\n     make_transient $w $owner\n     message $w.m -text $msg -justify center -aspect 400\n     pack $w.m -side top -fill x -padx 20 -pady 20\n@@ -1853,11 +1875,18 @@ proc setoptions {} {\n # description depends on type; it's the sublist for cascade, the\n # command to invoke for command, or {variable value} for radiobutton\n proc makemenu {m items} {\n-    menu $m\n-    if {[tk windowingsystem] eq {aqua}} {\n-\tset Meta1 Cmd\n-    } else {\n-\tset Meta1 Ctrl\n+    set Meta1 Ctrl\n+    switch -exact -- [tk windowingsystem] {\n+        win32 {\n+            menu $m -tearoff 0\n+        }\n+        aqua {\n+            menu $m\n+            set Meta1 Cmd\n+        }\n+        default {\n+            menu $m\n+        }\n     }\n     foreach i $items {\n \tset name [mc [lindex $i 1]]\n@@ -1913,7 +1942,8 @@ proc makewindow {} {\n     global headctxmenu progresscanv progressitem progresscoords statusw\n     global fprogitem fprogcoord lastprogupdate progupdatepending\n     global rprogitem rprogcoord rownumsel numcommits\n-    global have_tk85\n+    global have_tk85 use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n     # The \"mc\" arguments here are purely so that xgettext\n     # sees the following string as needing to be translated\n@@ -1945,8 +1975,10 @@ proc makewindow {} {\n     }\n     . configure -menu .bar\n \n+    place [${ttk}::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1\n+\n     # the gui has upper and lower half, parts of a paned window.\n-    panedwindow .ctop -orient vertical\n+    ${ttk}::panedwindow .ctop -orient vertical\n \n     # possibly use assumed geometry\n     if {![info exists geometry(pwsash0)]} {\n@@ -1954,46 +1986,56 @@ proc makewindow {} {\n         set geometry(topwidth) [expr {80 * $charspc}]\n         set geometry(botheight) [expr {15 * $linespc}]\n         set geometry(botwidth) [expr {50 * $charspc}]\n-        set geometry(pwsash0) \"[expr {40 * $charspc}] 2\"\n-        set geometry(pwsash1) \"[expr {60 * $charspc}] 2\"\n+        set geometry(pwsash0) [list [expr {40 * $charspc}] 2]\n+        set geometry(pwsash1) [list [expr {60 * $charspc}] 2]\n     }\n \n     # the upper half will have a paned window, a scroll bar to the right, and some stuff below\n-    frame .tf -height $geometry(topheight) -width $geometry(topwidth)\n-    frame .tf.histframe\n-    panedwindow .tf.histframe.pwclist -orient horizontal -sashpad 0 -handlesize 4\n+    ${ttk}::frame .tf -height $geometry(topheight) -width $geometry(topwidth)\n+    ${ttk}::frame .tf.histframe\n+    ${ttk}::panedwindow .tf.histframe.pwclist -orient horizontal \n+    if {!$use_ttk} {\n+        .tf.histframe.pwclist configure -sashpad 0 -handlesize 4\n+    }\n \n     # create three canvases\n     set cscroll .tf.histframe.csb\n     set canv .tf.histframe.pwclist.canv\n     canvas $canv \\\n \t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 \\\n-\t-yscrollincr $linespc -yscrollcommand \"scrollcanv $cscroll\"\n+\t-background $bgcolor -borderwidth 0 \\\n+\t-yscrollincrement $linespc -yscrollcommand \"scrollcanv $cscroll\"\n     .tf.histframe.pwclist add $canv\n     set canv2 .tf.histframe.pwclist.canv2\n     canvas $canv2 \\\n \t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+\t-background $bgcolor -borderwidth 0 -yscrollincrement $linespc\n     .tf.histframe.pwclist add $canv2\n     set canv3 .tf.histframe.pwclist.canv3\n     canvas $canv3 \\\n \t-selectbackground $selectbgcolor \\\n-\t-background $bgcolor -bd 0 -yscrollincr $linespc\n+\t-background $bgcolor -borderwidth 0 -yscrollincrement $linespc\n     .tf.histframe.pwclist add $canv3\n-    eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n-    eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n+    if {$use_ttk} {\n+        #set p1 [expr {[winfo screenwidth .] - (40 * $charspc)}]\n+        #set p0 [expr {[winfo screenwidth .] - (100 * $charspc)}]\n+        #.tf.histframe.pwclist sashpos 0 585\n+        #.tf.histframe.pwclist sashpos 1 868\n+     } else {\n+        eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n+        eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n+    }\n \n     # a scroll bar to rule them\n-    scrollbar $cscroll -command {allcanvs yview} -highlightthickness 0\n+    ${ttk}::scrollbar $cscroll -command {allcanvs yview} ;#-highlightthickness 0\n     pack $cscroll -side right -fill y\n     bind .tf.histframe.pwclist <Configure> {resizeclistpanes %W %w}\n     lappend bglist $canv $canv2 $canv3\n     pack .tf.histframe.pwclist -fill both -expand 1 -side left\n \n     # we have two button bars at bottom of top frame. Bar 1\n-    frame .tf.bar\n-    frame .tf.lbar -height 15\n+    ${ttk}::frame .tf.bar\n+    ${ttk}::frame .tf.lbar -height 15\n \n     set sha1entry .tf.bar.sha1\n     set entries $sha1entry\n@@ -2002,7 +2044,7 @@ proc makewindow {} {\n \t-command gotocommit -width 8\n     $sha1but conf -disabledforeground [$sha1but cget -foreground]\n     pack .tf.bar.sha1label -side left\n-    entry $sha1entry -width 40 -font textfont -textvariable sha1string\n+    ${ttk}::entry $sha1entry -width 40 -font textfont -textvariable sha1string\n     trace add variable sha1string write sha1change\n     pack $sha1entry -side left -pady 2\n \n@@ -2029,12 +2071,12 @@ proc makewindow {} {\n \t-state disabled -width 26\n     pack .tf.bar.rightbut -side left -fill y\n \n-    label .tf.bar.rowlabel -text [mc \"Row\"]\n+    ${ttk}::label .tf.bar.rowlabel -text [mc \"Row\"]\n     set rownumsel {}\n-    label .tf.bar.rownum -width 7 -font textfont -textvariable rownumsel \\\n+    ${ttk}::label .tf.bar.rownum -width 7 -font textfont -textvariable rownumsel \\\n \t-relief sunken -anchor e\n-    label .tf.bar.rowlabel2 -text \"/\"\n-    label .tf.bar.numcommits -width 7 -font textfont -textvariable numcommits \\\n+    ${ttk}::label .tf.bar.rowlabel2 -text \"/\"\n+    ${ttk}::label .tf.bar.numcommits -width 7 -font textfont -textvariable numcommits \\\n \t-relief sunken -anchor e\n     pack .tf.bar.rowlabel .tf.bar.rownum .tf.bar.rowlabel2 .tf.bar.numcommits \\\n \t-side left\n@@ -2043,7 +2085,7 @@ proc makewindow {} {\n \n     # Status label and progress bar\n     set statusw .tf.bar.status\n-    label $statusw -width 15 -relief sunken\n+    ${ttk}::label $statusw -width 15 -relief sunken\n     pack $statusw -side left -padx 5\n     set h [expr {[font metrics uifont -linespace] + 2}]\n     set progresscanv .tf.bar.progress\n@@ -2060,32 +2102,52 @@ proc makewindow {} {\n     set progupdatepending 0\n \n     # build up the bottom bar of upper window\n-    label .tf.lbar.flabel -text \"[mc \"Find\"] \"\n-    button .tf.lbar.fnext -text [mc \"next\"] -command {dofind 1 1}\n-    button .tf.lbar.fprev -text [mc \"prev\"] -command {dofind -1 1}\n-    label .tf.lbar.flab2 -text \" [mc \"commit\"] \"\n+    ${ttk}::label .tf.lbar.flabel -text \"[mc \"Find\"] \"\n+    ${ttk}::button .tf.lbar.fnext -text [mc \"next\"] -command {dofind 1 1}\n+    ${ttk}::button .tf.lbar.fprev -text [mc \"prev\"] -command {dofind -1 1}\n+    ${ttk}::label .tf.lbar.flab2 -text \" [mc \"commit\"] \"\n     pack .tf.lbar.flabel .tf.lbar.fnext .tf.lbar.fprev .tf.lbar.flab2 \\\n \t-side left -fill y\n     set gdttype [mc \"containing:\"]\n-    set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n-\t\t[mc \"containing:\"] \\\n-\t\t[mc \"touching paths:\"] \\\n-\t\t[mc \"adding/removing string:\"]]\n+    if {$use_ttk} {\n+        set values [list [mc \"containing:\"] [mc \"touching paths:\"] \\\n+                        [mc \"adding/removing string:\"]]\n+        set gm [ttk::combobox .tf.lbar.gdttype -width 10\\\n+                    -values $values -textvariable gdtype]\n+    } else {\n+        set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n+                    [mc \"containing:\"] \\\n+                    [mc \"touching paths:\"] \\\n+                    [mc \"adding/removing string:\"]]\n+    }\n     trace add variable gdttype write gdttype_change\n     pack .tf.lbar.gdttype -side left -fill y\n \n     set findstring {}\n     set fstring .tf.lbar.findstring\n     lappend entries $fstring\n-    entry $fstring -width 30 -font textfont -textvariable findstring\n+    ${ttk}::entry $fstring -width 30 -font textfont -textvariable findstring\n     trace add variable findstring write find_change\n     set findtype [mc \"Exact\"]\n-    set findtypemenu [tk_optionMenu .tf.lbar.findtype \\\n-\t\t      findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+    if {$use_ttk} {\n+        set values [list [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+        ttk::combobox .tf.lbar.findtype -width 10 \\\n+            -values $values -textvariable findtype\n+     } else {\n+        set findtypemenu [tk_optionMenu .tf.lbar.findtype \\\n+                              findtype [mc \"Exact\"] [mc \"IgnCase\"] [mc \"Regexp\"]]\n+    }\n     trace add variable findtype write findcom_change\n     set findloc [mc \"All fields\"]\n-    tk_optionMenu .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n-\t[mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n+    if {$use_ttk} {\n+        set values [list [mc \"All fields\"] [mc \"Headline\"] \\\n+                        [mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]]\n+        ttk::combobox .tf.lbar.findloc -width 10 \\\n+            -values $values -textvariable findloc\n+    } else {\n+        tk_optionMenu .tf.lbar.findloc findloc [mc \"All fields\"] [mc \"Headline\"] \\\n+            [mc \"Comments\"] [mc \"Author\"] [mc \"Committer\"]\n+    }\n     trace add variable findloc write find_change\n     pack .tf.lbar.findloc -side right\n     pack .tf.lbar.findtype -side right\n@@ -2096,38 +2158,41 @@ proc makewindow {} {\n     pack .tf.bar -in .tf -side bottom -fill x\n     pack .tf.histframe -fill both -side top -expand 1\n     .ctop add .tf\n-    .ctop paneconfigure .tf -height $geometry(topheight)\n-    .ctop paneconfigure .tf -width $geometry(topwidth)\n+    if {!$use_ttk} {\n+        .ctop paneconfigure .tf -height $geometry(topheight)\n+        .ctop paneconfigure .tf -width $geometry(topwidth)\n+    }\n \n     # now build up the bottom\n-    panedwindow .pwbottom -orient horizontal\n+    ${ttk}::panedwindow .pwbottom -orient horizontal\n \n     # lower left, a text box over search bar, scroll bar to the right\n     # if we know window height, then that will set the lower text height, otherwise\n     # we set lower text height which will drive window height\n     if {[info exists geometry(main)]} {\n-        frame .bleft -width $geometry(botwidth)\n+        ${ttk}::frame .bleft -width $geometry(botwidth)\n     } else {\n-        frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n+        ${ttk}::frame .bleft -width $geometry(botwidth) -height $geometry(botheight)\n     }\n-    frame .bleft.top\n-    frame .bleft.mid\n-    frame .bleft.bottom\n+    ${ttk}::frame .bleft.top\n+    ${ttk}::frame .bleft.mid\n+    ${ttk}::frame .bleft.bottom\n \n-    button .bleft.top.search -text [mc \"Search\"] -command dosearch\n+    ${ttk}::button .bleft.top.search -text [mc \"Search\"] -command dosearch\n     pack .bleft.top.search -side left -padx 5\n     set sstring .bleft.top.sstring\n-    entry $sstring -width 20 -font textfont -textvariable searchstring\n+    variable searchstring \"\"\n+    ${ttk}::entry $sstring -width 20 -font textfont -textvariable searchstring\n     lappend entries $sstring\n     trace add variable searchstring write incrsearch\n     pack $sstring -side left -expand 1 -fill x\n-    radiobutton .bleft.mid.diff -text [mc \"Diff\"] \\\n+    ${ttk}::radiobutton .bleft.mid.diff -text [mc \"Diff\"] \\\n \t-command changediffdisp -variable diffelide -value {0 0}\n-    radiobutton .bleft.mid.old -text [mc \"Old version\"] \\\n+    ${ttk}::radiobutton .bleft.mid.old -text [mc \"Old version\"] \\\n \t-command changediffdisp -variable diffelide -value {0 1}\n-    radiobutton .bleft.mid.new -text [mc \"New version\"] \\\n+    ${ttk}::radiobutton .bleft.mid.new -text [mc \"New version\"] \\\n \t-command changediffdisp -variable diffelide -value {1 0}\n-    label .bleft.mid.labeldiffcontext -text \"      [mc \"Lines of context\"]: \"\n+    ${ttk}::label .bleft.mid.labeldiffcontext -text \"      [mc \"Lines of context\"]: \"\n     pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left\n     spinbox .bleft.mid.diffcontext -width 5 -font textfont \\\n \t-from 1 -increment 1 -to 10000000 \\\n@@ -2137,7 +2202,7 @@ proc makewindow {} {\n     trace add variable diffcontextstring write diffcontextchange\n     lappend entries .bleft.mid.diffcontext\n     pack .bleft.mid.labeldiffcontext .bleft.mid.diffcontext -side left\n-    checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n+    ${ttk}::checkbutton .bleft.mid.ignspace -text [mc \"Ignore space change\"] \\\n \t-command changeignorespace -variable ignorespace\n     pack .bleft.mid.ignspace -side left -padx 5\n     set ctext .bleft.bottom.ctext\n@@ -2148,9 +2213,8 @@ proc makewindow {} {\n     if {$have_tk85} {\n \t$ctext conf -tabstyle wordprocessor\n     }\n-    scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n-    scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h \\\n-\t-width 10\n+    ${ttk}::scrollbar .bleft.bottom.sb -command \"$ctext yview\"\n+    ${ttk}::scrollbar .bleft.bottom.sbhorizontal -command \"$ctext xview\" -orient h\n     pack .bleft.top -side top -fill x\n     pack .bleft.mid -side top -fill x\n     grid $ctext .bleft.bottom.sb -sticky nsew\n@@ -2190,14 +2254,16 @@ proc makewindow {} {\n     $ctext tag conf found -back yellow\n \n     .pwbottom add .bleft\n-    .pwbottom paneconfigure .bleft -width $geometry(botwidth)\n+    if {!$use_ttk} {\n+        .pwbottom paneconfigure .bleft -width $geometry(botwidth)\n+    }\n \n     # lower right\n-    frame .bright\n-    frame .bright.mode\n-    radiobutton .bright.mode.patch -text [mc \"Patch\"] \\\n+    ${ttk}::frame .bright\n+    ${ttk}::frame .bright.mode\n+    ${ttk}::radiobutton .bright.mode.patch -text [mc \"Patch\"] \\\n \t-command reselectline -variable cmitmode -value \"patch\"\n-    radiobutton .bright.mode.tree -text [mc \"Tree\"] \\\n+    ${ttk}::radiobutton .bright.mode.tree -text [mc \"Tree\"] \\\n \t-command reselectline -variable cmitmode -value \"tree\"\n     grid .bright.mode.patch .bright.mode.tree -sticky ew\n     pack .bright.mode -side top -fill x\n@@ -2213,7 +2279,7 @@ proc makewindow {} {\n \t-spacing1 1 -spacing3 1\n     lappend bglist $cflist\n     lappend fglist $cflist\n-    scrollbar .bright.sb -command \"$cflist yview\"\n+    ${ttk}::scrollbar .bright.sb -command \"$cflist yview\"\n     pack .bright.sb -side right -fill y\n     pack $cflist -side left -fill both -expand 1\n     $cflist tag configure highlight \\\n@@ -2293,6 +2359,7 @@ proc makewindow {} {\n     bindkey u \"$ctext yview scroll -18 units\"\n     bindkey / {focus $fstring}\n     bindkey <Key-Return> {dofind 1 1}\n+    bindkey <Alt-Return> [namespace code [list togglefullscreen]]\n     bindkey ? {dofind -1 1}\n     bindkey f nextfile\n     bind . <F5> updatecommits\n@@ -2540,10 +2607,15 @@ proc savestuff {w} {\n }\n \n proc resizeclistpanes {win w} {\n-    global oldwidth\n+    global oldwidth use_ttk\n     if {[info exists oldwidth($win)]} {\n-\tset s0 [$win sash coord 0]\n-\tset s1 [$win sash coord 1]\n+        if {$use_ttk} {\n+            set s0 [$win sashpos 0]\n+            set s1 [$win sashpos 1]\n+        } else {\n+            set s0 [$win sash coord 0]\n+            set s1 [$win sash coord 1]\n+        }\n \tif {$w < 60} {\n \t    set sash0 [expr {int($w/2 - 2)}]\n \t    set sash1 [expr {int($w*5/6 - 2)}]\n@@ -2564,16 +2636,25 @@ proc resizeclistpanes {win w} {\n \t\t}\n \t    }\n \t}\n-\t$win sash place 0 $sash0 [lindex $s0 1]\n-\t$win sash place 1 $sash1 [lindex $s1 1]\n+        if {$use_ttk} {\n+            $win sashpos 0 $sash0\n+            $win sashpos 1 $sash1\n+        } else {\n+            $win sash place 0 $sash0 [lindex $s0 1]\n+            $win sash place 1 $sash1 [lindex $s1 1]\n+        }\n     }\n     set oldwidth($win) $w\n }\n \n proc resizecdetpanes {win w} {\n-    global oldwidth\n+    global oldwidth use_ttk\n     if {[info exists oldwidth($win)]} {\n-\tset s0 [$win sash coord 0]\n+        if {$use_ttk} {\n+            set s0 [$win sashpos 0]\n+        } else {\n+            set s0 [$win sash coord 0]\n+        }\n \tif {$w < 60} {\n \t    set sash0 [expr {int($w*3/4 - 2)}]\n \t} else {\n@@ -2586,7 +2667,11 @@ proc resizecdetpanes {win w} {\n \t\tset sash0 [expr {$w - 15}]\n \t    }\n \t}\n-\t$win sash place 0 $sash0 [lindex $s0 1]\n+        if {$use_ttk} {\n+            $win sashpos 0 $sash0\n+        } else {\n+            $win sash place 0 $sash0 [lindex $s0 1]\n+        }\n     }\n     set oldwidth($win) $w\n }\n@@ -2606,13 +2691,15 @@ proc bindall {event action} {\n }\n \n proc about {} {\n-    global uifont\n+    global uifont use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n     set w .about\n     if {[winfo exists $w]} {\n \traise $w\n \treturn\n     }\n-    toplevel $w\n+    ttk_toplevel $w\n+    wm withdraw $w\n     wm title $w [mc \"About gitk\"]\n     make_transient $w .\n     message $w.m -text [mc \"\n@@ -2623,14 +2710,18 @@ Copyright Â© 2005-2008 Paul Mackerras\n Use and redistribute under the terms of the GNU General Public License\"] \\\n \t    -justify center -aspect 400 -border 2 -bg white -relief groove\n     pack $w.m -side top -fill x -padx 2 -pady 2\n-    button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n+    ${ttk}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n     pack $w.ok -side bottom\n     bind $w <Visibility> \"focus $w.ok\"\n     bind $w <Key-Escape> \"destroy $w\"\n     bind $w <Key-Return> \"destroy $w\"\n+    tk::PlaceWindow $w widget .\n+    wm deiconify $w\n }\n \n proc keys {} {\n+    variable use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n     set w .keys\n     if {[winfo exists $w]} {\n \traise $w\n@@ -2641,7 +2732,7 @@ proc keys {} {\n     } else {\n \tset M1T Ctrl\n     }\n-    toplevel $w\n+    ttk_toplevel $w\n     wm title $w [mc \"Gitk key bindings\"]\n     make_transient $w .\n     message $w.m -text \"\n@@ -2685,7 +2776,7 @@ proc keys {} {\n \" \\\n \t    -justify left -bg white -border 2 -relief groove\n     pack $w.m -side top -fill both -padx 2 -pady 2\n-    button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n+    ${ttk}::button $w.ok -text [mc \"Close\"] -command \"destroy $w\" -default active\n     bind $w <Key-Escape> [list destroy $w]\n     pack $w.ok -side bottom\n     bind $w <Visibility> \"focus $w.ok\"\n@@ -3750,16 +3841,17 @@ proc editview {} {\n \n proc vieweditor {top n title} {\n     global newviewname newviewopts viewfiles bgcolor\n-    global known_view_options\n+    global known_view_options use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n-    toplevel $top\n+    ttk_toplevel $top\n     wm title $top $title\n     make_transient $top .\n \n     # View name\n-    frame $top.nfr\n-    label $top.nl -text [mc \"Name\"]\n-    entry $top.name -width 20 -textvariable newviewname($n)\n+    ${ttk}::frame $top.nfr\n+    ${ttk}::label $top.nl -text [mc \"Name\"]\n+    ${ttk}::entry $top.name -width 20 -textvariable newviewname($n)\n     pack $top.nfr -in $top -fill x -pady 5 -padx 3\n     pack $top.nl -in $top.nfr -side left -padx {0 30}\n     pack $top.name -in $top.nfr -side left\n@@ -3778,7 +3870,7 @@ proc vieweditor {top n title} {\n \tif {$flags eq \"+\" || $flags eq \"*\"} {\n \t    set cframe $top.fr$cnt\n \t    incr cnt\n-\t    frame $cframe\n+\t    ${ttk}::frame $cframe\n \t    pack $cframe -in $top -fill x -pady 3 -padx 3\n \t    set cexpand [expr {$flags eq \"*\"}]\n \t} else {\n@@ -3786,18 +3878,18 @@ proc vieweditor {top n title} {\n \t}\n \n \tif {$type eq \"b\"} {\n-\t    checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)\n+\t    ${ttk}::checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)\n \t    pack $cframe.c_$id -in $cframe -side left \\\n \t\t-padx [list $lxpad 0] -expand $cexpand -anchor w\n \t} elseif {[regexp {^t(\\d+)$} $type type sz]} {\n-\t    message $cframe.l_$id -aspect 1500 -text $title\n-\t    entry $cframe.e_$id -width $sz -background $bgcolor \\\n+            ${ttk}::label $cframe.l_$id -text $title\n+\t    ${ttk}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n \t\t-textvariable newviewopts($n,$id)\n \t    pack $cframe.l_$id -in $cframe -side left -padx [list $lxpad 0]\n \t    pack $cframe.e_$id -in $cframe -side left -expand 1 -fill x\n \t} elseif {[regexp {^t(\\d+)=$} $type type sz]} {\n-\t    message $cframe.l_$id -aspect 1500 -text $title\n-\t    entry $cframe.e_$id -width $sz -background $bgcolor \\\n+            ${ttk}::label $cframe.l_$id -text $title\n+\t    ${ttk}::entry $cframe.e_$id -width $sz -background $bgcolor \\\n \t\t-textvariable newviewopts($n,$id)\n \t    pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w\n \t    pack $cframe.e_$id -in $cframe -side top -fill x\n@@ -3805,7 +3897,7 @@ proc vieweditor {top n title} {\n     }\n \n     # Path list\n-    message $top.l -aspect 1500 \\\n+    ${ttk}::label $top.l \\\n \t-text [mc \"Enter files and directories to include, one per line:\"]\n     pack $top.l -in $top -side top -pady [list 7 0] -anchor w -padx 3\n     text $top.t -width 40 -height 5 -background $bgcolor -font uifont\n@@ -3818,10 +3910,11 @@ proc vieweditor {top n title} {\n \t$top.t mark set insert 0.0\n     }\n     pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3\n-    frame $top.buts\n-    button $top.buts.ok -text [mc \"OK\"] -command [list newviewok $top $n]\n-    button $top.buts.apply -text [mc \"Apply (F5)\"] -command [list newviewok $top $n 1]\n-    button $top.buts.can -text [mc \"Cancel\"] -command [list destroy $top]\n+    ${ttk}::frame $top.buts\n+    ${ttk}::button $top.buts.ok -text [mc \"OK\"] -command [list newviewok $top $n] \\\n+        -default active\n+    ${ttk}::button $top.buts.apply -text [mc \"Apply (F5)\"] -command [list newviewok $top $n 1]\n+    ${ttk}::button $top.buts.can -text [mc \"Cancel\"] -command [list destroy $top]\n     bind $top <Control-Return> [list newviewok $top $n]\n     bind $top <F5> [list newviewok $top $n 1]\n     bind $top <Escape> [list destroy $top]\n@@ -6665,8 +6758,7 @@ proc selectline {l isnew {desired_loc {}}} {\n     $sha1entry delete 0 end\n     $sha1entry insert 0 $id\n     if {$autoselect} {\n-\t$sha1entry selection from 0\n-\t$sha1entry selection to end\n+\t$sha1entry selection range 0 end\n     }\n     rhighlight_sel $id\n \n@@ -8043,7 +8135,8 @@ proc doseldiff {oldid newid} {\n }\n \n proc mkpatch {} {\n-    global rowmenuid currentid commitinfo patchtop patchnum\n+    global rowmenuid currentid commitinfo patchtop patchnum use_ttk\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n     if {![info exists currentid]} return\n     set oldid $currentid\n@@ -8053,38 +8146,38 @@ proc mkpatch {} {\n     set top .patch\n     set patchtop $top\n     catch {destroy $top}\n-    toplevel $top\n+    ttk_toplevel $top\n     make_transient $top .\n-    label $top.title -text [mc \"Generate patch\"]\n+    ${ttk}::label $top.title -text [mc \"Generate patch\"]\n     grid $top.title - -pady 10\n-    label $top.from -text [mc \"From:\"]\n-    entry $top.fromsha1 -width 40 -relief flat\n+    ${ttk}::label $top.from -text [mc \"From:\"]\n+    ${ttk}::entry $top.fromsha1 -width 40 ;#-relief flat\n     $top.fromsha1 insert 0 $oldid\n     $top.fromsha1 conf -state readonly\n     grid $top.from $top.fromsha1 -sticky w\n-    entry $top.fromhead -width 60 -relief flat\n+    ${ttk}::entry $top.fromhead -width 60 ;#-relief flat\n     $top.fromhead insert 0 $oldhead\n     $top.fromhead conf -state readonly\n     grid x $top.fromhead -sticky w\n-    label $top.to -text [mc \"To:\"]\n-    entry $top.tosha1 -width 40 -relief flat\n+    ${ttk}::label $top.to -text [mc \"To:\"]\n+    ${ttk}::entry $top.tosha1 -width 40 ;#-relief flat\n     $top.tosha1 insert 0 $newid\n     $top.tosha1 conf -state readonly\n     grid $top.to $top.tosha1 -sticky w\n-    entry $top.tohead -width 60 -relief flat\n+    ${ttk}::entry $top.tohead -width 60 ;#-relief flat\n     $top.tohead insert 0 $newhead\n-    $top.tohead conf -state readonly\n+    $top.tohead configure -state readonly\n     grid x $top.tohead -sticky w\n-    button $top.rev -text [mc \"Reverse\"] -command mkpatchrev -padx 5\n-    grid $top.rev x -pady 10\n-    label $top.flab -text [mc \"Output file:\"]\n-    entry $top.fname -width 60\n+    ${ttk}::button $top.rev -text [mc \"Reverse\"] -command mkpatchrev\n+    grid $top.rev x -pady 10 -padx 5\n+    ${ttk}::label $top.flab -text [mc \"Output file:\"]\n+    ${ttk}::entry $top.fname -width 60\n     $top.fname insert 0 [file normalize \"patch$patchnum.patch\"]\n     incr patchnum\n     grid $top.flab $top.fname -sticky w\n-    frame $top.buts\n-    button $top.buts.gen -text [mc \"Generate\"] -command mkpatchgo\n-    button $top.buts.can -text [mc \"Cancel\"] -command mkpatchcan\n+    ${ttk}::frame $top.buts\n+    ${ttk}::button $top.buts.gen -text [mc \"Generate\"] -command mkpatchgo\n+    ${ttk}::button $top.buts.can -text [mc \"Cancel\"] -command mkpatchcan\n     bind $top <Key-Return> mkpatchgo\n     bind $top <Key-Escape> mkpatchcan\n     grid $top.buts.gen $top.buts.can\n@@ -8140,7 +8233,7 @@ proc mktag {} {\n     set top .maketag\n     set mktagtop $top\n     catch {destroy $top}\n-    toplevel $top\n+    ttk_toplevel $top\n     make_transient $top .\n     label $top.title -text [mc \"Create tag\"]\n     grid $top.title - -pady 10\n@@ -8243,7 +8336,7 @@ proc writecommit {} {\n     set top .writecommit\n     set wrcomtop $top\n     catch {destroy $top}\n-    toplevel $top\n+    ttk_toplevel $top\n     make_transient $top .\n     label $top.title -text [mc \"Write commit to file\"]\n     grid $top.title - -pady 10\n@@ -8300,7 +8393,7 @@ proc mkbranch {} {\n \n     set top .makebranch\n     catch {destroy $top}\n-    toplevel $top\n+    ttk_toplevel $top\n     make_transient $top .\n     label $top.title -text [mc \"Create new branch\"]\n     grid $top.title - -pady 10\n@@ -8463,7 +8556,7 @@ proc resethead {} {\n \n     set confirm_ok 0\n     set w \".confirmreset\"\n-    toplevel $w\n+    ttk_toplevel $w\n     make_transient $w .\n     wm title $w [mc \"Confirm reset\"]\n     message $w.m -text \\\n@@ -8644,7 +8737,7 @@ proc showrefs {} {\n \trefill_reflist\n \treturn\n     }\n-    toplevel $top\n+    ttk_toplevel $top\n     wm title $top [mc \"Tags and heads: %s\" [file tail [pwd]]]\n     make_transient $top .\n     text $top.list -background $bgcolor -foreground $fgcolor \\\n@@ -9987,7 +10080,7 @@ proc choosefont {font which} {\n     if {![winfo exists $top]} {\n \tfont create sample\n \teval font config sample [font actual $font]\n-\ttoplevel $top\n+\tttk_toplevel $top\n \tmake_transient $top $prefstop\n \twm title $top [mc \"Gitk font chooser\"]\n \tlabel $top.l -textvariable fontparam(which)\n@@ -10088,10 +10181,11 @@ proc chg_fontparam {v sub op} {\n }\n \n proc doprefs {} {\n-    global maxwidth maxgraphpct\n+    global maxwidth maxgraphpct use_ttk\n     global oldprefs prefstop showneartags showlocalchanges\n     global bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor\n     global tabstop limitdiffs autoselect extdifftool perfile_attrs\n+    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n     set top .gitkprefs\n     set prefstop $top\n@@ -10103,97 +10197,95 @@ proc doprefs {} {\n \t\t   limitdiffs tabstop perfile_attrs} {\n \tset oldprefs($v) [set $v]\n     }\n-    toplevel $top\n+    ttk_toplevel $top\n     wm title $top [mc \"Gitk preferences\"]\n     make_transient $top .\n-    label $top.ldisp -text [mc \"Commit list display options\"]\n+    ${ttk}::label $top.ldisp -text [mc \"Commit list display options\"]\n     grid $top.ldisp - -sticky w -pady 10\n-    label $top.spacer -text \" \"\n-    label $top.maxwidthl -text [mc \"Maximum graph width (lines)\"] \\\n+    ${ttk}::label $top.spacer -text \" \"\n+    ${ttk}::label $top.maxwidthl -text [mc \"Maximum graph width (lines)\"] \\\n \t-font optionfont\n     spinbox $top.maxwidth -from 0 -to 100 -width 4 -textvariable maxwidth\n     grid $top.spacer $top.maxwidthl $top.maxwidth -sticky w\n-    label $top.maxpctl -text [mc \"Maximum graph width (% of pane)\"] \\\n+    ${ttk}::label $top.maxpctl -text [mc \"Maximum graph width (% of pane)\"] \\\n \t-font optionfont\n     spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct\n     grid x $top.maxpctl $top.maxpct -sticky w\n-    checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n-\t-font optionfont -variable showlocalchanges\n+    ${ttk}::checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n+\t-variable showlocalchanges\n     grid x $top.showlocal -sticky w\n-    checkbutton $top.autoselect -text [mc \"Auto-select SHA1\"] \\\n-\t-font optionfont -variable autoselect\n+    ${ttk}::checkbutton $top.autoselect -text [mc \"Auto-select SHA1\"] \\\n+\t-variable autoselect\n     grid x $top.autoselect -sticky w\n \n-    label $top.ddisp -text [mc \"Diff display options\"]\n+    ${ttk}::label $top.ddisp -text [mc \"Diff display options\"]\n     grid $top.ddisp - -sticky w -pady 10\n-    label $top.tabstopl -text [mc \"Tab spacing\"] -font optionfont\n+    ${ttk}::label $top.tabstopl -text [mc \"Tab spacing\"] -font optionfont\n     spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop\n     grid x $top.tabstopl $top.tabstop -sticky w\n-    checkbutton $top.ntag -text [mc \"Display nearby tags\"] \\\n-\t-font optionfont -variable showneartags\n+    ${ttk}::checkbutton $top.ntag -text [mc \"Display nearby tags\"] \\\n+\t-variable showneartags\n     grid x $top.ntag -sticky w\n-    checkbutton $top.ldiff -text [mc \"Limit diffs to listed paths\"] \\\n-\t-font optionfont -variable limitdiffs\n+    ${ttk}::checkbutton $top.ldiff -text [mc \"Limit diffs to listed paths\"] \\\n+\t-variable limitdiffs\n     grid x $top.ldiff -sticky w\n-    checkbutton $top.lattr -text [mc \"Support per-file encodings\"] \\\n-\t-font optionfont -variable perfile_attrs\n+    ${ttk}::checkbutton $top.lattr -text [mc \"Support per-file encodings\"] \\\n+\t-variable perfile_attrs\n     grid x $top.lattr -sticky w\n \n-    entry $top.extdifft -textvariable extdifftool\n-    frame $top.extdifff\n-    label $top.extdifff.l -text [mc \"External diff tool\" ] -font optionfont \\\n-\t-padx 10\n-    button $top.extdifff.b -text [mc \"Choose...\"] -font optionfont \\\n-\t-command choose_extdiff\n-    pack $top.extdifff.l $top.extdifff.b -side left\n+    ${ttk}::entry $top.extdifft -textvariable extdifftool\n+    ${ttk}::frame $top.extdifff\n+    ${ttk}::label $top.extdifff.l -text [mc \"External diff tool\" ] -font optionfont\n+    ${ttk}::button $top.extdifff.b -text [mc \"Choose...\"] -command choose_extdiff\n+    pack $top.extdifff.l -padx 10 ; pack $top.extdifff.b -side left\n     grid x $top.extdifff $top.extdifft -sticky w\n \n-    label $top.cdisp -text [mc \"Colors: press to choose\"]\n+    ${ttk}::label $top.cdisp -text [mc \"Colors: press to choose\"]\n     grid $top.cdisp - -sticky w -pady 10\n-    label $top.bg -padx 40 -relief sunk -background $bgcolor\n-    button $top.bgbut -text [mc \"Background\"] -font optionfont \\\n+    ${ttk}::label $top.bg -relief sunk -background $bgcolor\n+    ${ttk}::button $top.bgbut -text [mc \"Background\"] -font optionfont \\\n \t-command [list choosecolor bgcolor {} $top.bg [mc \"background\"] setbg]\n     grid x $top.bgbut $top.bg -sticky w\n-    label $top.fg -padx 40 -relief sunk -background $fgcolor\n-    button $top.fgbut -text [mc \"Foreground\"] -font optionfont \\\n+    ${ttk}::label $top.fg -padx 40 -relief sunk -background $fgcolor\n+    ${ttk}::button $top.fgbut -text [mc \"Foreground\"] -font optionfont \\\n \t-command [list choosecolor fgcolor {} $top.fg [mc \"foreground\"] setfg]\n     grid x $top.fgbut $top.fg -sticky w\n-    label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]\n-    button $top.diffoldbut -text [mc \"Diff: old lines\"] -font optionfont \\\n+    ${ttk}::label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0]\n+    ${ttk}::button $top.diffoldbut -text [mc \"Diff: old lines\"] -font optionfont \\\n \t-command [list choosecolor diffcolors 0 $top.diffold [mc \"diff old lines\"] \\\n \t\t      [list $ctext tag conf d0 -foreground]]\n     grid x $top.diffoldbut $top.diffold -sticky w\n-    label $top.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]\n-    button $top.diffnewbut -text [mc \"Diff: new lines\"] -font optionfont \\\n+    ${ttk}::label $top.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1]\n+    ${ttk}::button $top.diffnewbut -text [mc \"Diff: new lines\"] -font optionfont \\\n \t-command [list choosecolor diffcolors 1 $top.diffnew [mc \"diff new lines\"] \\\n \t\t      [list $ctext tag conf dresult -foreground]]\n     grid x $top.diffnewbut $top.diffnew -sticky w\n-    label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]\n-    button $top.hunksepbut -text [mc \"Diff: hunk header\"] -font optionfont \\\n+    ${ttk}::label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2]\n+    ${ttk}::button $top.hunksepbut -text [mc \"Diff: hunk header\"] -font optionfont \\\n \t-command [list choosecolor diffcolors 2 $top.hunksep \\\n \t\t      [mc \"diff hunk header\"] \\\n \t\t      [list $ctext tag conf hunksep -foreground]]\n     grid x $top.hunksepbut $top.hunksep -sticky w\n-    label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor\n-    button $top.markbgbut -text [mc \"Marked line bg\"] -font optionfont \\\n+    ${ttk}::label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor\n+    ${ttk}::button $top.markbgbut -text [mc \"Marked line bg\"] -font optionfont \\\n \t-command [list choosecolor markbgcolor {} $top.markbgsep \\\n \t\t      [mc \"marked line background\"] \\\n \t\t      [list $ctext tag conf omark -background]]\n     grid x $top.markbgbut $top.markbgsep -sticky w\n-    label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor\n-    button $top.selbgbut -text [mc \"Select bg\"] -font optionfont \\\n+    ${ttk}::label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor\n+    ${ttk}::button $top.selbgbut -text [mc \"Select bg\"] -font optionfont \\\n \t-command [list choosecolor selectbgcolor {} $top.selbgsep [mc \"background\"] setselbg]\n     grid x $top.selbgbut $top.selbgsep -sticky w\n \n-    label $top.cfont -text [mc \"Fonts: press to choose\"]\n+    ${ttk}::label $top.cfont -text [mc \"Fonts: press to choose\"]\n     grid $top.cfont - -sticky w -pady 10\n     mkfontdisp mainfont $top [mc \"Main font\"]\n     mkfontdisp textfont $top [mc \"Diff display font\"]\n     mkfontdisp uifont $top [mc \"User interface font\"]\n \n-    frame $top.buts\n-    button $top.buts.ok -text [mc \"OK\"] -command prefsok -default active\n-    button $top.buts.can -text [mc \"Cancel\"] -command prefscan -default normal\n+    ${ttk}::frame $top.buts\n+    ${ttk}::button $top.buts.ok -text [mc \"OK\"] -command prefsok -default active\n+    ${ttk}::button $top.buts.can -text [mc \"Cancel\"] -command prefscan -default normal\n     bind $top <Key-Return> prefsok\n     bind $top <Key-Escape> prefscan\n     grid $top.buts.ok $top.buts.can\n@@ -10791,11 +10883,11 @@ proc init {args} {\n \n     # check that we can find a .git directory somewhere...\n     if {[catch {set gitdir [gitdir]}]} {\n-        show_error {} . [mc \"Cannot find a git repository here.\"]\n+        error_popup [mc \"Cannot find a git repository here.\"]\n         exit 1\n     }\n     if {![file isdirectory $gitdir]} {\n-        show_error {} . [mc \"Cannot find the git directory \\\"%s\\\".\" $gitdir]\n+        error_popup [mc \"Cannot find the git directory \\\"%s\\\".\" $gitdir]\n         exit 1\n     }\n \n-- \n1.6.0.2.1172.ga5ed0\n"},{"id":"106493","messageId":"fabb9a1e0902271647n36152700p101a92d793dabb41@mail.gmail.com","threadId":"18054","inReplyTo":"87ljrre7nr.fsf@users.sourceforge.net","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2009-02-28T00:47:39Z","receivedAt":"2009-02-28T00:47:39Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Feb 28, 2009 at 01:18, Pat Thoyts\n<patthoyts@users.sourceforge.net> wrote:\n>    This patch improves the appearence of gitk on Windows XP and Vista\n>    by making use of the themed widgets that are provided in Tk 8.5\n>    and above. For good Vista support 8.6 will be needed.\n\nScreenies with before/after? :D\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"106494","messageId":"loom.20090228T005845-825@post.gmane.org","threadId":"18054","inReplyTo":"fabb9a1e0902271647n36152700p101a92d793dabb41@mail.gmail.com","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-02-28T00:59:55Z","receivedAt":"2009-02-28T00:59:55Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Sverre Rabbelier <srabbelier <at> gmail.com> writes:\n\n> \n> Heya,\n> \n> On Sat, Feb 28, 2009 at 01:18, Pat Thoyts\n> <patthoyts <at> users.sourceforge.net> wrote:\n> >    This patch improves the appearence of gitk on Windows XP and Vista\n> >    by making use of the themed widgets that are provided in Tk 8.5\n> >    and above. For good Vista support 8.6 will be needed.\n> \n> Screenies with before/after? :D\n> \n\nAfter (on Vista) http://www.patthoyts.tk/screenshots/gitk-vista.png\n\nPat Thoyts\n"},{"id":"106504","messageId":"18856.42302.321781.759870@cargo.ozlabs.ibm.com","threadId":"18054","inReplyTo":"87ljrre7nr.fsf@users.sourceforge.net","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2009-02-28T02:45:18Z","receivedAt":"2009-02-28T02:45:18Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Pat Thoyts writes:\n\n>     This patch improves the appearence of gitk on Windows XP and Vista\n>     by making use of the themed widgets that are provided in Tk 8.5\n>     and above. For good Vista support 8.6 will be needed.\n\nWow.  It'll take me a while to digest this.  Before I start diving\ninto it, does gitk still work on Tk 8.4 with this patch?\n\nPaul.\n"},{"id":"106526","messageId":"87ab86ewx3.fsf@users.sourceforge.net","threadId":"18054","inReplyTo":"18856.42302.321781.759870@cargo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-02-28T09:24:40Z","receivedAt":"2009-02-28T09:24:40Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n>Pat Thoyts writes:\n>\n>>     This patch improves the appearence of gitk on Windows XP and Vista\n>>     by making use of the themed widgets that are provided in Tk 8.5\n>>     and above. For good Vista support 8.6 will be needed.\n>\n>Wow.  It'll take me a while to digest this.  Before I start diving\n>into it, does gitk still work on Tk 8.4 with this patch?\n>\n>Paul.\n\nYes. It uses the variable 'use_ttk' to turn on the use of the themed\nwidgets and if this is unavailable (or an option could be provided to\nturn it off explicitly) then only standard Tk widgets are used.\n\n-- \nPat Thoyts                            http://www.patthoyts.tk/\nPGP fingerprint 2C 6E 98 07 2C 59 C8 97  10 CE 11 E6 04 E0 B9 DD\n"},{"id":"108998","messageId":"18887.8064.114036.850741@drongo.ozlabs.ibm.com","threadId":"18054","inReplyTo":"87ljrre7nr.fsf@users.sourceforge.net","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2009-03-23T05:34:56Z","receivedAt":"2009-03-23T05:34:56Z","isPatch":true,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Pat Thoyts writes:\n\n>     This patch improves the appearence of gitk on Windows XP and Vista\n>     by making use of the themed widgets that are provided in Tk 8.5\n>     and above. For good Vista support 8.6 will be needed.\n> \n> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n\nThanks for the patch.  It does seem to do a bit more than the commit\ndescription says, though:\n\n- It adds a toggle-fullscreen function.  I'd prefer that was done in a\n  separate patch.\n\n- It makes various changes to the layout in the non-ttk case - in\n  particular various message widgets get turned into label widgets.\n  Are label widgets entirely equivalent to message widgets?\n\nAlso, the patch has been corrupted by your mailer: on lines containing\nonly a \"+\", the \"+\" has been deleted.\n\nI have a few questions about specific things you've done in the patch:\n\n> +proc ttk_toplevel {w args} {\n> +    variable use_ttk\n> +    eval [linsert $args 0 ::toplevel $w]\n> +    if {$use_ttk} {\n> +        place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1\n\nWhat is the effect of this line, or what would happen if it wasn't\nthere?\n\n>  proc show_error {w top msg} {\n> +    variable use_ttk\n> +    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n\nIs there a strong reason for using variable here rather than global,\nor is it just habit?\n\nIt looks to me as though $ttk might as well be a global variable,\nrather than computing it from $use_ttk everywhere that we need it.\n\n> @@ -1945,8 +1975,10 @@ proc makewindow {} {\n>      }\n>      . configure -menu .bar\n>  \n> +    place [${ttk}::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1\n\nOnce again, what's the reason for using place and the extra frame?\n\n> +    if {$use_ttk} {\n> +        #set p1 [expr {[winfo screenwidth .] - (40 * $charspc)}]\n> +        #set p0 [expr {[winfo screenwidth .] - (100 * $charspc)}]\n> +        #.tf.histframe.pwclist sashpos 0 585\n> +        #.tf.histframe.pwclist sashpos 1 868\n> +     } else {\n> +        eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n> +        eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n> +    }\n\nLooks like that could be cleaned up a bit.\n\n> -    set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n> -\t\t[mc \"containing:\"] \\\n> -\t\t[mc \"touching paths:\"] \\\n> -\t\t[mc \"adding/removing string:\"]]\n> +    if {$use_ttk} {\n> +        set values [list [mc \"containing:\"] [mc \"touching paths:\"] \\\n> +                        [mc \"adding/removing string:\"]]\n> +        set gm [ttk::combobox .tf.lbar.gdttype -width 10\\\n> +                    -values $values -textvariable gdtype]\n> +    } else {\n> +        set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n> +                    [mc \"containing:\"] \\\n> +                    [mc \"touching paths:\"] \\\n> +                    [mc \"adding/removing string:\"]]\n> +    }\n\nWe could profitably use a helper function here that would take the\nlist of alternatives and make the combobox/optionMenu.\n\n> -    $top.tohead conf -state readonly\n> +    $top.tohead configure -state readonly\n\nDo all the other instances of conf need to be changed to configure,\nand if so, why?\n\n> -    checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n> -\t-font optionfont -variable showlocalchanges\n> +    ${ttk}::checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n> +\t-variable showlocalchanges\n\nWhy do we lose the -font optionfont?\n\nThanks,\nPaul.\n"},{"id":"109115","messageId":"49C81B19.2000706@users.sourceforge.net","threadId":"18054","inReplyTo":"18887.8064.114036.850741@drongo.ozlabs.ibm.com","subject":"Re: [PATCH] gitk: make use of themed widgets where available","fromName":"Pat Thoyts","fromEmail":"patthoyts@users.sourceforge.net","sentAt":"2009-03-23T23:28:25Z","receivedAt":"2009-03-23T23:28:25Z","isPatch":true,"sender":{"key":"patthoyts@users.sourceforge.net","avatar":"https://avatars.githubusercontent.com/u/30739?v=4"},"body":"Paul Mackerras wrote:\n> Pat Thoyts writes:\n> \n>>     This patch improves the appearence of gitk on Windows XP and Vista\n>>     by making use of the themed widgets that are provided in Tk 8.5\n>>     and above. For good Vista support 8.6 will be needed.\n>>\n>> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>\n> \n> Thanks for the patch.  It does seem to do a bit more than the commit\n> description says, though:\n> \n> - It adds a toggle-fullscreen function.  I'd prefer that was done in a\n>   separate patch.\n\nSure. This seems to be a recurring issue that I need to take care of.\n\n> - It makes various changes to the layout in the non-ttk case - in\n>   particular various message widgets get turned into label widgets.\n>   Are label widgets entirely equivalent to message widgets?\n\nIt depends on how the message widget is being used - but for simple cases\nthey are equivalent. The message widget has some more options for placing\nthe text within but is no themed equivalent for message.\n\n> Also, the patch has been corrupted by your mailer: on lines containing\n> only a \"+\", the \"+\" has been deleted.\n\nDamn - I'm surprised Gnus mashed anything in a patch file.\n\n> I have a few questions about specific things you've done in the patch:\n> \n>> +proc ttk_toplevel {w args} {\n>> +    variable use_ttk\n>> +    eval [linsert $args 0 ::toplevel $w]\n>> +    if {$use_ttk} {\n>> +        place [ttk::frame $w._toplevel_background] -x 0 -y 0 -relwidth 1 -relheight 1\n> \n> What is the effect of this line, or what would happen if it wasn't\n> there?\n\nA 'toplevel' widget is not themed so it picks up the default Tk options\nfor the current platform. Where the theme background colour for a frame\nis significantly different to the Tk background colour this becomes\nobvious. For instance:\n package require Tk 8.5\n ttk::style theme use clam\n pack [ttk::frame .f -height 100 -width 100] -padx 10 -pady 10\nwill show a different 10 pixel border around the frame in the Tk default\ncolour. On some themes the difference is not too noticable, on others\nits significant.\n\n>>  proc show_error {w top msg} {\n>> +    variable use_ttk\n>> +    set ttk [expr {$use_ttk ? \"ttk\" : \"\"}]\n> \n> Is there a strong reason for using variable here rather than global,\n> or is it just habit?\n\nhabit.\n\n> It looks to me as though $ttk might as well be a global variable,\n> rather than computing it from $use_ttk everywhere that we need it.\n\nAgreed\n\n>> @@ -1945,8 +1975,10 @@ proc makewindow {} {\n>>      }\n>>      . configure -menu .bar\n>>  \n>> +    place [${ttk}::frame ._main_background] -x 0 -y 0 -relwidth 1 -relheight 1\n> \n> Once again, what's the reason for using place and the extra frame?\n\nAs above. The other alternative would be to pack or grid a ttk::frame\nand then make all the other widgets children of this and pack/grid them\ninside. This is a simpler option.\n\n> \n>> +    if {$use_ttk} {\n>> +        #set p1 [expr {[winfo screenwidth .] - (40 * $charspc)}]\n>> +        #set p0 [expr {[winfo screenwidth .] - (100 * $charspc)}]\n>> +        #.tf.histframe.pwclist sashpos 0 585\n>> +        #.tf.histframe.pwclist sashpos 1 868\n>> +     } else {\n>> +        eval .tf.histframe.pwclist sash place 0 $geometry(pwsash0)\n>> +        eval .tf.histframe.pwclist sash place 1 $geometry(pwsash1)\n>> +    }\n>\n> Looks like that could be cleaned up a bit.\n\nDoh. I have this fixed properly locally (I'll comment at the end).\n\n>> -    set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n>> -\t\t[mc \"containing:\"] \\\n>> -\t\t[mc \"touching paths:\"] \\\n>> -\t\t[mc \"adding/removing string:\"]]\n>> +    if {$use_ttk} {\n>> +        set values [list [mc \"containing:\"] [mc \"touching paths:\"] \\\n>> +                        [mc \"adding/removing string:\"]]\n>> +        set gm [ttk::combobox .tf.lbar.gdttype -width 10\\\n>> +                    -values $values -textvariable gdtype]\n>> +    } else {\n>> +        set gm [tk_optionMenu .tf.lbar.gdttype gdttype \\\n>> +                    [mc \"containing:\"] \\\n>> +                    [mc \"touching paths:\"] \\\n>> +                    [mc \"adding/removing string:\"]]\n>> +    }\n> \n> We could profitably use a helper function here that would take the\n> list of alternatives and make the combobox/optionMenu.\n> \n>> -    $top.tohead conf -state readonly\n>> +    $top.tohead configure -state readonly\n> \n> Do all the other instances of conf need to be changed to configure,\n> and if so, why?\n\nUsing abbreviated subcommand or option names should really be restricted\nto interactive code. In script files its better to write it out in full\nas you never know in some future version Tk might get more subcommands\nadded and the abbreviation may no longer be unique.\nHowever, such changes should be put in a separate style patch.\n\n> \n>> -    checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n>> -\t-font optionfont -variable showlocalchanges\n>> +    ${ttk}::checkbutton $top.showlocal -text [mc \"Show local changes\"] \\\n>> +\t-variable showlocalchanges\n> \n> Why do we lose the -font optionfont?\n\nThe point to the ttk widgets is that the visual style of the widget\nbecomes dictated by the theme and it should no longer be necessary to\nspecify lots of options on each widget to get it looking reasonable.\nWhen running on Windows, the graphical elements should be drawn using\nthe system configured fonts and in Tk 8.5+ this is read from the system\nparameters info. So if a user configures her system to use large fonts\nvia the system display properties control panel, then large fonts is\nwhat she will now get.\n\nIn fact the ttk::checkbutton doesn't accept a -font option to discourage\npeople from overriding the users chosen system settings. If you really\nneed to set the font for a checkbutton then you create a new style and\nset the font for that style. Or cheat and use a tk::checkbutton which\nprovides all the same options it has always done.\n\nFor instance:\n ttk::style configure Fat.Checkbutton -font {Arial 12 bold}\n pack [ttk::checkbutton .check -text Emboldened -style Fat.Checkbutton]\n\n\nI will redo the ttk patch on top of the new commits and take better care\nto isolate them into descrete chunks of work. I have noticed since\nposting the patch that it broke the preferences dialog on Linux and the\npositions of the panedwindow splitters stopped being saved so these need\nrolling into a new patch as well.\n\nPat Thoyts\n"}]}