**
** \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
#include "layer_polygon.h"
#include "layer_pastecanvas.h"
#include "layer_motionblur.h"
+#include "layer_duplicate.h"
#include "valuenode_const.h"
{
_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__);
-
- INCLUDE_LAYER(Layer_SolidColor); LAYER_ALIAS(Layer_SolidColor,"SolidColor");
- INCLUDE_LAYER(Layer_PasteCanvas); LAYER_ALIAS(Layer_PasteCanvas,"PasteCanvas");
- INCLUDE_LAYER(Layer_Polygon); LAYER_ALIAS(Layer_Polygon,"Polygon");
- INCLUDE_LAYER(Layer_MotionBlur); LAYER_ALIAS(Layer_MotionBlur,"MotionBlur");
+#define INCLUDE_LAYER(class) \
+ synfig::Layer::book() [synfig::String(class::name__)] = \
+ BookEntry(class::create, \
+ class::name__, \
+ dgettext("synfig", class::local_name__), \
+ class::category__, \
+ class::cvs_id__, \
+ class::version__)
+
+#define LAYER_ALIAS(class,alias) \
+ synfig::Layer::book()[synfig::String(alias)] = \
+ 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
if(previous)
{
dynamic_param_list_.erase(param);
- remove_child(previous.get());
+
+ // fix 2353284: if two parameters in the same layer are
+ // connected to the same valuenode and we disconnect one of
+ // them, the parent-child relationship for the remaining
+ // connection was being deleted. now we search the parameter
+ // list to see if another parameter uses the same valuenode
+ DynamicParamList::const_iterator iter;
+ for (iter = dynamic_param_list().begin(); iter != dynamic_param_list().end(); iter++)
+ if (iter->second == previous)
+ break;
+ if (iter == dynamic_param_list().end())
+ remove_child(previous.get());
+
changed();
}
return true;
Layer::on_changed()
{
dirty_time_=Time::end();
- if(active())
- Node::on_changed();
+ Node::on_changed();
}
bool
return (*dynamic_param_list().find("z_depth")->second)(t).get(Real());
}
-Layer*
+Layer::Handle
Layer::simple_clone()const
{
if(!book().count(get_name())) return 0;
- Layer *ret = create(get_name()).get();
- ret->set_canvas(get_canvas());
+ Handle ret = create(get_name()).get();
+ ret->group_=group_;
+ //ret->set_canvas(get_canvas());
ret->set_description(get_description());
+ ret->set_active(active());
ret->set_param_list(get_param_list());
+ for(DynamicParamList::const_iterator iter=dynamic_param_list().begin();iter!=dynamic_param_list().end();++iter)
+ ret->connect_dynamic_param(iter->first, iter->second);
return ret;
}
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)
{
if(dynamic_param_list().count(iter->first)==0 && iter->second.get_type()==ValueBase::TYPE_CANVAS)
{
-
// This parameter is a canvas. We need a close look.
Canvas::Handle canvas(iter->second.get(Canvas::Handle()));
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);
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()));
return ret;
}
+bool
+Layer::reads_context() const
+{
+ return false;
+}
+
Rect
Layer::get_full_bounding_rect(Context context)const
{
}
bool
-Layer::set_version(const String &ver)
+Layer::set_version(const String &/*ver*/)
{
return false;
}
** 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> target=surface_target(surface);
if(!target)
{
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();
+}