File: canvas.tcl

package info (click to toggle)
nam 1.15-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 29,240 kB
  • ctags: 2,746
  • sloc: cpp: 17,338; tcl: 10,655; sh: 2,997; ansic: 1,252; makefile: 139; perl: 66
file content (66 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
puts "sourcing canvas.tcl"

set oblist ""

proc fillrectangle {x y x2 y2 col t} {
    global canv oblist
    set id [$canv create restangle $x $y $x2 $y2 -fill $col]
    if {$t==1} {
	lappend oblist $id
    }
}

proc drawoval {x y x2 y2 col t} {
    global canv oblist
    set id [$canv create restangle $x $y $x2 $y2]
    if {$t==1} {
	lappend oblist $id
    }
}

proc drawpolygon args {
    global canv oblist
    set col [lindex $args 0]
    set t [lindex $args 1]
    set id [eval "$canv create polygon [lrange $args 2 end] -outline $col -fill \"\""]
    if {$t==1} {
        lappend oblist $id
    }
}

proc fillpolygon args {
    global canv oblist
    set col [lindex $args 0]
    set t [lindex $args 1]
    set id [eval "$canv create polygon [lrange $args 2 end] -outline $col"]
    if {$t==1} {
        lappend oblist $id
    }
}

proc drawstring {font str x y t} {
    global canv oblist
    set id [$canv create text $x $y -text $str]
    if {$t==1} {
        lappend oblist $id
    }
}

proc drawline {x y x2 y2 col t} {
    global canv oblist
    set id [$canv create line $x $y $x2 $y2]
    if {$t==1} {
        lappend oblist $id
    }
}

proc update_display {} {
    update
}

proc clearobjs {} {
    global canv oblist
    foreach obj $oblist {
	$canv delete $obj
    }
}