Tk Library Source Code

Artifact [7eb99c3e4d]
Login

Artifact 7eb99c3e4d5491ec5840d22baa59cfa9a3fa557b:

Attachment "pc.diff" to ticket [750b78f0c0] added by stwo 2013-09-18 15:46:42.
Index: examples/plotchart/demo.tcl
==================================================================
--- examples/plotchart/demo.tcl
+++ examples/plotchart/demo.tcl
@@ -1,9 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 #  demo.tcl --
 #      Demo program for Plotchart
 #
-source d:/tcl-programs/plotchart/cvs-dir/plotchart.tcl
+
 package require Plotchart
 
 proc demo {code} {
     .cnv delete all
 

Index: examples/plotchart/editgraph.tcl
==================================================================
--- examples/plotchart/editgraph.tcl
+++ examples/plotchart/editgraph.tcl
@@ -1,13 +1,18 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # editgraph.tcl --
 #     Widget to edit data series graphically
 #
 #     Note:
 #     Not as elegant as could be with bindings via Plotchart itself
 #
-#package require Plotchart
-source plotchart.tcl
+package require Plotchart
 
 namespace eval ::Editgraph {
 
     variable graph
     variable endedit

Index: examples/plotchart/plotdemos10.tcl
==================================================================
--- examples/plotchart/plotdemos10.tcl
+++ examples/plotchart/plotdemos10.tcl
@@ -1,9 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos10.tcl --
 #     Test and demonstrate wind roses, bands in xy-plots, vertical text and label-dots
 #
-package require Plotchart 1.7
+package require Plotchart
 
 #
 # Wind rose diagram
 #
 pack [canvas .c1 -bg white]
@@ -40,8 +46,8 @@
 $p labeldot 3 10 "Point 1" w
 $p labeldot 6 20 "Point 2" e
 $p labeldot 9 10 "Point 3" n
 $p labeldot 9 30 "Point 4" s
 
-if { [package vsatisfies Tk 8.6] } {
+if { [package vsatisfies [package provide Tk] 8.6] } {
     $p vtext "Vertical axis label"
 }

Index: examples/plotchart/plotdemos11.tcl
==================================================================
--- examples/plotchart/plotdemos11.tcl
+++ examples/plotchart/plotdemos11.tcl
@@ -1,9 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos11.tcl --
 #     Test and demonstrate log X-Y plots and log-log plots
 #
-package require Plotchart 1.8
+package require Plotchart
 
 #
 # Log X plot of y = log(x)
 #
 pack [canvas .c1 -bg white]

Index: examples/plotchart/plotdemos12.tcl
==================================================================
--- examples/plotchart/plotdemos12.tcl
+++ examples/plotchart/plotdemos12.tcl
@@ -1,9 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos12.tcl --
 #     Test and demonstrate the interactive facilities of Plotchart
 #
-package require Plotchart 1.8
+package require Plotchart
 
 #
 # Procedure for showing the coordinates
 #
 proc showCoords {xcoord ycoord} {

Index: examples/plotchart/plotdemos13.tcl
==================================================================
--- examples/plotchart/plotdemos13.tcl
+++ examples/plotchart/plotdemos13.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos13.tcl --
 #     Check the performance of xy-plots with large amounts of data
 #
 package require Plotchart
 

Index: examples/plotchart/plotdemos14.tcl
==================================================================
--- examples/plotchart/plotdemos14.tcl
+++ examples/plotchart/plotdemos14.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos14.tcl --
 #     Test target diagrams
 #
 #     This type of diagrams is used when comparing a numerical model with
 #     measurements to determine the goodness-of-fit.
@@ -8,11 +14,10 @@
 #     Jason K. Joliff et al.
 #         Summary diagrams for coupled hydrodynamic-ecosystem model skill assessment
 #         Journal of Marine Systems 76 (2009) 64-82
 #         DOI: 10.1016/j.jmarsys.2008.05.014
 #
-source ../../plotchart.tcl
 package require Plotchart
 
 
 #
 # Target diagram

Index: examples/plotchart/plotdemos15.tcl
==================================================================
--- examples/plotchart/plotdemos15.tcl
+++ examples/plotchart/plotdemos15.tcl
@@ -1,15 +1,20 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos15.tcl --
 #     Demo adapted from the Wiki:
 #
 ##+##########################################################################
 #
 # Plotchart extension--3d ribbon graph
 # by Keith Vetter, April 2010
 #
 
-source ../../plotchart.tcl
 package require Plotchart
 
 set yscale [list 0 40 5]          ;# Y axis is miles along route
 set zscale [list 900 1300 100]    ;# Z axis is altitude
 set xscale [list 0 .1 .1]         ;# X axis is 3-d depth

Index: examples/plotchart/plotdemos16.tcl
==================================================================
--- examples/plotchart/plotdemos16.tcl
+++ examples/plotchart/plotdemos16.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos16.tcl --
 #     Test performance profiles
 #
 #     This type of diagrams is used when comparing a set of numerical methods
 #     for their performance on a set of solved problems. For the performance
@@ -9,11 +15,10 @@
 #     Desmond Higham and Nicholas Higham
 #         Matlab Guide
 #         SIAM, 2005, Philadephia
 #
 #
-source ../../plotchart.tcl
 package require Plotchart
 
 
 #
 # Performance profile

Index: examples/plotchart/plotdemos17.tcl
==================================================================
--- examples/plotchart/plotdemos17.tcl
+++ examples/plotchart/plotdemos17.tcl
@@ -1,10 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos17.tcl --
 #     Demonstrate how to configure the axes
 #
 #
-source ../../plotchart.tcl
 package require Plotchart
 
 
 #
 # Set up three plots

Index: examples/plotchart/plotdemos9.tcl
==================================================================
--- examples/plotchart/plotdemos9.tcl
+++ examples/plotchart/plotdemos9.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # plotdemos9.tcl --
 #     Test wind roses, bands in xy-plots, vertical text and label-dots
 #
 package require Plotchart
 

Index: examples/plotchart/rosenbrock.tcl
==================================================================
--- examples/plotchart/rosenbrock.tcl
+++ examples/plotchart/rosenbrock.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 #
 # rosenbrock.demo3.test.tcl --
 #   Plot the contours of the Rosenbrock function with
 #   Tklib/Plotchart.
 #   Test with a small screen.
@@ -8,11 +14,11 @@
 #   the axis values.
 #
 # Copyright 2008-2009 Michael Baudin
 #
 
-package require Plotchart 1.8
+package require Plotchart
 package require cmdline
 
 set width 500
 set height 500
 

Index: examples/plotchart/scope.tcl
==================================================================
--- examples/plotchart/scope.tcl
+++ examples/plotchart/scope.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # scope.tcl --
 #  Timing test of oscilloscope mode.
 #  Two traces are plotted.
 #  sin(x)
 #  square wave

Index: examples/plotchart/slidercnv.tcl
==================================================================
--- examples/plotchart/slidercnv.tcl
+++ examples/plotchart/slidercnv.tcl
@@ -1,9 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # slidercnv.tcl --
 #     Use the canvas as a way to store data
 #
-source plotchart.tcl
+
 package require Plotchart 2.0
 
 namespace eval demo {
 
 proc addCircle {p x y data} {

Index: examples/plotchart/test-convex.tcl
==================================================================
--- examples/plotchart/test-convex.tcl
+++ examples/plotchart/test-convex.tcl
@@ -1,6 +1,11 @@
-source plotchart.tcl
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 package require Plotchart
 
 proc convex {u v} {
 
     #expr {0.1*($u-$v)**2 - ($u + $v)/ sqrt(2.0) + 2.5}
@@ -20,11 +25,11 @@
 for {set i 0} { $i < 20 } { incr i } {
     lappend xv [expr {($i-10)*0.5}]
     lappend yv [expr {($i-10)*0.5}]
 }
 
-console show
+catch { console show }
 set zv {}
 foreach y $yv {
     set row {}
     foreach x $xv {
         lappend row [convex $x $y]

Index: examples/plotchart/test-histogram.tcl
==================================================================
--- examples/plotchart/test-histogram.tcl
+++ examples/plotchart/test-histogram.tcl
@@ -1,9 +1,14 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # test-histogram.tcl --
 #     Example of a histogram plot with filled background
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 400 -height 300 -bg white]
 
 set p [::Plotchart::createHistogram .c {0 100 20} {0 50 10}]

Index: examples/plotchart/test-spiralpie.tcl
==================================================================
--- examples/plotchart/test-spiralpie.tcl
+++ examples/plotchart/test-spiralpie.tcl
@@ -1,12 +1,17 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # test-spiralpie.tcl --
 #
 # Options:
 # -shownumbers
 # -sorted
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c1 -width 300 -height 300] \
      [canvas .c2 -width 300 -height 300]
 

Index: examples/plotchart/test_legend.tcl
==================================================================
--- examples/plotchart/test_legend.tcl
+++ examples/plotchart/test_legend.tcl
@@ -21,11 +21,11 @@
 
 wm geometry . 300x300+50+50
 
 pack $c_id -side top -fill both -expand 1
 
-console show
+catch { console show }
 
 set max 10
 set min -10
 set step 2
 set f 0

Index: examples/plotchart/test_stripchart.tcl
==================================================================
--- examples/plotchart/test_stripchart.tcl
+++ examples/plotchart/test_stripchart.tcl
@@ -1,13 +1,19 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # test_stripchart.tcl --
 #     Problem 3613718 on SF regarding stripcharts and custom labels
 #
 #     Reported by Donal
 #
 #     Use case: date/time
 
-source plotchart.tcl
+package require Plotchart
 
 pack [canvas .c]
 
 if { 0 } {
 #

Index: examples/plotchart/testdots.tcl
==================================================================
--- examples/plotchart/testdots.tcl
+++ examples/plotchart/testdots.tcl
@@ -1,15 +1,20 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testdots.tcl --
 #     Test the dash pattern for ticklines
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 700 -height 500 -background grey]
 
 set p1 [::Plotchart::createXYPlot    .c  {0.0 100.0 10.0} {0.0 20.0  5.0}]
 
 $p1 xticklines green dots1
 $p1 yticklines green dots5
 
-console show
+catch { console show }
 

Index: examples/plotchart/testmask.tcl
==================================================================
--- examples/plotchart/testmask.tcl
+++ examples/plotchart/testmask.tcl
@@ -1,10 +1,15 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testmask.tcl --
 #     Show that different plot windows within a single
 #     canvas produce the "right" set of masks
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 700 -height 500 -background grey]
 
 set p1 [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 19.9  5.0} -box {0 300 400 200}]
@@ -22,7 +27,7 @@
 ::Plotchart::plotstyle load bgtitle
 set p4 [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 19.9  5.0} -box {400 0 300 500}]
 
 $p4 title "Green title background"
 
-console show
+catch { console show }
 

Index: examples/plotchart/testmultiplexy.tcl
==================================================================
--- examples/plotchart/testmultiplexy.tcl
+++ examples/plotchart/testmultiplexy.tcl
@@ -1,12 +1,17 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testmultiplexy.tcl --
 #     Test multiple XY-plots in one canvas
 #
 #     Note:
 #     log-y-axis erases linear y-axis
 #
-source plotchart.tcl
 
 package require Plotchart
 
 grid [canvas .c -width 500 -height 400]
                                                                        ;#  x   y   w   h

Index: examples/plotchart/testmultixy.tcl
==================================================================
--- examples/plotchart/testmultixy.tcl
+++ examples/plotchart/testmultixy.tcl
@@ -1,13 +1,18 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testmultixy.tcl --
 #     Demonstrate how to plot a number of XY-plots above
 #     each other with a common x-axis
 #
 #     Note that the upper limit for the axis is slightly
 #     smaller than a full multiple of the step!
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 500 -height 500]
 
 set p1 [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 19.9  5.0} -box {0 300 500 200}]
@@ -17,7 +22,7 @@
 
 set p2 [::Plotchart::createXYPlot .c {0.0 100.0 ""}   {0.0 99.9 25.0} -axesbox [list $p1 nw 0 150 $width 150] -xlabels {}]
 set p3 [::Plotchart::createXYPlot .c {0.0 100.0 ""}   {0.0  1.9  0.5} -axesbox [list $p2 nw 0 150 $width 150] -xlabels {}]
 
 $p1 title "Multiple plots with one x-axis"
-console show
+catch { console show }
 

Index: examples/plotchart/testneedle.tcl
==================================================================
--- examples/plotchart/testneedle.tcl
+++ examples/plotchart/testneedle.tcl
@@ -1,9 +1,14 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testneedle.tcl --
 #     Introduce a new plot method: draw a "needle" for each data point
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c]
 set p [::Plotchart::createXYPlot .c {0.0 100.0 20.0} {-10.0 10.0 5.0}]
 

Index: examples/plotchart/testshadexy.tcl
==================================================================
--- examples/plotchart/testshadexy.tcl
+++ examples/plotchart/testshadexy.tcl
@@ -1,12 +1,17 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testshadexy.tcl --
 #     Demonstrate how to mark data with a shaded background
 #
 #     TODO:
 #     Command to get the (extreme) axis values from a plot
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 400 -height 300]
 
 set p [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {-5.0 5.0 2.5}]

Index: examples/plotchart/testtable.tcl
==================================================================
--- examples/plotchart/testtable.tcl
+++ examples/plotchart/testtable.tcl
@@ -1,9 +1,14 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testtable.tcl --
 #     Small program to test the table chart
 #
-source plotchart.tcl
 
 package require Plotchart
 
 pack [canvas .c  -bg white -height 300] \
      [canvas .c2 -bg white -height 300] \

Index: examples/plotchart/testxypie.tcl
==================================================================
--- examples/plotchart/testxypie.tcl
+++ examples/plotchart/testxypie.tcl
@@ -1,9 +1,14 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # testxypie.tcl --
 #     Test the combination of an xy-plot with two piecharts
 #
-source plotchart.tcl
 package require Plotchart
 
 pack [canvas .c -width 700 -height 500 -background grey]
 
 set p1 [::Plotchart::createXYPlot    .c  {0.0 100.0 10.0} {0.0 20.0  5.0}]
@@ -17,7 +22,7 @@
 $p1 title "XY-plot with embedded piecharts"
 
 $p3 plot {First 5 Second 6 Third 10 Fourth 2}
 $p4 plot {First 5 Second 6 Third 10 Fourth 2}
 
-console show
+catch { console show }
 

Index: examples/plotchart/xyplot_demo.tcl
==================================================================
--- examples/plotchart/xyplot_demo.tcl
+++ examples/plotchart/xyplot_demo.tcl
@@ -1,5 +1,11 @@
+#! /bin/sh
+# The next line restarts with tclsh \
+exec tclsh "$0" ${1+"$@"}
+
+package require Tk
+
 # xyplot_demo.tcl --
 #     Demonstration of the xyplot package
 #
 
 package require xyplot