Added copyright lines for files I've edited this year.
[synfig.git] / synfig-core / trunk / src / synfig / layer.cpp
index 9c4601a..9edaffe 100644 (file)
@@ -6,6 +6,7 @@
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 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
@@ -44,6 +45,7 @@
 #include "layer_polygon.h"
 #include "layer_pastecanvas.h"
 #include "layer_motionblur.h"
+#include "layer_duplicate.h"
 
 #include "valuenode_const.h"
 
@@ -95,13 +97,14 @@ Layer::subsys_init()
 {
        _layer_book=new Book();
 
-#define INCLUDE_LAYER(class)   synfig::Layer::book()[synfig::String(class::name__)]=BookEntry(class::create,class::name__,class::local_name__,class::category__,class::cvs_id__,class::version__)
-#define LAYER_ALIAS(class,alias)       synfig::Layer::book()[synfig::String(alias)]=synfig::Layer::BookEntry(class::create,alias,alias,_("Do Not Use"),class::cvs_id__,class::version__);
+#define INCLUDE_LAYER(class)   synfig::Layer::book()[synfig::String(class::name__)]=BookEntry(class::create,class::name__,dgettext("synfig",class::local_name__),dgettext("synfig",class::category__),class::cvs_id__,class::version__)
+#define LAYER_ALIAS(class,alias)       synfig::Layer::book()[synfig::String(alias)]=synfig::Layer::BookEntry(class::create,alias,alias,CATEGORY_DO_NOT_USE,class::cvs_id__,class::version__);
 
        INCLUDE_LAYER(Layer_SolidColor);        LAYER_ALIAS(Layer_SolidColor,   "solid_color");
        INCLUDE_LAYER(Layer_PasteCanvas);       LAYER_ALIAS(Layer_PasteCanvas,  "paste_canvas");
        INCLUDE_LAYER(Layer_Polygon);           LAYER_ALIAS(Layer_Polygon,              "Polygon");
        INCLUDE_LAYER(Layer_MotionBlur);        LAYER_ALIAS(Layer_MotionBlur,   "motion_blur");
+       INCLUDE_LAYER(Layer_Duplicate);
 
 #undef INCLUDE_LAYER
 
@@ -287,6 +290,7 @@ Layer::get_z_depth(const synfig::Time& t)const
        return (*dynamic_param_list().find("z_depth")->second)(t).get(Real());
 }
 
+#ifdef THIS_CODE_IS_NOT_USED
 Layer*
 Layer::simple_clone()const
 {
@@ -297,6 +301,7 @@ Layer::simple_clone()const
        ret->set_param_list(get_param_list());
        return ret;
 }
+#endif /* THIS_CODE_IS_NOT_USED */
 
 Layer::Handle
 Layer::clone(const GUID& deriv_guid) const
@@ -313,7 +318,7 @@ Layer::clone(const GUID& deriv_guid) const
        ret->set_guid(get_guid()^deriv_guid);
 
        //ret->set_param_list(get_param_list());
-       // Process the parameter list sothat
+       // Process the parameter list so that
        // we can duplicate any inline canvases
        ParamList param_list(get_param_list());
        for(ParamList::const_iterator iter(param_list.begin()); iter != param_list.end(); ++iter)
@@ -366,6 +371,12 @@ Layer::clone(const GUID& deriv_guid) const
        return ret;
 }
 
+bool
+Layer::reads_context() const
+{
+       return false;
+}
+
 Rect
 Layer::get_full_bounding_rect(Context context)const
 {
@@ -562,3 +573,14 @@ Layer::get_group()const
 {
        return group_;
 }
+
+const String
+Layer::get_param_local_name(const String &param_name)const
+{
+       ParamVocab vocab = get_param_vocab();
+       // loop to find the parameter in the parameter vocab - this gives us its local name
+       for (ParamVocab::iterator iter = vocab.begin(); iter != vocab.end(); iter++)
+               if (iter->get_name() == param_name)
+                       return iter->get_local_name();
+       return String();
+}