summaryrefslogtreecommitdiffstats
path: root/library/demos/ruler.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'library/demos/ruler.tcl')
-rw-r--r--library/demos/ruler.tcl26
1 files changed, 13 insertions, 13 deletions
diff --git a/library/demos/ruler.tcl b/library/demos/ruler.tcl
index 557b680..0a6990f 100644
--- a/library/demos/ruler.tcl
+++ b/library/demos/ruler.tcl
@@ -19,12 +19,12 @@ package require Tk
proc rulerMkTab {c x y} {
upvar #0 demo_rulerInfo v
- $c create polygon $x $y [expr {$x+$v(size)}] [expr {$y+$v(size)}] \
- [expr {$x-$v(size)}] [expr {$y+$v(size)}]
+ $c create polygon $x $y [expr {$x + $v(size)}] [expr {$y + $v(size)}] \
+ [expr {$x - $v(size)}] [expr {$y + $v(size)}]
}
set w .ruler
-catch {destroy $w}
+destroy $w
toplevel $w
wm title $w "Ruler Demonstration"
wm iconname $w "ruler"
@@ -61,7 +61,7 @@ if {[winfo depth $c] > 1} {
$c create line 1c 0.5c 1c 1c 13c 1c 13c 0.5c -width 1
for {set i 0} {$i < 12} {incr i} {
- set x [expr {$i+1}]
+ set x [expr {$i + 1}]
$c create line ${x}c 1c ${x}c 0.6c -width 1
$c create line $x.25c 1c $x.25c 0.8c -width 1
$c create line $x.5c 1c $x.5c 0.7c -width 1
@@ -108,7 +108,7 @@ proc rulerNewTab {c x y} {
proc rulerSelectTab {c x y} {
upvar #0 demo_rulerInfo v
set v(x) [$c canvasx $x $v(grid)]
- set v(y) [expr {$v(top)+2}]
+ set v(y) [expr {$v(top) + 2}]
$c addtag active withtag current
eval "$c itemconf active $v(activeStyle)"
$c raise active
@@ -125,7 +125,7 @@ proc rulerSelectTab {c x y} {
proc rulerMoveTab {c x y} {
upvar #0 demo_rulerInfo v
- if {[$c find withtag active] == ""} {
+ if {[$c find withtag active] eq ""} {
return
}
set cx [$c canvasx $x $v(grid)]
@@ -137,13 +137,13 @@ proc rulerMoveTab {c x y} {
set cx $v(right)
}
if {($cy >= $v(top)) && ($cy <= $v(bottom))} {
- set cy [expr {$v(top)+2}]
+ set cy [expr {$v(top) + 2}]
eval "$c itemconf active $v(activeStyle)"
} else {
- set cy [expr {$cy-$v(size)-2}]
+ set cy [expr {($cy - $v(size)) - 2}]
eval "$c itemconf active $v(deleteStyle)"
}
- $c move active [expr {$cx-$v(x)}] [expr {$cy-$v(y)}]
+ $c move active [expr {$cx - $v(x)}] [expr {$cy - $v(y)}]
set v(x) $cx
set v(y) $cy
}
@@ -157,15 +157,15 @@ proc rulerMoveTab {c x y} {
# c - The canvas widget.
# x, y - The coordinates of the mouse.
-proc rulerReleaseTab c {
+proc rulerReleaseTab {c} {
upvar #0 demo_rulerInfo v
- if {[$c find withtag active] == {}} {
+ if {[$c find withtag active] eq ""} {
return
}
- if {$v(y) != $v(top)+2} {
+ if {$v(y) != ($v(top) + 2)} {
$c delete active
} else {
- eval "$c itemconf active $v(normalStyle)"
+ eval "$c itemconfigure active $v(normalStyle)"
$c dtag active
}
}