diff options
| author | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
|---|---|---|
| committer | andreask <andreask> | 2013-01-22 19:30:43 (GMT) |
| commit | 48c9fcb7281cc6aa076113db874c7ae0e105795d (patch) | |
| tree | 7187940ff056462bfa41705a2ce04d0ed07d424e /tests/arc.tcl | |
| parent | 41f5d19540b0b3f053da352e1569c9a4ed019dd5 (diff) | |
| download | tk-contrib_patrick_fradin_code_cleanup.zip tk-contrib_patrick_fradin_code_cleanup.tar.gz tk-contrib_patrick_fradin_code_cleanup.tar.bz2 | |
Contribution by Patrick Fradin <patrick.fradin@planar.com>contrib_patrick_fradin_code_cleanup
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'tests/arc.tcl')
| -rw-r--r-- | tests/arc.tcl | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/arc.tcl b/tests/arc.tcl index d0a93ea..29444b4 100644 --- a/tests/arc.tcl +++ b/tests/arc.tcl @@ -1,7 +1,7 @@ # This file creates a visual test for arcs. It is part of the Tk # visual test suite, which is invoked via the "visual" script. -catch {destroy .t} +destroy .t toplevel .t wm title .t "Visual Tests for Canvas Arcs" wm iconname .t "Arcs" @@ -42,23 +42,23 @@ set outline black .t.c create arc 500 260 620 460 -start 30 -extent 150 -fill {} -width 14 \ -style chord -outline $outline .t.c create arc 20 450 140 570 -start 135 -extent 270 -fill $fill1 -width 14 \ - -style pieslice -outline {} + -style pieslice -outline "" .t.c create arc 180 450 300 570 -start 30 -extent -90 -fill $fill1 -width 14 \ - -style pieslice -outline {} + -style pieslice -outline "" .t.c create arc 340 450 460 570 -start 320 -extent 270 -fill $fill1 -width 14 \ - -style chord -outline {} + -style chord -outline "" .t.c create arc 500 450 620 570 -start 350 -extent -110 -fill $fill1 -width 14 \ - -style chord -outline {} + -style chord -outline "" .t.c addtag arc withtag all .t.c addtag circle withtag [.t.c create oval 320 200 340 220 -fill MistyRose3] .t.c bind arc <Any-Enter> { set prevFill [lindex [.t.c itemconf current -fill] 4] set prevOutline [lindex [.t.c itemconf current -outline] 4] - if {($prevFill != "") || ($prevOutline == "")} { + if {($prevFill ne "") || ($prevOutline eq "")} { .t.c itemconf current -fill $fill3 } - if {$prevOutline != ""} { + if {$prevOutline ne ""} { .t.c itemconf current -outline $outline2 } } @@ -99,7 +99,7 @@ bind .t.c <Shift-1> { } bind .t.c <Shift-B1-Motion> { - .t.c move circle [expr %x-$curx] [expr %y-$cury] + .t.c move circle [expr {%x - $curx}] [expr {%y - $cury}] set curx %x set cury %y } @@ -127,7 +127,7 @@ bind .t.c a { } incr i $delta c -start $i - c -extent [expr 360-2*$i] + c -extent [expr {360 - (2 * $i)}] after 20 update } |
