A patch for Tkmaxima/omplotdata



Hi,
could somebody please apply the patches attached at the end?

They fix two things:

1- On 2004-03-28 Vadim solved bugs #694179 and #915212 (openmath's plot
menu did not appear in some window managers) by replacing tk buttons by
a tk menu. He did the changes in interfaces/xmaxima/Tkmaxima/Plotconf.tcl
The problem is that some other buttons are also added in
interfaces/xmaxima/Tkmaxima/Plotdf.tcl so that file must be modified to
replace the buttons by new entries in the menu.
I also changed the name of option doTrajectoryAt by trajectory_at, to
avoid case problems and to be consistent with other options names.

2- The functions in omplotdata accept a lot of options, but the
current implementation of omplotdata accepts just one file and no
command line options. With a very simple change to
plotting/footer.tcl, and fixing a tcl bug in
interfaces/xmaxima/Tkmaxima/Plotconf.tcl omplotdata will accept
options. Try for instance:

(%i1) plot2dOpen(sin(x),[x,0,6]);
(%o1)                                  0
(%i2) quit();

If you were running maxima from the console, you should have a file
maxout.openmath You can view the plot data, with various different
options. For instance:

omplotdata maxout.openmath -yradius 2 -xaxislabel "x" -yaxislabel "sin(x)" -labelposition "0 0" -linecolors "{red}" -plotpoints 1

best regards,
Jaime


Index: Plotdf.tcl
===================================================================
RCS file: /cvsroot/maxima/maxima/interfaces/xmaxima/Tkmaxima/Plotdf.tcl,v
retrieving revision 1.6
diff -u -r1.6 Plotdf.tcl
--- Plotdf.tcl	13 Oct 2004 12:08:58 -0000	1.6
+++ Plotdf.tcl	27 Oct 2004 19:22:00 -0000
@@ -33,7 +33,7 @@
     {parameters "" "List of parameters and values eg k=3,l=7+k"}
     {sliders "" "List of parameters ranges k=3:5,u"}
     {linecolors { green black  brown gray black} "colors to use for lines in data plots"}
-    {doTrajectoryAt "" "Place to calculate trajectory"}
+    {trajectory_at "" "Place to calculate trajectory"}
     {linewidth "1.0" "Width of integral lines" }
     {nolines 0 "If not 0, plot points and nolines"}
     {bargraph 0 "If not 0 this is the width of the bars on a bar graph" }
@@ -60,22 +60,22 @@
 	wm iconname $top "DF plot"
 	#    wm geometry $top 750x700-0+20
     }
-    set wb $w.buttons
+    set wb $w.plotmenu
     makeLocal $win buttonFont
     label $w.msg  -wraplength 600 -justify left -text [mc "A direction field plotter by William Schelter"] -font $buttonFont
 
-    button $wb.integrate -text [mc "Integrate"] -command "setForIntegrate $w" -font $buttonFont
-    setBalloonhelp $win $wb.integrate [mc {Causes clicking on the  plot with the left mouse button at a point, to draw a trajectory passing through that point.   Under Config there is an entry box which allows entering exact x,y coordinates, and which also records the place of the last trajectory computed.}]
+    $wb.m add command -label "Integrate" -command "setForIntegrate $w" -font $buttonFont
+    ## setBalloonhelp $win $wb.integrate [mc {Causes clicking on the  plot with the left mouse button at a point, to draw a trajectory passing through that point.   Under Config there is an entry box which allows entering exact x,y coordinates, and which also records the place of the last trajectory computed.}]
 
-    button $wb.plotversust -text [mc "Plot Versus t"] -command "plotVersusT $w" -font $buttonFont
-    setBalloonhelp $win $wb.plotversust [mc "Plot the x and y values for the  last trajectory versus t."]
+    $wb.m add command -label "Plot Versus t" -command "plotVersusT $w" -font $buttonFont
+    ## setBalloonhelp $win $wb.plotversust [mc "Plot the x and y values for the  last trajectory versus t."]
 
 
     setForIntegrate $w
-    pack $wb.integrate -side top -expand 1 -fill x
-    pack $wb.plotversust -side top -expand 1 -fill x
     # pack $w.msg -side top
     pack $w
+    place $wb -in $w -x 2 -y 2 -anchor nw
+    raise $wb
     return $win
 }
 
@@ -157,11 +157,11 @@
     makeLocal $win xradius yradius c tstep  nsteps direction linewidth tinitial versus_t linecolors
     linkLocal $win didLast trajectoryStarts
     set rtosx rtosx$win ; set rtosy rtosy$win
-    oset $win doTrajectoryAt [format "%.10g  %.10g" $x0 $y0]
+    oset $win trajectory_at [format "%.10g  %.10g" $x0 $y0]
     lappend trajectoryStarts [list $x0 $y0]
 
     set didLast {}
-    # puts "doing at $doTrajectoryAt"
+    # puts "doing at $trajectory_at"
     set steps $nsteps
     if { "$tstep" == "" } {
 	set h [expr {[vectorlength $xradius $yradius] / 200.0}]
@@ -462,7 +462,7 @@
 	set data ""
 	
     }
-    makeLocal $win c dxdt dydt tinitial nsteps xfun     doTrajectoryAt parameters
+    makeLocal $win c dxdt dydt tinitial nsteps xfun     trajectory_at parameters
 
     setUpTransforms $win 1.0
     setXffYff $dxdt $dydt $parameters
@@ -470,8 +470,8 @@
     setForIntegrate $win
     oset $win curveNumber -1
     drawDF $win $tinitial
-    if { "$doTrajectoryAt" != "" } {
-	eval doIntegrate $win  $doTrajectoryAt
+    if { "$trajectory_at" != "" } {
+	eval doIntegrate $win  $trajectory_at
     }
     set xfundata ""
     foreach v [sparseListWithParams $xfun {x y t} $parameters ] {
@@ -509,11 +509,11 @@
 	mkentry $wb1.$w [oloc $win $w] $w $buttonFont
 	pack $wb1.$w -side bottom -expand 1 -fill x
     }
-    mkentry $wb1.doTrajectoryAt [oloc $win doTrajectoryAt] \
+    mkentry $wb1.trajectory_at [oloc $win trajectory_at] \
 	"Trajectory at" $buttonFont
-    bind $wb1.doTrajectoryAt.e <KeyPress-Return> \
-	"eval doIntegrate $win \[oget $win doTrajectoryAt\] "
-    pack  $wb1.doTrajectoryAt   $frdydx    -side bottom -expand 1 -fill x
+    bind $wb1.trajectory_at.e <KeyPress-Return> \
+	"eval doIntegrate $win \[oget $win trajectory_at\] "
+    pack  $wb1.trajectory_at   $frdydx    -side bottom -expand 1 -fill x
     if { "[oget $win dydx]" != "" } { swapChoose $win dydx $frdydx }
     setForIntegrate $win
 }
Index: Plotconf.tcl
===================================================================
RCS file: /cvsroot/maxima/maxima/interfaces/xmaxima/Tkmaxima/Plotconf.tcl,v
retrieving revision 1.9
diff -u -r1.9 Plotconf.tcl
--- Plotconf.tcl	13 Oct 2004 12:08:58 -0000	1.9
+++ Plotconf.tcl	27 Oct 2004 19:22:14 -0000
@@ -1097,7 +1097,7 @@
     if { "[lindex $command 0]" == "plot2d" } {
 	lappend command -xfun {}
     }
-    foreach v $args { [lappend command $v] }
+    foreach v $args { lappend command $v }
     eval $command
     #eval [lindex [lindex $data 0] 0] -xfun [list {}] -data [list [lindex $data 0]] $args
 }
Index: footer.tcl
===================================================================
RCS file: /cvsroot/maxima/maxima/plotting/footer.tcl,v
retrieving revision 1.1
diff -u -r1.1 footer.tcl
--- footer.tcl	21 Mar 2004 18:45:21 -0000	1.1
+++ footer.tcl	27 Oct 2004 19:22:58 -0000
@@ -2,5 +2,14 @@
 cMAXINITBeforeIni
 cMAXINITAfterIni 
 
-omPlotAny [exec cat [lindex $argv 0]]
+set omcommand omPlotAny
+if { [lindex $argv 0] == "plotdf" } {
+    lappend omcommand "plotdf"
+} else {
+    lappend omcommand [exec cat [lindex $argv 0]]
+}
+for {set i 1} {$i<[llength $argv]} {incr i} {
+    lappend omcommand [lindex $argv $i]
+}
 
+eval $omcommand