#!../bltwish

source bltDemo.tcl

option add *Graph.Tile			bgTexture
option add *Label.Tile			bgTexture
option add *Frame.Tile			bgTexture
option add *Htext.Tile			bgTexture
option add *TileOffset			0

option add *HighlightThickness		0
option add *takeFocus			yes
option add *shadow			orange2
#option add *titleColor			orange2


set visual [winfo screenvisual .] 
if { $visual != "staticgray" } {
    option add *print.background yellow
    option add *quit.background red
}

image create photo bgTexture -file ./images/buckskin.gif
set remote {}
set graph .graph

option add *tile bgTexture
option add *psPreview		yes
option add *psLandscape		yes
option add *psMaxpect		yes
option add *psCenter		yes

htext .header -text {\
This is an example of the graph widget.  It displays two-variable data 
with assorted line attributes and symbols.  To create a postscript file 
"xy.ps", press the %%
    button $htext(widget).print -text print -command {
        puts stderr [time {.graph postscript output xy.ps}]
    } 
    $htext(widget) append $htext(widget).print
%% button.}

source graph1.tcl

htext .footer -text {Hit the %%
button $htext(widget).quit -text quit -command { 
    catch "send GraphConfig after 1 exit" 
    exit
} 

$htext(widget) append $htext(widget).quit 
%% button when you've seen enough.%%
label $htext(widget).logo -bitmap BLT
$htext(widget) append $htext(widget).logo -padx 20
%%}


table . \
    .header 0,0 -fill x \
    .graph 1,0  -fill both \
    .footer 2,0 -fill x

table configure . r0 r2 -resize none

wm min . 0 0


$graph element bind all <Enter> {
    %W legend activate [%W element get current]
}

$graph element bind all <Leave> {
    %W legend deactivate [%W element get current]
}

$graph marker bind Text <B2-Motion> {
    set coords [%W invtransform %x %y]
    catch { %W marker configure [%W marker get current] -coords $coords }
}

$graph marker bind fred <Enter> {
    set marker [%W marker get current]
    catch { %W marker configure $marker -fill green}
}

$graph marker bind fred <Leave> {
    set marker [%W marker get current]
    catch { %W marker configure $marker -fill ""}
}

# $graph marker create polygon \
#     -coords { 0 200  1 300  2 200  3 200  4 300  5 200  } \
#     -name xPolygon -linewidth 0 \
#     -fill red -outline  blue 

$graph marker create text -bindtags "fred Text all" -name Test\
      -text "Move with \nmouse button #2" -coords "3.0 150.0" \
	-anchor center  -bg red
