[rkward-cvs] SF.net SVN: rkward:[4199] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Mar 27 08:39:47 UTC 2012
Revision: 4199
http://rkward.svn.sourceforge.net/rkward/?rev=4199&view=rev
Author: tfry
Date: 2012-03-27 08:39:47 +0000 (Tue, 27 Mar 2012)
Log Message:
-----------
Offer restoration only of full data.frames, not individual columns. Also a small cleanup.
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/core/rcontainerobject.cpp
trunk/rkward/rkward/core/rcontainerobject.h
trunk/rkward/rkward/core/renvironmentobject.cpp
trunk/rkward/rkward/core/renvironmentobject.h
trunk/rkward/rkward/core/rkmodificationtracker.cpp
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/ChangeLog 2012-03-27 08:39:47 UTC (rev 4199)
@@ -1,3 +1,4 @@
+- Do not offer to restore individual removed columns of a data.frame opened for editing
- Fixed: Plot history and graphical menus broken in some cases with R 2.15.0 TODO: backport? (r4182)
- Fixed: If the rkward package was loaded in a plain R session, q() and quit() still work
- combined all Wilcoxon/Mann-Whitney-tests in one plugin (from previously two separate plugins) TODO: adjust test(s)
Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp 2012-03-27 08:39:47 UTC (rev 4199)
@@ -318,6 +318,10 @@
RK_TRACE (OBJECTS);
RK_ASSERT (findChildByName (object->getShortName ()) == object);
+ if (isType (Environment) && (!isType (GlobalEnv))) {
+ RK_ASSERT (false);
+ return;
+ }
RCommand *command = new RCommand (renameChildCommand (object, new_name), RCommand::App | RCommand::Sync);
RKGlobals::rInterface ()->issueCommand (command, 0);
Modified: trunk/rkward/rkward/core/rcontainerobject.h
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.h 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/rkward/core/rcontainerobject.h 2012-03-27 08:39:47 UTC (rev 4199)
@@ -80,7 +80,7 @@
// why do I need this to make it compile?!
friend class RObjectList;
friend class RObject;
- virtual void renameChild (RObject *object, const QString &new_name);
+ void renameChild (RObject *object, const QString &new_name);
void removeChild (RObject *object, bool removed_in_workspace);
virtual QString removeChildCommand (RObject *object) const;
virtual QString renameChildCommand (RObject *object, const QString &new_name) const;
Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp 2012-03-27 08:39:47 UTC (rev 4199)
@@ -200,16 +200,6 @@
}
}
-void REnvironmentObject::renameChild (RObject *object, const QString &new_name) {
- RK_TRACE (OBJECTS);
-
- if (type & GlobalEnv) {
- RContainerObject::renameChild (object, new_name);
- } else {
- RK_ASSERT (false);
- }
-}
-
QString REnvironmentObject::renameChildCommand (RObject *object, const QString &new_name) const {
RK_TRACE (OBJECTS);
Modified: trunk/rkward/rkward/core/renvironmentobject.h
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.h 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/rkward/core/renvironmentobject.h 2012-03-27 08:39:47 UTC (rev 4199)
@@ -46,8 +46,6 @@
REnvironmentObject* namespaceEnvironment () const { return namespace_envir; };
protected:
bool updateStructure (RData *new_data);
-/** reimplemented from RContainerObject to raise an assert if this is not the isGlobalEnv (). Otherwise calls "remove (objectname)" instead of objectname <- NULL" */
- void renameChild (RObject *object, const QString &new_name);
/// reimplemented from RContainerObject to call "remove (objectname)" instead of "objectname <- NULL"
QString removeChildCommand (RObject *object) const;
/// reimplemented from RContainerObject to call "remove (objectname)" instead of "objectname <- NULL"
Modified: trunk/rkward/rkward/core/rkmodificationtracker.cpp
===================================================================
--- trunk/rkward/rkward/core/rkmodificationtracker.cpp 2012-03-22 19:03:43 UTC (rev 4198)
+++ trunk/rkward/rkward/core/rkmodificationtracker.cpp 2012-03-27 08:39:47 UTC (rev 4199)
@@ -63,9 +63,18 @@
if (!object->isPseudoObject ()) {
if (removed_in_workspace) {
- if (ed) {
+ if (ed && (ed->getObject () == object)) { // NOTE: do not allow restoring of columns in a data.frame this way. See http://www.mail-archive.com/rkward-devel@lists.sourceforge.net/msg01731.html and replies.
if (KMessageBox::questionYesNo (0, i18n ("The object '%1' was removed from workspace or changed to a different type of object, but is currently opened for editing. Do you want to restore it?", object->getFullName ()), i18n ("Restore object?")) == KMessageBox::Yes) {
ed->restoreObject (object);
+ /* TODO: It would make a lot of sense to allow restoring to a different name, and possibly different location. This may need some thinking. Probably something like:
+ * object->parentObject ()->removeChildNoDelete (parent);
+ * object->setParentObject (RObjectList::getGlobalEnv ());
+ * // make sure new_name is unique in new parent!
+ * RObjectList::getGlobalEnv ()->insertChild (object, -1);
+ * object->setName (new_name);
+ * along with proper begin/endAdd/RemoveRows().
+ * Oh, and listener notifications. That might be tricky.
+ * */
return 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