[rkward-cvs] SF.net SVN: rkward: [2191] branches/KDE4_port/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Fri Nov 9 00:29:46 UTC 2007


Revision: 2191
          http://rkward.svn.sourceforge.net/rkward/?rev=2191&view=rev
Author:   tfry
Date:     2007-11-08 16:29:46 -0800 (Thu, 08 Nov 2007)

Log Message:
-----------
Fix some of the worst bugs in the new data.frame editor implementation. Plenty bugs left

Modified Paths:
--------------
    branches/KDE4_port/rkward/core/rkvariable.cpp
    branches/KDE4_port/rkward/dataeditor/rkeditordataframe.cpp
    branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.cpp
    branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.h
    branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp
    branches/KDE4_port/rkward/dataeditor/rkvareditmodel.h
    branches/KDE4_port/rkward/dataeditor/twintable.cpp
    branches/KDE4_port/rkward/dataeditor/twintablemember.cpp

Modified: branches/KDE4_port/rkward/core/rkvariable.cpp
===================================================================
--- branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/core/rkvariable.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -274,6 +274,7 @@
 
 	for (int i = 0; i < getLength (); ++i) {
 		data->cell_states[i] = RKVarEditData::NA;
+#warning TODO initialize storage arrays (see old revisions of initeditdatatoemtpy)
 	}
 }
 

Modified: branches/KDE4_port/rkward/dataeditor/rkeditordataframe.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkeditordataframe.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/rkeditordataframe.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -74,10 +74,9 @@
 void RKEditorDataFrame::commonInit () {
 	RK_TRACE (EDITOR);
 
-	setPart (new RKEditorDataFramePart (parent (), this));
+	setPart (new RKEditorDataFramePart (this));
 	initializeActivationSignals ();
 
-	setCaption (object->getShortName ());
 	setWindowIcon (RKStandardIcons::iconForWindow (this));
 
 	open_chain = RKGlobals::rInterface ()->startChain (0);

Modified: branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -27,10 +27,10 @@
 #include "../rkward.h"
 #include "../debug.h"
 
-RKEditorDataFramePart::RKEditorDataFramePart (QObject *parent, RKEditorDataFrame* editor) : KParts::Part (parent) {
+RKEditorDataFramePart::RKEditorDataFramePart (RKEditorDataFrame* editor) : KParts::Part () {
 	RK_TRACE (EDITOR);
+
 	setComponentData (KGlobal::mainComponent ());
- 
 	RKEditorDataFramePart::editor = editor;
 	setWidget (editor);
 

Modified: branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.h
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.h	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/rkeditordataframepart.h	2007-11-09 00:29:46 UTC (rev 2191)
@@ -34,7 +34,7 @@
 protected:
 friend class RKEditorDataFrame;
 /** ctor. Protected, as this should only be created by an RKEditorDataFrame */
-	RKEditorDataFramePart (QObject *parent, RKEditorDataFrame* editor);
+	RKEditorDataFramePart (RKEditorDataFrame* editor);
 /** dtor */
 	~RKEditorDataFramePart ();
 public slots:

Modified: branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/rkvareditmodel.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -34,8 +34,8 @@
 	edit_blocks = 0;
 
 	addNotificationType (RObjectListener::ObjectRemoved);
-#warning TODO: listen for data changes
-#warning TODO: listen for meta changes
+	addNotificationType (RObjectListener::MetaChanged);
+	addNotificationType (RObjectListener::DataChanged);
 }
 
 RKVarEditModel::~RKVarEditModel () {
@@ -75,6 +75,27 @@
 	}
 }
 
+void RKVarEditModel::objectMetaChanged (RObject* changed) {
+	RK_TRACE (EDITOR);
+
+	int cindex = objects.indexOf (static_cast<RKVariable*> (changed));	// no check for isVariable needed. we only need to look up, if we have this object, and where.
+	if (cindex < 0) return;	// none of our buisiness
+
+	emit (dataChanged (index (0, cindex), index (trueRows (), cindex)));
+#warning TODO notify the meta model
+}
+
+void RKVarEditModel::objectDataChanged (RObject* object, const RObject::ChangeSet *changes) {
+	RK_TRACE (EDITOR);
+
+	int cindex = objects.indexOf (static_cast<RKVariable*> (object));	// no check for isVariable needed. we only need to look up, if we have this object, and where.
+	if (cindex < 0) return;	// none of our buisiness
+
+	RK_ASSERT (changes);
+
+	emit (dataChanged (index (changes->from_index, cindex), index (changes->to_index, cindex)));
+}
+
 void RKVarEditModel::doInsertColumns (int, int) {
 	RK_TRACE (EDITOR);
 	RK_ASSERT (false);	// should be implemented in a subclass, or never called
@@ -623,7 +644,7 @@
 
 // initialize the new object
 	for (int i = 0; i < initial_cols; ++i) {
-		RObject* child = df->createPendingChild (QString (), -1, false, false);
+		RObject* child = df->createPendingChild (df->validizeName (QString ()), -1, false, false);
 		RK_ASSERT (child->isVariable ());
 	}
 

Modified: branches/KDE4_port/rkward/dataeditor/rkvareditmodel.h
===================================================================
--- branches/KDE4_port/rkward/dataeditor/rkvareditmodel.h	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/rkvareditmodel.h	2007-11-09 00:29:46 UTC (rev 2191)
@@ -82,6 +82,9 @@
 	int trueRows () const { return (objects.isEmpty () ? 0 : objects[0]->getLength ()); };
 
 	virtual void restoreObject (RObject* object, RCommandChain* chain);
+
+	void objectMetaChanged (RObject* changed);
+	void objectDataChanged (RObject* object, const RObject::ChangeSet *changes);
 protected:
 friend class RKVarEditMetaModel;
 	QList<RKVariable*> objects;
@@ -89,7 +92,7 @@
 	/** very simple convenience function to return the number of true cols + trailing cols */
 	int apparentCols () const { return objects.size () + trailing_cols; };
 	/** very simple convenience function to return the number of true rows + trailing rows */
-	int apparentRows () const { return (trailing_rows + objects.isEmpty () ? 0 : objects[0]->getLength ()); };
+	int apparentRows () const { return (trailing_rows + (objects.isEmpty () ? 0 : objects[0]->getLength ())); };
 
 	/** Receives notifications of object removals. Takes care of removing the object from the list. */
 	void objectRemoved (RObject* object);

Modified: branches/KDE4_port/rkward/dataeditor/twintable.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/twintable.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -28,6 +28,7 @@
 
 #include "twintablemember.h"
 #include "rkvareditmodel.h"
+#include "../core/rcontainerobject.h"
 
 #include "../debug.h"
 
@@ -42,12 +43,12 @@
 
 	metaview = new TwinTableMember (splitter, this);
 	splitter->setResizeMode (metaview, QSplitter::KeepSize);
-	metaview->verticalHeader()->setResizeMode (QHeaderView::Fixed);
+	metaview->verticalHeader ()->setResizeMode (QHeaderView::Fixed);
 
 #warning TODO set item delegates
 	
 	dataview = new TwinTableMember (splitter, this);
-	dataview->verticalHeader()->setResizeMode (QHeaderView::Fixed);
+	dataview->verticalHeader ()->setResizeMode (QHeaderView::Fixed);
 	
 	dataview->horizontalHeader ()->hide ();
 #warning is this needed?
@@ -99,6 +100,9 @@
 
 	metaview->setMinimumHeight (metaview->horizontalHeader ()->height ());
 	metaview->setMaximumHeight (metaview->rowHeight (0) * 5 + metaview->horizontalHeader ()->height () + 5);
+	dataview->verticalHeader ()->setFixedWidth (metaview->verticalHeader ()->width ());
+
+	setCaption (model->getObject ()->getShortName ());
 }
 
 // TODO: handle situation when several entire cols are selected!

Modified: branches/KDE4_port/rkward/dataeditor/twintablemember.cpp
===================================================================
--- branches/KDE4_port/rkward/dataeditor/twintablemember.cpp	2007-11-08 23:23:14 UTC (rev 2190)
+++ branches/KDE4_port/rkward/dataeditor/twintablemember.cpp	2007-11-09 00:29:46 UTC (rev 2191)
@@ -18,6 +18,7 @@
 #include "twintablemember.h"
 
 #include <QKeyEvent>
+#include <QScrollBar>
 
 #include "celleditor.h"
 #include "twintable.h"
@@ -162,7 +163,8 @@
 	if (changing_scroll) return;
 	changing_scroll = true;
 	RK_ASSERT (twin);
-	twin->scrollContentsBy (dx, 0);
+	QTableView::scrollContentsBy (dx, dy);
+	twin->horizontalScrollBar ()->setValue (horizontalScrollBar ()->value ());
 	changing_scroll = false;
 }
 


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