Don't allow the Index parameter of the Duplicate layer to be disconnected.
[synfig.git] / synfig-studio / trunk / src / synfigapp / actions / valuedescdisconnect.cpp
index 9bebb74..c387f1b 100644 (file)
@@ -37,6 +37,8 @@
 #include <synfigapp/canvasinterface.h>
 #include <synfig/valuenode_const.h>
 
+#include <synfigapp/general.h>
+
 #endif
 
 using namespace std;
@@ -49,7 +51,7 @@ using namespace Action;
 
 ACTION_INIT(Action::ValueDescDisconnect);
 ACTION_SET_NAME(Action::ValueDescDisconnect,"value_desc_disconnect");
-ACTION_SET_LOCAL_NAME(Action::ValueDescDisconnect,"Disconnect");
+ACTION_SET_LOCAL_NAME(Action::ValueDescDisconnect,N_("Disconnect"));
 ACTION_SET_TASK(Action::ValueDescDisconnect,"disconnect");
 ACTION_SET_CATEGORY(Action::ValueDescDisconnect,Action::CATEGORY_VALUEDESC);
 ACTION_SET_PRIORITY(Action::ValueDescDisconnect,-100);
@@ -90,6 +92,10 @@ Action::ValueDescDisconnect::is_candidate(const ParamList &x)
        if(candidate_check(get_param_vocab(),x))
        {
                ValueDesc value_desc(x.find("value_desc")->second.get_value_desc());
+
+               // don't allow the Index parameter of the Duplicate layer to be disconnected
+               if(value_desc.parent_is_layer_param() && value_desc.get_layer()->get_name() == "duplicate" && value_desc.get_param_name() == "index")
+                       return false;
                if(!value_desc.parent_is_canvas() && value_desc.is_value_node() && value_desc.get_value_node()->rcount()>1)
                        return true;
                if(value_desc.is_const())
@@ -190,5 +196,5 @@ Action::ValueDescDisconnect::prepare()
                return;
        }
 
-       throw Error(_("ValueDesc is not recognised or supported."));
+       throw Error(_("ValueDesc is not recognized or supported."));
 }