X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Flayer.cpp;h=9edaffe906645f931322f4e285a0f1c07b0bf415;hb=756c0d29ac1742f231e6615f9a577e574e35a4af;hp=8d6ae4a4794afe4fc9660f31e108d277661599ab;hpb=cc54c38609ee9745ad678e5e9b9d7d2912be9c95;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/layer.cpp b/synfig-core/trunk/src/synfig/layer.cpp index 8d6ae4a..9edaffe 100644 --- a/synfig-core/trunk/src/synfig/layer.cpp +++ b/synfig-core/trunk/src/synfig/layer.cpp @@ -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,14 +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); - INCLUDE_LAYER(Layer_PasteCanvas); - INCLUDE_LAYER(Layer_Polygon); - LAYER_ALIAS(Layer_Polygon,"Polygon"); - INCLUDE_LAYER(Layer_MotionBlur); + 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 @@ -266,7 +268,7 @@ Layer::on_changed() bool Layer::set_param(const String ¶m, const ValueBase &value) { - if(param=="z_depth" && value.same_as(z_depth_)) + if(param=="z_depth" && value.same_type_as(z_depth_)) { z_depth_=value.get(z_depth_); return true; @@ -288,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 { @@ -298,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 @@ -314,8 +318,8 @@ 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 - // we can duplicate any inlinecanvases + // 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) { @@ -324,10 +328,10 @@ Layer::clone(const GUID& deriv_guid) const // This parameter is a canvas. We need a close look. Canvas::Handle canvas(iter->second.get(Canvas::Handle())); - if(canvas->is_inline()) + if(canvas && canvas->is_inline()) { - // This parameter is an inlinecanvas! we need to clone it - // before we set it as aparameter. + // This parameter is an inline canvas! we need to clone it + // before we set it as a parameter. Canvas::Handle new_canvas(canvas->clone(deriv_guid)); ValueBase value(new_canvas); ret->set_param(iter->first, value); @@ -343,7 +347,7 @@ Layer::clone(const GUID& deriv_guid) const DynamicParamList::const_iterator iter; for(iter=dynamic_param_list().begin();iter!=dynamic_param_list().end();++iter) { - // Make sure we clone inlinecanvases + // Make sure we clone inline canvases if(iter->second->get_type()==ValueBase::TYPE_CANVAS) { Canvas::Handle canvas((*iter->second)(0).get(Canvas::Handle())); @@ -367,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 { @@ -426,7 +436,7 @@ Layer::get_version()const } bool -Layer::set_version(const String &ver) +Layer::set_version(const String &/*ver*/) { return false; } @@ -467,7 +477,7 @@ Layer::hit_check(synfig::Context context, const synfig::Point &pos)const ** is anything but accelerated... */ bool -Layer::accelerated_render(Context context,Surface *surface,int quality, const RendDesc &renddesc, ProgressCallback *cb) const +Layer::accelerated_render(Context context,Surface *surface,int /*quality*/, const RendDesc &renddesc, ProgressCallback *cb) const { handle target=surface_target(surface); if(!target) @@ -563,3 +573,14 @@ Layer::get_group()const { return group_; } + +const String +Layer::get_param_local_name(const String ¶m_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(); +}