Example #1
0
handle<CanvasInterface>
Instance::find_canvas_interface(synfig::Canvas::Handle canvas)
{
	if(!canvas)
		return 0;
	while(canvas->is_inline())
		canvas=canvas->parent();

	CanvasInterfaceList::iterator iter;

	for(iter=canvas_interface_list().begin();iter!=canvas_interface_list().end();iter++)
		if((*iter)->get_canvas()==canvas)
			return *iter;

	return CanvasInterface::create(this,canvas);
}
//recursion functions
void synfigapp::recurse_canvas(synfig::Canvas::Handle h, const std::set<Time> &tlist,
								timepoints_ref &vals, synfig::Time time_offset, synfig::Real time_dilation)
{

	//synfig::info("Canvas...\n Recurse through layers");
	// iterate through the layers

	synfig::Canvas::iterator i = h->begin(), end = h->end();

	for(; i != end; ++i)
	{
		const Node::time_set &tset = (*i)->get_times();
		if(check_intersect(tset.begin(),tset.end(),tlist.begin(),tlist.end(),time_offset,time_dilation))
		{
			recurse_layer(*i,tlist,vals,time_offset,time_dilation);
		}
	}
}
Example #3
0
void print_child_canvases(const std::string& prefix,
						  const synfig::Canvas::Handle& canvas)
{
	const synfig::Canvas::Children& children(canvas->children());
	for (synfig::Canvas::Children::const_iterator child_canvas = children.begin();
		 child_canvas != children.end(); child_canvas++)
	{
		std::string new_prefix = prefix + ":" + (*child_canvas)->get_id();
		std::cout << new_prefix << std::endl;
		print_child_canvases(new_prefix, *child_canvas);
	}
}
Example #4
0
void
Instance::update_references_in_canvas(synfig::Canvas::Handle canvas)
{
	for(std::list<Canvas::Handle>::const_iterator i = canvas->children().begin(); i != canvas->children().end(); i++)
		update_references_in_canvas(*i);

	for(IndependentContext c = canvas->get_independent_context(); *c; c++)
	{
		for(FileReferenceList::iterator j = save_canvas_references_.begin(); j != save_canvas_references_.end();)
		{
			if (*c == j->layer)
			{
				ValueBase value;
				value.set(j->new_filename);
				(*c)->set_param(j->param_name, value);
				(*c)->changed();
				find_canvas_interface(get_canvas())->signal_layer_param_changed()(*c,j->param_name);
				j = save_canvas_references_.erase(j);
			}
			else j++;
		}
	}
}
Example #5
0
void
ChildrenTreeStore::on_canvas_added(synfig::Canvas::Handle canvas)
{
	Gtk::TreeRow row = *(prepend(canvas_row.children()));

	row[model.icon] = Gtk::Button().render_icon(Gtk::StockID("synfig-type_canvas"),Gtk::ICON_SIZE_SMALL_TOOLBAR);
	row[model.id] = canvas->get_id();
	row[model.name] = canvas->get_name();

	if(!canvas->get_id().empty())
		row[model.label] = canvas->get_id();
	else
	if(!canvas->get_name().empty())
		row[model.label] = canvas->get_name();
	else
		row[model.label] = _("[Unnamed]");

	row[model.canvas] = canvas;
	row[model.type] = _("Canvas");
	//row[model.is_canvas] = true;
	//row[model.is_value_node] = false;
}
Example #6
0
void
AutoRecover::clear_backup(synfig::Canvas::Handle canvas)
{
	if(canvas)
		remove(get_shadow_file_name(canvas->get_file_name()).c_str());
}