#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

load ../src/gnocl.so

set canvas [gnocl::canvas -antialiased 1 -width 500 -height 500\
      -scrollRegion {0 0 500 500} -scrollbar never]

# anchor
set x 100
set y 50
foreach el {center N NW NE S SW SE W E} {
   $canvas create text [list $x $y] -label "anchor $el" -anchor $el
   $canvas create ellipse [list $x $y 2] -centerRadius 1 -fill red
   incr y 30
}

#fill
set x 250
set y 100
foreach el {black blue red darkgreen} {
   $canvas create text [list $x $y] -label $el -fill $el -anchor W
   incr y 20
}

set x 300
set y 200
foreach {col txt} {blue rod green plau red krün} {
   $canvas create text [list $x $y] -label $txt -fill $col -anchor W
   incr y 20
}

# Umlaute
$canvas create text {250 410} -label "FIXME: i18n does not work" -fill red
$canvas create text {250 430} -label "äöüÄÖÜß" -fill $col -anchor center

#offset
set x 100
set y 350
foreach {dx dy} {0 0 -30 -30 30 30 } {
   $canvas create ellipse [list $x $y 2] -centerRadius 1 -fill red
   $canvas create text [list $x $y] -label "offset $dx $dy (does not work?)" \
         -anchor W -fill blue -offset [list $dx $dy]
   incr y 20
}

if { $argc == 1 } {
   set win [gnocl::plug [lindex $argv 0] -child $canvas]
} else {
   set win [gnocl::window -child $canvas]
}

gnocl::mainLoop

