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/canvPsText.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/canvPsText.tcl')
-rw-r--r-- | tests/canvPsText.tcl | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/canvPsText.tcl b/tests/canvPsText.tcl index 08c9d27..8730788 100644 --- a/tests/canvPsText.tcl +++ b/tests/canvPsText.tcl @@ -2,7 +2,7 @@ # for text in canvases. 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 "Postscript Tests for Canvases" wm iconname .t "Postscript" @@ -25,46 +25,46 @@ button .t.bot.quit -text Quit -command {destroy .t} button .t.bot.print -text Print -command "lpr $c" pack .t.bot.print .t.bot.quit -side left -pady 1m -expand 1 -canvas $c -width 6i -height 7i -bd 2 -relief sunken +canvas $c -width 6i -height 7i -borderwidth 2 -relief sunken pack $c -expand yes -fill both -padx 2m -pady 2m -$c create rect 2.95i 0.45i 3.05i 0.55i -fill {} -outline black +$c create rect 2.95i 0.45i 3.05i 0.55i -fill "" -outline black $c create text 3.0i 0.5i -text "Center Courier Oblique 24" \ -anchor center -tags text -font {Courier 24 italic} -stipple $stipple -$c create rect 2.95i 0.95i 3.05i 1.05i -fill {} -outline black +$c create rect 2.95i 0.95i 3.05i 1.05i -fill "" -outline black $c create text 3.0i 1.0i -text "Northwest Helvetica 24" \ -anchor nw -tags text -font {Helvetica 24} -stipple $stipple -$c create rect 2.95i 1.45i 3.05i 1.55i -fill {} -outline black +$c create rect 2.95i 1.45i 3.05i 1.55i -fill "" -outline black $c create text 3.0i 1.5i -text "North Helvetica Oblique 12 " \ -anchor n -tags text -font {Helvetica 12 italic} -stipple $stipple -$c create rect 2.95i 1.95i 3.05i 2.05i -fill {} -outline blue +$c create rect 2.95i 1.95i 3.05i 2.05i -fill "" -outline blue $c create text 3.0i 2.0i -text "Northeast Helvetica Bold 24" \ -anchor ne -tags text -font {Helvetica 24 bold} -stipple $stipple -$c create rect 2.95i 2.45i 3.05i 2.55i -fill {} -outline black +$c create rect 2.95i 2.45i 3.05i 2.55i -fill "" -outline black $c create text 3.0i 2.5i -text "East Helvetica Bold Oblique 18" \ -anchor e -tags text -font {Helvetica 18 {bold italic}} -stipple $stipple -$c create rect 2.95i 2.95i 3.05i 3.05i -fill {} -outline black +$c create rect 2.95i 2.95i 3.05i 3.05i -fill "" -outline black $c create text 3.0i 3.0i -text "Southeast Times 10" \ -anchor se -tags text -font {Times 10} -stipple $stipple -$c create rect 2.95i 3.45i 3.05i 3.55i -fill {} -outline black +$c create rect 2.95i 3.45i 3.05i 3.55i -fill "" -outline black $c create text 3.0i 3.5i -text "South Times Italic 24" \ -anchor s -tags text -font {Times 24 italic} -stipple $stipple -$c create rect 2.95i 3.95i 3.05i 4.05i -fill {} -outline black +$c create rect 2.95i 3.95i 3.05i 4.05i -fill "" -outline black $c create text 3.0i 4.0i -text "Southwest Times Bold 18" \ -anchor sw -tags text -font {Times 18 bold} -stipple $stipple -$c create rect 2.95i 4.45i 3.05i 4.55i -fill {} -outline black +$c create rect 2.95i 4.45i 3.05i 4.55i -fill "" -outline black $c create text 3.0i 4.5i -text "West Times Bold Italic 24"\ -anchor w -tags text -font {Times 24 {bold italic}} -stipple $stipple -$c create rect 0.95i 5.20i 1.05i 5.30i -fill {} -outline black +$c create rect 0.95i 5.20i 1.05i 5.30i -fill "" -outline black $c create text 1.0i 5.25i -width 1.9i -anchor c -justify left -tags text \ -font {Times 18 bold} -stipple $stipple \ -text "This is a sample text item to see how left justification works" -$c create rect 2.95i 5.20i 3.05i 5.30i -fill {} -outline black +$c create rect 2.95i 5.20i 3.05i 5.30i -fill "" -outline black $c create text 3.0i 5.25i -width 1.8i -anchor c -justify center -tags text \ -font {Times 18 bold} -stipple $stipple \ -text "This is a sample text item to see how center justification works" -$c create rect 4.95i 5.20i 5.05i 5.30i -fill {} -outline black +$c create rect 4.95i 5.20i 5.05i 5.30i -fill "" -outline black $c create text 5.0i 5.25i -width 1.8i -anchor c -justify right -tags text \ -font {Times 18 bold} -stipple $stipple \ -text "This is a sample text item to see how right justification works" @@ -73,9 +73,9 @@ $c create text 3.0i 6.0i -width 5.0i -anchor n -justify right -tags text \ -text "This text is\nright justified\nwith a line length equal to\n\ the size of the enclosing rectangle.\nMake sure it prints right\ justified as well." -$c create rect 0.5i 6.0i 5.5i 6.9i -fill {} -outline black +$c create rect 0.5i 6.0i 5.5i 6.9i -fill "" -outline black -proc setStipple c { +proc setStipple {c} { global stipple $c itemconfigure text -stipple $stipple } |