[rkward-cvs] SF.net SVN: rkward: [1428] trunk/rkward/rkward/plugins/plots

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Feb 22 18:31:40 UTC 2007


Revision: 1428
          http://svn.sourceforge.net/rkward/?rev=1428&view=rev
Author:   tfry
Date:     2007-02-22 10:31:39 -0800 (Thu, 22 Feb 2007)

Log Message:
-----------
Allow to specify customized defaults for all titles

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/plots/plot_options.php
    trunk/rkward/rkward/plugins/plots/plot_options.xml

Modified: trunk/rkward/rkward/plugins/plots/plot_options.php
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.php	2007-02-22 17:02:08 UTC (rev 1427)
+++ trunk/rkward/rkward/plugins/plots/plot_options.php	2007-02-22 18:31:39 UTC (rev 1428)
@@ -1,4 +1,17 @@
 <?
+function prepareLabel ($labelname) {
+	$quoted = (getRK_val ($labelname . "isquote") == "1");
+	$label = getRK_val ($labelname);
+	if ($label == "") {
+		$label = getRK_val ("default_" . $labelname);
+		$quoted = true;
+	}
+	if (($label != "") && ($quoted)) $label = "\"" . $label . "\"";
+	if ($label != "") $label = ", " . $labelname . "=" . $label;
+
+	return $label;
+}
+
 function preprocess () {
 }
 
@@ -34,12 +47,7 @@
 	}
 	$log .= getRK_val ("xlog");
 
-	$xlab = getRK_val ("xlab");
-	if (($xlab != "") && (getRK_val ("xlabisquote") == "1")) {
-		$xlab = "\"" . $xlab . "\"";
-	}
-	if ($xlab != "") $xlab = ", xlab=" . $xlab;
-
+	$xlab = prepareLabel ("xlab");
 	$xminvalue = getRK_val ("xminvalue");
 	$xmaxvalue = getRK_val ("xmaxvalue");
 	if (($xminvalue != "") || ($xmaxvalue != "")) {
@@ -60,11 +68,7 @@
 	}
 	$log .= getRK_val ("ylog");
 
-	$ylab = getRK_val ("ylab");
-	if (($ylab != "") && (getRK_val ("ylabisquote") == "1")) {
-		$ylab = "\"" . $ylab . "\"";
-	}
-	if ($ylab != "") $ylab = ", ylab=" . $ylab;
+	$ylab = prepareLabel ("ylab");
 	$yminvalue = getRK_val ("yminvalue");
 	$ymaxvalue = getRK_val ("ymaxvalue");
 	if (($yminvalue != "") || ($ymaxvalue != "")) {
@@ -88,19 +92,9 @@
 	//color of points / lines
 	$col = getRK_val ("pointcolor.code.printout");
 
-	//add a main (on top) to the plot
-	$main = getRK_val ("main");
-	if (($main != "") && (getRK_val ("mainisquote") == "1")) {
-		$main = "\"" . $main . "\"";
-	}
-	if ($main != "") $main = ", main=" . $main;
-	
-	//add a subtitle (at bottom) to the plot
-	$sub = getRK_val ("sub");
-	if (($sub != "") && (getRK_val ("subisquote") == "1")) {
-		$sub = "\"" . $sub . "\"";
-	}
-	if ($sub != "") $sub = ", sub=" . $sub;
+	// main and subtitle to the plot
+	$main = prepareLabel ("main");
+	$sub = prepareLabel ("sub");
 
 	//define the aspect y/x of the plot
 	$asp = getRK_val ("asp");

Modified: trunk/rkward/rkward/plugins/plots/plot_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.xml	2007-02-22 17:02:08 UTC (rev 1427)
+++ trunk/rkward/rkward/plugins/plots/plot_options.xml	2007-02-22 18:31:39 UTC (rev 1428)
@@ -8,6 +8,10 @@
 		
 		<external id="default_pointtype" default="" />
 		<external id="default_pointcolor" default="" />
+		<external id="default_main" default="" />
+		<external id="default_sub" default="" />
+		<external id="default_xlab" default="" />
+		<external id="default_ylab" default="" />
 		
 		<external id="allow_log" default="true" />
 		<external id="allow_type" default="true" />


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