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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Mar 22 17:30:57 UTC 2007


Revision: 1700
          http://svn.sourceforge.net/rkward/?rev=1700&view=rev
Author:   tfry
Date:     2007-03-22 10:30:57 -0700 (Thu, 22 Mar 2007)

Log Message:
-----------
Add 'type' attribute to <text>

Modified Paths:
--------------
    trunk/rkward/doc/en/writing_plugins_introduction.docbook
    trunk/rkward/rkward/plugin/rktext.cpp
    trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
    trunk/rkward/rkward/plugins/00saveload/import/source.xml

Modified: trunk/rkward/doc/en/writing_plugins_introduction.docbook
===================================================================
--- trunk/rkward/doc/en/writing_plugins_introduction.docbook	2007-03-22 10:28:14 UTC (rev 1699)
+++ trunk/rkward/doc/en/writing_plugins_introduction.docbook	2007-03-22 17:30:57 UTC (rev 1700)
@@ -1335,7 +1335,13 @@
 </varlistentry>
 <varlistentry>
 <term><text></term>
-<listitem>Shows the text enclosed in this tag in the GUI. Linebreaks are interpreted as hard linebreaks!</listitem>
+<listitem>Shows the text enclosed in this tag in the GUI. Linebreaks are interpreted as hard linebreaks! Attributes:
+	<variablelist>
+	<varlistentry>
+	<term><type></term>
+	<listitem>Type of the text. One of "normal", "warning" or "error". This influences the look of the text (optional, defaults to normal)</listitem>
+	</varlistentry>
+	</variablelist></listitem>
 </varlistentry>
 </variablelist>
 </section>

Modified: trunk/rkward/rkward/plugin/rktext.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rktext.cpp	2007-03-22 10:28:14 UTC (rev 1699)
+++ trunk/rkward/rkward/plugin/rktext.cpp	2007-03-22 17:30:57 UTC (rev 1700)
@@ -2,7 +2,7 @@
                           rktext.cpp  -  description
                              -------------------
     begin                : Sun Nov 10 2002
-    copyright            : (C) 2002, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2002, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -24,11 +24,15 @@
 #include <qdom.h>
 
 #include "../rkglobals.h"
+#include "../misc/xmlhelper.h"
 #include "../debug.h"
 
 RKText::RKText (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget) : RKComponent (parent_component, parent_widget) {
 	RK_TRACE (PLUGIN);
 
+	// get xml-helper
+	XMLHelper *xml = XMLHelper::getStaticHelper ();
+
 	// create layout and label
 	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
 
@@ -45,6 +49,19 @@
 		}
 	}
 
+	int type = xml->getMultiChoiceAttribute (element, "type", "normal;warning;error", 0, DL_INFO);
+	if (type != 0) {
+		QFont font = label->font ();
+		if (type == 1) {		// warning
+			label->setPaletteForegroundColor (QColor (255, 100, 0));
+			font.setWeight (QFont::Bold);
+		} else if (type == 2) {		// error
+			label->setPaletteForegroundColor (QColor (255, 0, 0));
+			font.setWeight (QFont::Bold);
+		}
+		label->setFont (font);
+	}
+
 	// strip final newline
 	initial_text.truncate (initial_text.length () -1);
 

Modified: trunk/rkward/rkward/plugins/00saveload/import/load_data.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2007-03-22 10:28:14 UTC (rev 1699)
+++ trunk/rkward/rkward/plugins/00saveload/import/load_data.xml	2007-03-22 17:30:57 UTC (rev 1700)
@@ -11,9 +11,9 @@
 	</logic>
 	<dialog label="Load an R data file">
 		<browser size="small" id="file" label="R data file to load" filter="*.RData" />
-		<text id="globalenv_warning">WARNING: This may overwrite existing objects in .GlobalEnv. Be sure to save your workspace, first.</text>
+		<text id="globalenv_warning" type="warning">WARNING: This may overwrite existing objects in .GlobalEnv. Be sure to save your workspace, first.</text>
 		<checkbox id="other_env" label="Save to specified environment" value="1" value_unchecked="0"/>
 		<saveobject id="envir" label="Environment to save to" initial="my.env"/>
-		<text id="otherenv_warning">WARNING: If the environment already exists, all objects inside it will be lost.</text>
+		<text id="otherenv_warning" type="warning">WARNING: If the environment already exists, all objects inside it will be lost.</text>
 	</dialog>
 </document>

Modified: trunk/rkward/rkward/plugins/00saveload/import/source.xml
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/source.xml	2007-03-22 10:28:14 UTC (rev 1699)
+++ trunk/rkward/rkward/plugins/00saveload/import/source.xml	2007-03-22 17:30:57 UTC (rev 1700)
@@ -17,7 +17,7 @@
 				<browser filter="*.R *.r" id="file" label="File name" />
 				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="chdir" label="Use directory of source file as working directory" />
 				<checkbox value_unchecked="FALSE" checked="false" value="TRUE" id="local" label="Run in a local environment" />
-				<text id="run_global_warning">WARNING: This may overwrite existing objects without prompting!</text>
+				<text id="run_global_warning" type="warning">WARNING: This may overwrite existing objects without prompting!</text>
 				<stretch/>
 			</tab>
 			<tab label="Output options" id="tab_further">


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