#include <synfig/gradient.h>
+#include "general.h"
+
#endif
/* === U S I N G =========================================================== */
/* === M E T H O D S ======================================================= */
-CanvasInterface::CanvasInterface(loose_handle<Instance> instance,handle<Canvas> canvas):
+CanvasInterface::CanvasInterface(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas):
instance_(instance),
canvas_(canvas),
cur_time_(canvas->rend_desc().get_frame_start()),
}
etl::handle<CanvasInterface>
-CanvasInterface::create(loose_handle<Instance> instance,handle<Canvas> canvas)
+CanvasInterface::create(etl::loose_handle<Instance> instance, etl::handle<synfig::Canvas> canvas)
{
etl::handle<CanvasInterface> intrfc;
intrfc=new CanvasInterface(instance,canvas);
Layer::Handle
-CanvasInterface::add_layer_to(String name, Canvas::Handle canvas, int depth)
+CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas, int depth)
{
synfigapp::Action::PassiveGrouper group(get_instance().get(),_("Add Layer To"));
return 0;
}
+ // automatically export the Index parameter of new Duplicate layers
+ if (name == "duplicate")
+ for (int i = 1; ; i++)
+ {
+ String name = strprintf(_("Index %d"), i);
+ try
+ {
+ canvas->find_value_node(name);
+ }
+ catch (Exception::IDNotFound x)
+ {
+ add_value_node(layer->dynamic_param_list().find("index")->second, name);
+ break;
+ }
+ }
+
layer->set_canvas(canvas);
// Apply some defaults
layer->set_param("blend_method",synfigapp::Main::get_blend_method());
{
- // Grab the layer's list pf parameters
+ // Grab the layer's list of parameters
Layer::ParamList paramlist=layer->get_param_list();
Layer::ParamList::iterator iter;
for(iter=paramlist.begin();iter!=paramlist.end();++iter)
bool
-CanvasInterface::convert(ValueDesc value_desc, String type)
+CanvasInterface::convert(ValueDesc value_desc, synfig::String type)
{
Action::Handle action(Action::ValueDescConvert::create());
action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
action->set_param("value_desc",value_desc);
action->set_param("type",type);
+ action->set_param("time",get_time());
if(!action->is_ready())
{
}
bool
-CanvasInterface::set_name(const String &x)
+CanvasInterface::set_name(const synfig::String &x)
{
//! \todo This needs to be converted into an action
get_canvas()->set_name(x);
}
bool
-CanvasInterface::set_description(const String &x)
+CanvasInterface::set_description(const synfig::String &x)
{
//! \todo This needs to be converted into an action
get_canvas()->set_description(x);
}
bool
-CanvasInterface::set_id(const String &x)
+CanvasInterface::set_id(const synfig::String &x)
{
//! \todo This needs to be converted into an action
get_canvas()->set_id(x);
synfig::info("Attempting to import "+filename);
-
- if(find(filename.begin(),filename.end(),'.')==filename.end())
+ if (filename_extension(filename) == "")
{
- get_ui_interface()->error("Filename must have an extension!");
+ get_ui_interface()->error(_("Filename must have an extension!"));
return false;
}
- String ext(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));
+ String ext(filename_extension(filename));
+ if (ext.size()) ext = ext.substr(1); // skip initial '.'
std::transform(ext.begin(),ext.end(),ext.begin(),&::tolower);
// If this is a SIF file, then we need to do things slightly differently
{
x[0]=size[0];
x[1]=size[0]/w*h;
- if(size[0]<0 ^ size[1]<0)
+ if((size[0]<0) ^ (size[1]<0))
x[1]=-x[1];
}
else
{
x[1]=size[1];
x[0]=size[1]/h*w;
- if(size[0]<0 ^ size[1]<0)
+ if((size[0]<0) ^ (size[1]<0))
x[0]=-x[0];
}
if(!layer->set_param("tl",ValueBase(-x/2)))
void
-CanvasInterface::auto_export(ValueNode::Handle /*value_node*/)
+CanvasInterface::auto_export(synfig::ValueNode::Handle /*value_node*/)
{
/*
// Check to see if we are already exported.