gnocl::ruler

WJG (22/05/09) The Gtk Widget is a legacy of the GIMP image processing package and so, as expected, there are a few legacy widgets which need to be implemented in Gnocl to claim the status of complete support. One of these is the creation of horizontal and vertical rulers to be used in conjuction with drawing objects for editing purposes. Here's a sample screenshot and the test script.

http://wjgiddings.googlepages.com/Screenshot-rulerTest.tcl.png

#---------------
# Author:   William J Giddings
# Date:     07/05/09
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl
package require GnoclCanvas

# build UI components
set bar [gnocl::statusBar]

set Vrul [gnocl::ruler -orientation vertical -metric inches]
set Hrul [gnocl::ruler -orientation horizontal -metric pixels]
set can [gnocl::canvas -background white -onMotion {$bar push "%x %y"} ]

set tab [gnocl::table -homogeneous 0]
$tab addRow [list "" $Hrul] -expand {1 0}
$tab addRow [list $Vrul ] -expand { 0 1}
$tab add $can 1 1

set box [gnocl::box -orientation vertical]
$box add $tab -fill {1 1} -expand 1
$box add $bar

gnocl::window -child $box -widthRequest 320 -heightRequest 200
gnocl::mainLoop