use subs qw/ruler_make_tab ruler_move_tab ruler_new_tab ruler_release_tab
ruler_select_tab/;
use vars qw/$TOP/;
sub ruler {
# Create a canvas demonstration consisting of a ruler displays a ruler
# with tab stops that can be set individually.
my($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text => ['This canvas widget shows a mock-up of a ruler. You can create tab stops by dragging them out of the well to the right of the ruler. You can also drag existing tab stops. If you drag a tab stop far enough up or down so that it turns dim, it will be deleted when you release the mouse button.', qw/-wraplength 5i/],
-title => 'Ruler Demonstration',
-iconname => 'ruler',
);
my $c = $TOP->Canvas(qw/-width 14.8c -height 2.5c/);
$c->pack(qw/-side top -fill x/);
my %rinfo; # ruler information hash
$rinfo{grid} = '.25c';
$rinfo{left} = $c->fpixels('1c');
$rinfo{right} = $c->fpixels('13c');
$rinfo{top} = $c->fpixels('1c');
$rinfo{bottom} = $c->fpixels('1.5c');
$rinfo{size} = $c->fpixels('.2c');
$rinfo{normalStyle} = [qw/-fill black/];
if ($TOP->depth > 1) {
$rinfo{activeStyle} = [qw/-fill red -stipple/ => undef];