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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Feb 1 11:42:24 UTC 2007


Revision: 1273
          http://svn.sourceforge.net/rkward/?rev=1273&view=rev
Author:   tfry
Date:     2007-02-01 03:42:24 -0800 (Thu, 01 Feb 2007)

Log Message:
-----------
Specifying axis limits in plot-options plugin will work even for unspecified x/y variables

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/plugin/rkinput.cpp
    trunk/rkward/rkward/plugin/rkinput.h
    trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
    trunk/rkward/rkward/plugins/plots/plot_options.xml

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2007-02-01 10:35:37 UTC (rev 1272)
+++ trunk/rkward/ChangeLog	2007-02-01 11:42:24 UTC (rev 1273)
@@ -1,3 +1,5 @@
+- input elements can be made required 							TODO: don't list this, but document!
+- fixed problem with specifying y axis limits in several plugins
 - new plugin: import SPSS files								TODO: document
 - new documentation pages: console
 - improvements to distribution plot plugins

Modified: trunk/rkward/rkward/plugin/rkinput.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkinput.cpp	2007-02-01 10:35:37 UTC (rev 1272)
+++ trunk/rkward/rkward/plugin/rkinput.cpp	2007-02-01 11:42:24 UTC (rev 1273)
@@ -2,7 +2,7 @@
                           rkinput  -  description
                              -------------------
     begin                : Sat Mar 10 2005
-    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -37,12 +37,14 @@
 	addChild ("text", text = new RKComponentPropertyBase (this, false));
 	connect (text, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (textChanged ( RKComponentPropertyBase *)));
 
+	setRequired (xml->getBoolAttribute (element, "required", false, DL_INFO));
+	connect (requirednessProperty (), SIGNAL (valueChanged (RKComponentPropertyBase*)), this, SLOT (requirednessChanged (RKComponentPropertyBase*)));
+
 	// do all the layouting
 	QVBoxLayout *vbox = new QVBoxLayout (this, RKGlobals::spacingHint ());
 	QLabel *label = new QLabel (xml->getStringAttribute (element, "label", i18n ("Enter text"), DL_INFO), this);
 	vbox->addWidget (label);
 
-
 	textedit = new QTextEdit (this);
 	int size = xml->getMultiChoiceAttribute (element, "size", "small;medium;large", 1, DL_INFO);
 	int lheight = textedit->fontMetrics ().lineSpacing ();
@@ -75,13 +77,29 @@
 void RKInput::enabledChange (bool old) {
 	RK_TRACE (PLUGIN);
 
+	updateColor ();
+
+	RKComponent::enabledChange (old);
+}
+
+void RKInput::updateColor () {
+	RK_TRACE (PLUGIN);
+
 	if (isEnabled ()) {
-		textedit->setPaletteBackgroundColor (QColor (255, 255, 255));
+		if (isSatisfied ()) {
+			textedit->setPaletteBackgroundColor (QColor (255, 255, 255));
+		} else {
+			textedit->setPaletteBackgroundColor (QColor (255, 0, 0));
+		}
 	} else {
 		textedit->setPaletteBackgroundColor (QColor (200, 200, 200));
 	}
+}
 
-	RKComponent::enabledChange (old);
+void RKInput::requirednessChanged (RKComponentPropertyBase *) {
+	RK_TRACE (PLUGIN);
+
+	updateColor ();
 }
 
 void RKInput::textChanged (RKComponentPropertyBase *) {
@@ -91,6 +109,7 @@
 	updating = true;
 
 	textedit->setText (text->value ());
+	updateColor ();
 
 	updating = false;
 	changed ();
@@ -100,9 +119,18 @@
 	RK_TRACE (PLUGIN);
 
 	updating = true;
+
 	text->setValue (textedit->text ());
+	updateColor ();
+
 	updating = false;
 	changed ();
 }
 
+bool RKInput::isValid () {
+	RK_TRACE (PLUGIN);
+
+	return (!(text->value ().isEmpty ()));
+}
+
 #include "rkinput.moc"

Modified: trunk/rkward/rkward/plugin/rkinput.h
===================================================================
--- trunk/rkward/rkward/plugin/rkinput.h	2007-02-01 10:35:37 UTC (rev 1272)
+++ trunk/rkward/rkward/plugin/rkinput.h	2007-02-01 11:42:24 UTC (rev 1273)
@@ -2,7 +2,7 @@
                           rkinput  -  description
                              -------------------
     begin                : Sat Mar 10 2005
-    copyright            : (C) 2005, 2006 by Thomas Friedrichsmeier
+    copyright            : (C) 2005, 2006, 2007 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -40,13 +40,16 @@
 	RKComponentPropertyBase *text;
 	QString value (const QString &modifier) { return (text->value (modifier)); };
 	int type () { return ComponentInput; };
+	bool isValid ();
 public slots:
 	void textChanged ();
 	void textChanged (RKComponentPropertyBase *);
+	void requirednessChanged (RKComponentPropertyBase *);
 protected:
 /** Grey out input when disabled */
 	void enabledChange (bool old);
 private:
+	void updateColor ();
 	bool updating;
 	QTextEdit *textedit;
 };

Modified: trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp	2007-02-01 10:35:37 UTC (rev 1272)
+++ trunk/rkward/rkward/plugin/rkpluginsaveobject.cpp	2007-02-01 11:42:24 UTC (rev 1273)
@@ -45,9 +45,8 @@
 	vbox->addWidget (selector);
 
 	// initialize
-	updating = true;
-	selectionChanged ();
 	updating = false;
+	selectionChanged ();
 }
 
 RKPluginSaveObject::~RKPluginSaveObject () {

Modified: trunk/rkward/rkward/plugins/plots/plot_options.xml
===================================================================
--- trunk/rkward/rkward/plugins/plots/plot_options.xml	2007-02-01 10:35:37 UTC (rev 1272)
+++ trunk/rkward/rkward/plugins/plots/plot_options.xml	2007-02-01 11:42:24 UTC (rev 1273)
@@ -2,6 +2,31 @@
 <document>
 	<code file="plot_options.php" />
 	<logic>
+		<external id="xvar" default="" />
+		<external id="yvar" default="" />
+		<external id="allow_log" default="true" />
+		<external id="allow_type" default="true" />
+		<external id="allow_aspect" default="false" />
+		
+		<convert id="no_xvar" mode="equals" sources="xvar" standard="" />
+		<convert id="no_yvar" mode="equals" sources="yvar" standard="" />
+
+		<!-- If we do not have an xvar specified, it is not possible to specify one xlimit but not the other -->
+		<convert id="xmin_specified" mode="notequals" sources="xminvalue.text" standard="" />
+		<convert id="xmax_specified" mode="notequals" sources="xmaxvalue.text" standard="" />
+		<convert id="xmin_required" mode="and" sources="xmax_specified;no_xvar" />
+		<convert id="xmax_required" mode="and" sources="xmin_specified;no_xvar" />
+		<connect client="xminvalue.required" governor="xmin_required" />
+		<connect client="xmaxvalue.required" governor="xmax_required" />
+		<!-- Same for y -->
+		<convert id="ymin_specified" mode="notequals" sources="yminvalue.text" standard="" />
+		<convert id="ymax_specified" mode="notequals" sources="ymaxvalue.text" standard="" />
+		<convert id="ymin_required" mode="and" sources="ymax_specified;no_yvar" />
+		<convert id="ymax_required" mode="and" sources="ymin_specified;no_yvar" />
+		<connect client="yminvalue.required" governor="ymin_required" />
+		<connect client="ymaxvalue.required" governor="ymax_required" />
+
+
 		<convert id="xlabfilled" mode="notequals" sources="xlab.text" standard="" />
 		<connect client="xlabisexp.enabled" governor="xlabfilled" />
 
@@ -12,12 +37,6 @@
 		<connect client="ylog.visible" governor="allow_log"/>
 		<connect client="aspectratio.visible" governor="allow_aspect"/>
 		<connect client="pointtypepage.visible" governor="allow_type"/>
-
-		<external id="xvar" />
-		<external id="yvar" />
-		<external id="allow_log" default="true" />
-		<external id="allow_type" default="true" />
-		<external id="allow_aspect" default="false" />
 	</logic>
 	<dialog label="Default plot options" >
 		<tabbook>


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