[rkward-cvs] SF.net SVN: rkward: [1679] trunk/rkward/rkward/plugins
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Mar 21 12:29:42 UTC 2007
Revision: 1679
http://svn.sourceforge.net/rkward/?rev=1679&view=rev
Author: tfry
Date: 2007-03-21 05:29:41 -0700 (Wed, 21 Mar 2007)
Log Message:
-----------
Change the way embedded grid works.
This is not entirely good, yet, as the grid options are not properly enabled / disabled in plot_options.#
Will look into solving this from C++.
Explanatory comments will follow later, when I have more time.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/distributions/plot_beta_distribution.php
trunk/rkward/rkward/plugins/plots/plot_options.php
trunk/rkward/rkward/plugins/plots/plot_options.xml
trunk/rkward/rkward/plugins/x11device/grid.php
trunk/rkward/rkward/plugins/x11device/grid.xml
Modified: trunk/rkward/rkward/plugins/distributions/plot_beta_distribution.php
===================================================================
--- trunk/rkward/rkward/plugins/distributions/plot_beta_distribution.php 2007-03-21 07:25:54 UTC (rev 1678)
+++ trunk/rkward/rkward/plugins/distributions/plot_beta_distribution.php 2007-03-21 12:29:41 UTC (rev 1679)
@@ -3,9 +3,6 @@
}
function calculate () {
- global $gridoptions;
- $gridoptions = "";
- if (getRK_val ("plotoptions.add_grid")) $gridoptions = "try(" . getRK_val ("plotoptions.grid_options.code.printout") . ")";
}
function printout () {
@@ -23,7 +20,7 @@
}
function doPrintout ($final) {
- global $gridoptions;
+ $plot_adds = getRK_val ("plotoptions.code.calculate");
$fun = getRK_val ("function");
$log_option = "";
@@ -48,9 +45,9 @@
$n = getRK_val ("n");
$min = getRK_val ("min");
$max = getRK_val ("max");
- $a = getRK_val ("a");
- $b = getRK_val ("b");
- $ncp = getRK_val ("ncp");
+ $a = getRK_val ("a");
+ $b = getRK_val ("b");
+ $ncp = getRK_val ("ncp");
if ($final) { ?>
rk.header ("Beta <? echo ($label); ?> function", list ("Number of Observations", "<? echo ($n); ?>", "Lower quantile", "<? echo ($min); ?>","Upper quantile", "<? echo ($max); ?>", "Shape1", "<? echo ($a); ?>", "Shape2", "<? echo ($b); ?>", "Non-cetrality parameter", "<? echo ($ncp); ?>", "Scaling", "<? echo ($log_label); ?>"<? echo ($tail_tag); ?>, "Function", "<? echo ($fun); ?>"));
@@ -59,9 +56,11 @@
<? }
?>
try (curve (<? echo ($fun); ?> (x, shape1 = <? echo ($a); ?>, shape2 = <? echo ($b); ?>, ncp = <? echo ($ncp); ?><? echo ($log_option) ?><? echo ($lower_tag); ?>), from=<? echo ($min); ?>, to=<? echo ($max); ?>, n=<? echo ($n); ?><? getRK ("plotoptions.code.printout"); ?>))
-<? echo ($gridoptions); ?>
+<? if (!empty ($plot_adds)) {
+ echo ("\n\t" . strtr ($plot_adds, array ("\n" => "\n\t")));
+ }
-<? if ($final) { ?>
+ if ($final) { ?>
rk.graph.off ()
<? }
}
Modified: trunk/rkward/rkward/plugins/plots/plot_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.php 2007-03-21 07:25:54 UTC (rev 1678)
+++ trunk/rkward/rkward/plugins/plots/plot_options.php 2007-03-21 12:29:41 UTC (rev 1679)
@@ -16,6 +16,9 @@
}
function calculate () {
+ if (getRK_val ("grid_enable") == "true") {
+ getRK ("grid_options.code.printout");
+ }
}
function printout () {
Modified: trunk/rkward/rkward/plugins/plots/plot_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.xml 2007-03-21 07:25:54 UTC (rev 1678)
+++ trunk/rkward/rkward/plugins/plots/plot_options.xml 2007-03-21 12:29:41 UTC (rev 1679)
@@ -62,11 +62,9 @@
<connect client="pointcolor.default_color" governor="default_pointcolor" />
<external id="allow_grid" default="false" />
- <connect client="add_grid.visible" governor="allow_grid"/>
<connect client="tab_grid.visible" governor="allow_grid"/>
- <convert id="tab_grid_enable" sources="allow_grid;add_grid.state" mode="and" standard="true"/>
- <connect client="tab_grid.enabled" governor="tab_grid_enable" />
- <set id="grid_options.is_embed" to="true"/>
+ <convert id="grid_enable" sources="tab_grid.visible;add_grid.state" mode="and"/>
+ <connect client="grid_options.enabled" governor="grid_enable" />
</logic>
<dialog label="Default plot options" >
<tabbook>
@@ -131,7 +129,6 @@
<option value="S" label="Step-function plots: the right edge defines the point" />
</dropdown>
<embed id="pointcolor" component="rkward::color_chooser" label="Color" />
- <checkbox id="add_grid" label="Add Grid to the plot" value="1" value_unchecked="0"/>
<stretch/>
</tab>
<tab id="aspectratio" label="Aspect ratio y/x">
@@ -143,6 +140,7 @@
</column>
</tab>
<tab id="tab_grid" label="Grid">
+ <checkbox id="add_grid" label="Add Grid to the plot" value="1" value_unchecked="0"/>
<embed id="grid_options" component="rkward::x11grid"/>
</tab>
</tabbook>
Modified: trunk/rkward/rkward/plugins/x11device/grid.php
===================================================================
--- trunk/rkward/rkward/plugins/x11device/grid.php 2007-03-21 07:25:54 UTC (rev 1678)
+++ trunk/rkward/rkward/plugins/x11device/grid.php 2007-03-21 12:29:41 UTC (rev 1679)
@@ -1,12 +1,14 @@
<?php
function preprocess () {
+ if (getRK_val ("is_embed")) { ?>
+dev.set (<? getRK ("devnum"); ?>)
+<? }
}
+
function calculate () {
- global $gridoptions;
- global $is_embed;
+}
- $is_embed = getRK_val ("is_embed");
-
+function printout () {
$nx = getRK_val ("nx");
if ($nx == "other") $gridoptions = 'nx=' . getRK_val ("nx_cells");
else $gridoptions = 'nx=' . $nx;
@@ -23,16 +25,8 @@
if ($lty != "") $gridoptions .= ", lty=\"{$lty}\"";
if (!getRK_val("equilogs")) $gridoptions .= ', equilogs=FALSE';
- if ($is_embed=="false") {
?>
-dev.set (<? getRK ("devnum"); ?>)
grid(<? echo ($gridoptions); ?>);
<?
- }
}
-function printout () {
- global $gridoptions;
- global $is_embed;
- if ($is_embed=="true") echo ("grid(" . $gridoptions . ")");
-}
?>
\ No newline at end of file
Modified: trunk/rkward/rkward/plugins/x11device/grid.xml
===================================================================
--- trunk/rkward/rkward/plugins/x11device/grid.xml 2007-03-21 07:25:54 UTC (rev 1678)
+++ trunk/rkward/rkward/plugins/x11device/grid.xml 2007-03-21 12:29:41 UTC (rev 1679)
@@ -4,7 +4,9 @@
<help file="grid.rkh" />
<logic>
<external id="devnum"/>
- <external id="is_embed" default="false"/>
+ <external id="context" default=""/>
+ <!-- if we're not in the X11 context, we're embedded -->
+ <convert id="is_embed" mode="equals" sources="context" standard=""/>
<convert id="nx_other" sources="nx.string" mode="equals" standard="other"/>
<connect client="nx_cells.enabled" governor="nx_other"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list