[rkward-cvs] SF.net SVN: rkward: [977] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Dec 4 12:26:10 UTC 2006


Revision: 977
          http://svn.sourceforge.net/rkward/?rev=977&view=rev
Author:   tfry
Date:     2006-12-04 04:26:10 -0800 (Mon, 04 Dec 2006)

Log Message:
-----------
add comment headers to the sections of commands produced by plugins

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
    trunk/rkward/rkward/scriptbackends/phpbackend.cpp
    trunk/rkward/rkward/scriptbackends/phpbackend.h
    trunk/rkward/rkward/scriptbackends/scriptbackend.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-12-01 12:46:37 UTC (rev 976)
+++ trunk/rkward/ChangeLog	2006-12-04 12:26:10 UTC (rev 977)
@@ -1,3 +1,4 @@
+- add (comment) captions to the sections of commands produced by plugins
 - if a user command results in the output html file to be modified, auto-refresh output
 - add RMB menu to script editor windows
 - add options "clear" and "configure" in the console RMB menu, and the command log RMB menu
@@ -13,7 +14,7 @@
 - do not open the same script url twice (instead the corresponding window is raised on the second attempt)
 - fixed: when closing a detached script editor window, you would not be asked to save changes (if any)
 - fixed: occasional crash when re-attaching a script editor window
-- new translation: Greek, Catalan
+- new translations: Greek, Catalan
 - updated translations: German, French
 - added basic plot facility for ECDF (Empirical Cumulative Distribution Function) (menu plots)
 - added ptukey and qtukey (Studentized Range Distribution (Tukey)) (menu distributions)

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2006-12-01 12:46:37 UTC (rev 976)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2006-12-04 12:26:10 UTC (rev 977)
@@ -83,7 +83,7 @@
 	connect (backend, SIGNAL (haveError ()), this, SLOT (hide ()));
 	connect (backend, SIGNAL (haveError ()), this, SLOT (removeFromParent ()));
 	connect (backend, SIGNAL (haveError ()), this, SLOT (deleteLater ()));
-	if (!backend->initialize (dummy, code)) return;
+	if (!backend->initialize (dummy, code, parent_component == 0)) return;
 
 	connect (qApp, SIGNAL (aboutToQuit ()), this, SLOT (deleteLater ()));
 

Modified: trunk/rkward/rkward/scriptbackends/phpbackend.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.cpp	2006-12-01 12:46:37 UTC (rev 976)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.cpp	2006-12-04 12:26:10 UTC (rev 977)
@@ -42,7 +42,7 @@
 	destroy ();
 }
 
-bool PHPBackend::initialize (const QString &filename, RKComponentPropertyCode *code_property) {
+bool PHPBackend::initialize (const QString &filename, RKComponentPropertyCode *code_property, bool add_headings) {
 	RK_TRACE (PHP);
 
 	if (php_process && php_process->isRunning ()) {
@@ -73,6 +73,7 @@
 	callFunction ("include (\"" + filename + "\");", 0, Ignore);
 
 	PHPBackend::code_property = code_property;
+	PHPBackend::add_headings = add_headings;
 	return true;
 }
 
@@ -239,16 +240,20 @@
 				if (code_property) {
 					if (_output.isNull ()) _output = "";			// must not be null for the code property!
 					if (current_type == Preprocess) {
-						code_property->setPreprocess (retrieveOutput ());
+						if (add_headings) code_property->setPreprocess (i18n ("## Prepare\n") + retrieveOutput ());
+						else code_property->setPreprocess (retrieveOutput ());
 						resetOutput ();
 					} else if (current_type == Calculate) {
-						code_property->setCalculate (retrieveOutput ());
+						if (add_headings) code_property->setCalculate (i18n ("## Compute\n") + retrieveOutput ());
+						else code_property->setCalculate (retrieveOutput ());
 						resetOutput ();
 					} else if (current_type == Printout) {
-						code_property->setPrintout (retrieveOutput ());
+						if (add_headings) code_property->setPrintout (i18n ("## Print result\n") + retrieveOutput ());
+						else code_property->setPrintout (retrieveOutput ());
 						resetOutput ();
 					} else if (current_type == Cleanup) {
-						code_property->setCleanup (retrieveOutput ());
+						if (add_headings) code_property->setCleanup (i18n ("## Clean up\n") + retrieveOutput ());
+						else code_property->setCleanup (retrieveOutput ());
 						resetOutput ();
 					} else {
 						emit (commandDone (current_flags));

Modified: trunk/rkward/rkward/scriptbackends/phpbackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/phpbackend.h	2006-12-01 12:46:37 UTC (rev 976)
+++ trunk/rkward/rkward/scriptbackends/phpbackend.h	2006-12-04 12:26:10 UTC (rev 977)
@@ -40,7 +40,7 @@
 
 	~PHPBackend ();
 
-	bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0);
+	bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0, bool add_headings=true);
 	void destroy ();
 	
 	void preprocess (int flags) { callFunction ("preprocess ();", flags, Preprocess); };

Modified: trunk/rkward/rkward/scriptbackends/scriptbackend.h
===================================================================
--- trunk/rkward/rkward/scriptbackends/scriptbackend.h	2006-12-01 12:46:37 UTC (rev 976)
+++ trunk/rkward/rkward/scriptbackends/scriptbackend.h	2006-12-04 12:26:10 UTC (rev 977)
@@ -47,8 +47,9 @@
 /** initialize backend
 @param filename Filename of the template to work on
 @param code_property If you supply a pointer to an RKComponentPropertyCode, The backend will directly set values for this property in response to calls to preproces (), calculate (), printout (), and cleanup ().
+ at param add_headings (Only meaningful, if code_property is not 0). If set to true, heading comments will be added to each section of the code (e.g. "## Do calculations")
 @returns true on successful initialization, false on errors */
-	virtual bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0) = 0;
+	virtual bool initialize (const QString &filename, RKComponentPropertyCode *code_property=0, bool add_headings=true) = 0;
 	virtual void destroy () = 0;
 	
 	virtual void preprocess (int flags) = 0;
@@ -71,6 +72,7 @@
 	void haveError ();
 protected:
 	RKComponentPropertyCode *code_property;
+	bool add_headings;
 	QString _output;
 	bool busy;
 };


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