Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / synfigapp / actions / waypointremove.cpp
index 2dd442a..4374cdc 100644 (file)
@@ -2,7 +2,7 @@
 /*!    \file waypointremove.cpp
 **     \brief Template File
 **
-**     $Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
@@ -32,6 +32,8 @@
 #include "waypointremove.h"
 #include <synfigapp/canvasinterface.h>
 
+#include <synfigapp/general.h>
+
 #endif
 
 using namespace std;
@@ -43,13 +45,13 @@ using namespace Action;
 /* === M A C R O S ========================================================= */
 
 ACTION_INIT(Action::WaypointRemove);
-ACTION_SET_NAME(Action::WaypointRemove,"waypoint_remove");
-ACTION_SET_LOCAL_NAME(Action::WaypointRemove,"Remove Waypoint");
+ACTION_SET_NAME(Action::WaypointRemove,"WaypointRemove");
+ACTION_SET_LOCAL_NAME(Action::WaypointRemove,N_("Remove Waypoint"));
 ACTION_SET_TASK(Action::WaypointRemove,"remove");
 ACTION_SET_CATEGORY(Action::WaypointRemove,Action::CATEGORY_WAYPOINT);
 ACTION_SET_PRIORITY(Action::WaypointRemove,0);
 ACTION_SET_VERSION(Action::WaypointRemove,"0.0");
-ACTION_SET_CVS_ID(Action::WaypointRemove,"$Id: waypointremove.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $");
+ACTION_SET_CVS_ID(Action::WaypointRemove,"$Id$");
 
 /* === G L O B A L S ======================================================= */
 
@@ -139,6 +141,16 @@ Action::WaypointRemove::perform()
                                throw Error(_("Unable to create ValueNode_Reference"));
                }
 
+               // fix 2256600 (and 2321845) : deleting the last waypoint of an exported valuenode unexported it
+               // if the waypoint's value isn't exported, set its id to be the id of the parent node
+               if (value_node_ref->get_id() == "" && value_node->get_id() != "")
+               {
+                       const String id(value_node->get_id());
+                       Canvas::LooseHandle canvas(value_node->get_parent_canvas());
+                       canvas->remove_value_node(value_node);
+                       canvas->add_value_node(value_node_ref, id);
+               }
+
                value_node->replace(value_node_ref);
                value_node->waypoint_list().clear();
 
@@ -159,6 +171,14 @@ Action::WaypointRemove::undo()
                if(value_node->waypoint_list().size()!=0)
                        throw Error(_("This animated value node should be empty, but for some reason it isn't. This is a bug. (1)"));
 
+               if (value_node->get_id() == "" && value_node_ref->get_id() != "")
+               {
+                       const String id(value_node_ref->get_id());
+                       Canvas::LooseHandle canvas(value_node_ref->get_parent_canvas());
+                       canvas->remove_value_node(value_node_ref);
+                       canvas->add_value_node(value_node, id);
+               }
+
                value_node_ref->replace(value_node);
 
                waypoint.set_value_node(value_node_ref);