File: graph3.tcl

package info (click to toggle)
blt 2.4m-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,316 kB
  • ctags: 7,778
  • sloc: ansic: 68,187; tcl: 12,491; sh: 1,918; makefile: 709; csh: 25
file content (109 lines) | stat: -rwxr-xr-x 3,042 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!../src/bltwish

package require BLT
# --------------------------------------------------------------------------
# Starting with Tcl 8.x, the BLT commands are stored in their own 
# namespace called "blt".  The idea is to prevent name clashes with
# Tcl commands and variables from other packages, such as a "table"
# command in two different packages.  
#
# You can access the BLT commands in a couple of ways.  You can prefix
# all the BLT commands with the namespace qualifier "blt::"
#  
#    blt::graph .g
#    blt::table . .g -resize both
# 
# or you can import all the command into the global namespace.
#
#    namespace import blt::*
#    graph .g
#    table . .g -resize both
#
# --------------------------------------------------------------------------
if { $tcl_version >= 8.0 } {
    namespace import blt::*
    namespace import -force blt::tile::*
}
source scripts/demo.tcl

set graph .graph

source scripts/stipples.tcl

set visual [winfo screenvisual .]
if { $visual != "staticgray" && $visual != "grayscale" } {
    option add *Button.Background		red
    option add *TextMarker.Foreground	black
    option add *TextMarker.Background	yellow
    option add *LineMarker.Foreground	black
    option add *LineMarker.Background	yellow
    option add *PolyMarker.Fill		yellow2
    option add *PolyMarker.Outline	""
    option add *PolyMarker.Stipple	fdiagonal1
    option add *activeLine.Color	red4
    option add *activeLine.Fill		red2
    option add *Element.Color		purple
}

option add *HighlightThickness		0

image create photo bgTexture -file ./images/chalk.gif

option add *Text.font			-*-times*-bold-r-*-*-18-*-*
option add *header.font			-*-times*-medium-r-*-*-18-*-*
option add *footer.font			-*-times*-medium-r-*-*-18-*-*

option add *Tile		bgTexture
option add *Button.Tile		""

text .header -wrap word -width 0 -height 3

set text {
This is an example of a bitmap marker.  Try zooming in on 
a region by clicking the left button, moving the pointer, 
and clicking again.  Notice that the bitmap scales too. 
To restore the last view, click on the right button.  
}

regsub -all "\n" $text "" text
.header insert end "$text\n"
.header configure -state disabled

htext .footer -text {Hit the %%
    set im [image create photo -file ./images/stopsign.gif]
    button $htext(widget).quit -image $im -command { 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 
%%}

source scripts/graph3.tcl

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

table configure . r0 r2 -resize none

source scripts/ps.tcl

bind .graph <Shift-ButtonPress-1> { 
    MakePsLayout .graph
}

trace variable changed w GraphChanged

proc GraphChanged { args } {
    global changed
    trace vdelete changed w GraphChanged
    PsDialog .graph
}

if 0 {
set printer [printer open [lindex [printer names] 0]]
after 2000 {
	.graph print2 $printer
}
}