Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / synfigapp / actions / activepointadd.cpp
index c1d223b..79e5ceb 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**  Copyright (c) 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -32,6 +33,8 @@
 #include "activepointadd.h"
 #include <synfigapp/canvasinterface.h>
 
+#include <synfigapp/general.h>
+
 #endif
 
 using namespace std;
@@ -44,7 +47,7 @@ using namespace Action;
 
 ACTION_INIT(Action::ActivepointAdd);
 ACTION_SET_NAME(Action::ActivepointAdd,"activepoint_add");
-ACTION_SET_LOCAL_NAME(Action::ActivepointAdd,"Add Activepoint");
+ACTION_SET_LOCAL_NAME(Action::ActivepointAdd,N_("Add Activepoint"));
 ACTION_SET_TASK(Action::ActivepointAdd,"add");
 ACTION_SET_CATEGORY(Action::ActivepointAdd,Action::CATEGORY_ACTIVEPOINT);
 ACTION_SET_PRIORITY(Action::ActivepointAdd,0);
@@ -91,17 +94,16 @@ Action::ActivepointAdd::get_param_vocab()
 bool
 Action::ActivepointAdd::is_candidate(const ParamList &x)
 {
-       if(candidate_check(get_param_vocab(),x))
-       {
-               ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
-               if(!value_desc.parent_is_value_node() || !ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()))
-                       return false;
+       if (!candidate_check(get_param_vocab(),x))
+               return false;
 
-               // We need either a activepoint or a time.
-               if(x.count("activepoint") || x.count("time"))
-                       return true;
-       }
-       return false;
+       ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+       return (value_desc.parent_is_value_node() &&
+                       // We need a dynamic list.
+                       ValueNode_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node()) &&
+                       // We need either an activepoint or a time.
+                       (x.count("activepoint") || x.count("time")));
 }
 
 bool