1 /* === S Y N F I G ========================================================= */
2 /*! \file canvasinterface.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2007, 2008 Chris Moore
10 ** Copyright (c) 2009 Carlos A. Sosa Navarro
12 ** This package is free software; you can redistribute it and/or
13 ** modify it under the terms of the GNU General Public License as
14 ** published by the Free Software Foundation; either version 2 of
15 ** the License, or (at your option) any later version.
17 ** This package is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ** General Public License for more details.
23 /* ========================================================================= */
25 /* === H E A D E R S ======================================================= */
37 #include <synfig/valuenode_scale.h>
38 #include <synfig/valuenode_timedswap.h>
39 #include <synfig/valuenode_composite.h>
40 #include <synfig/valuenode_subtract.h>
41 #include <synfig/valuenode_linear.h>
42 #include <synfig/valuenode_reference.h>
43 #include <synfig/valuenode_twotone.h>
44 #include <synfig/valuenode_stripes.h>
45 #include <synfig/valuenode_bline.h>
47 #include <synfig/waypoint.h>
48 #include <synfig/loadcanvas.h>
49 #include <synfig/importer.h>
50 #include <synfig/guidset.h>
52 #include "canvasinterface.h"
55 #include "actions/layeradd.h"
56 #include "actions/layerremove.h"
57 #include "actions/valuedescconvert.h"
58 #include "actions/valuenodeadd.h"
59 #include "actions/editmodeset.h"
60 #include "action_system.h"
64 #include <synfig/gradient.h>
70 /* === U S I N G =========================================================== */
74 using namespace synfig;
75 using namespace synfigapp;
77 /* === M A C R O S ========================================================= */
79 /* === G L O B A L S ======================================================= */
81 /* === P R O C E D U R E S ================================================= */
83 /* === M E T H O D S ======================================================= */
85 CanvasInterface::CanvasInterface(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas):
88 cur_time_(canvas->rend_desc().get_frame_start()),
89 mode_(MODE_NORMAL|MODE_ANIMATE_PAST|MODE_ANIMATE_FUTURE)
91 set_selection_manager(get_instance()->get_selection_manager());
92 set_ui_interface(get_instance()->get_ui_interface());
95 CanvasInterface::~CanvasInterface()
97 if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
98 synfig::info("CanvasInterface::~CanvasInterface(): Deleted");
102 CanvasInterface::set_time(synfig::Time x)
104 if(get_canvas()->rend_desc().get_frame_rate())
106 float fps(get_canvas()->rend_desc().get_frame_rate());
107 Time r(x.round(fps));
108 //synfig::info("CanvasInterface::set_time(): %s rounded to %s\n",x.get_string(fps).c_str(),r.get_string(fps).c_str());
111 if(cur_time_.is_equal(x))
113 get_canvas()->set_time(cur_time_=x);
115 // update the time in all the child canvases
116 Canvas::Children children = get_canvas()->get_root()->children();
117 handle<CanvasInterface> interface;
118 for (Canvas::Children::iterator iter = children.begin(); iter != children.end(); iter++)
119 if ((interface = get_instance()->find_canvas_interface(*iter)) != this)
120 interface->set_time(interface->get_canvas()->get_time());
122 signal_time_changed()();
123 signal_dirty_preview()();
127 CanvasInterface::get_time()const
133 CanvasInterface::refresh_current_values()
135 get_canvas()->set_time(cur_time_);
136 signal_time_changed()();
137 signal_dirty_preview()();
140 etl::handle<CanvasInterface>
141 CanvasInterface::create(etl::loose_handle<Instance> instance, etl::handle<synfig::Canvas> canvas)
143 etl::handle<CanvasInterface> intrfc;
144 intrfc=new CanvasInterface(instance,canvas);
145 instance->canvas_interface_list().push_front(intrfc);
150 CanvasInterface::set_mode(Mode x)
152 Action::Handle action(Action::EditModeSet::create());
156 action->set_param("canvas",get_canvas());
157 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
158 action->set_param("edit_mode",x);
160 if(!action->is_ready())
162 get_ui_interface()->error(_("Action Not Ready, unable to change mode"));
167 if(!get_instance()->perform_action(action))
168 get_ui_interface()->error(_("Unable to change mode"));
171 // signal_mode_changed_(x);
174 CanvasInterface::Mode
175 CanvasInterface::get_mode()const
183 CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas, int depth)
185 synfigapp::Action::PassiveGrouper group(get_instance().get(),_("Add Layer To"));
187 Layer::Handle layer(Layer::create(name));
194 if(canvas!=get_canvas() && !canvas->is_inline())
196 synfig::error("Bad canvas passed to \"add_layer_to\"");
200 // automatically export the Index parameter of new Duplicate layers
201 if (name == "duplicate")
202 for (int i = 1; ; i++)
204 String name = strprintf(_("Index %d"), i);
207 canvas->find_value_node(name);
209 catch (Exception::IDNotFound x)
211 add_value_node(layer->dynamic_param_list().find("index")->second, name);
216 layer->set_canvas(canvas);
218 // Apply some defaults
219 if(layer->set_param("fg",synfigapp::Main::get_outline_color()))
220 layer->set_param("bg",synfigapp::Main::get_fill_color());
221 else if (name == "outline")
222 layer->set_param("color",synfigapp::Main::get_outline_color());
224 layer->set_param("color",synfigapp::Main::get_fill_color());
226 layer->set_param("width",synfigapp::Main::get_bline_width().units(get_canvas()->rend_desc()));
227 layer->set_param("gradient",synfigapp::Main::get_gradient());
229 layer->set_param("amount",synfigapp::Main::get_opacity());
230 layer->set_param("blend_method",synfigapp::Main::get_blend_method());
233 // Grab the layer's list of parameters
234 Layer::ParamList paramlist=layer->get_param_list();
235 Layer::ParamList::iterator iter;
237 // loop through the static parameters
238 for(iter=paramlist.begin();iter!=paramlist.end();++iter)
240 ValueNode::Handle value_node;
242 // if we find any which are list values then make them
243 // into dynamic list valuenodes, unless every element of
244 // the list is a blinepoint, in which case convert it to a
246 if(iter->second.get_type()==ValueBase::TYPE_LIST)
248 // check whether it's a list of blinepoints only
249 vector<ValueBase> list(iter->second.get_list());
252 vector<ValueBase>::iterator iter2;
253 for (iter2 = list.begin(); iter2 != list.end(); iter2++)
254 if (iter2->get_type() != ValueBase::TYPE_BLINEPOINT)
256 if (iter2 == list.end())
258 value_node=LinkableValueNode::create("bline",iter->second);
259 ValueNode_BLine::Handle::cast_dynamic(value_node)->set_member_canvas(canvas);
264 value_node=LinkableValueNode::create("dynamic_list",iter->second);
266 // otherwise, if it's a type that can be converted to
267 // 'composite' (other than the types that can be radial
268 // composite) then do so
269 else if(LinkableValueNode::check_type("composite",iter->second.get_type()) &&
270 (iter->second.get_type()!=ValueBase::TYPE_COLOR &&
271 iter->second.get_type()!=ValueBase::TYPE_VECTOR))
272 value_node=LinkableValueNode::create("composite",iter->second);
275 layer->connect_dynamic_param(iter->first,value_node);
279 // Action to add the layer
280 Action::Handle action(Action::LayerAdd::create());
286 action->set_param("canvas",canvas);
287 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
288 action->set_param("new",layer);
290 if(!action->is_ready())
292 get_ui_interface()->error(_("Action Not Ready"));
296 if(!get_instance()->perform_action(action))
298 get_ui_interface()->error(_("Action Failed."));
302 // synfig::info("DEPTH=%d",depth);
304 // Action to move the layer (if necessary)
307 Action::Handle action(Action::create("LayerMove"));
313 action->set_param("canvas",canvas);
314 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
315 action->set_param("layer",layer);
316 action->set_param("new_index",depth);
318 if(!action->is_ready())
320 get_ui_interface()->error(_("Move Action Not Ready"));
324 if(!get_instance()->perform_action(action))
326 get_ui_interface()->error(_("Move Action Failed."));
337 CanvasInterface::convert(ValueDesc value_desc, synfig::String type)
339 Action::Handle action(Action::ValueDescConvert::create());
345 action->set_param("canvas",get_canvas());
346 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
347 action->set_param("value_desc",value_desc);
348 action->set_param("type",type);
349 action->set_param("time",get_time());
351 if(!action->is_ready())
353 get_ui_interface()->error(_("Action Not Ready"));
357 if(get_instance()->perform_action(action))
360 get_ui_interface()->error(_("Action Failed."));
365 CanvasInterface::add_value_node(synfig::ValueNode::Handle value_node, synfig::String name)
369 get_ui_interface()->error(_("Empty name!"));
373 Action::Handle action(Action::ValueNodeAdd::create());
379 action->set_param("canvas",get_canvas());
380 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
381 action->set_param("new",value_node);
382 action->set_param("name",name);
384 if(!action->is_ready())
386 get_ui_interface()->error(_("Action Not Ready"));
390 if(get_instance()->perform_action(action))
393 get_ui_interface()->error(_("Action Failed."));
398 CanvasInterface::generate_param_list(const ValueDesc &value_desc)
400 synfigapp::Action::ParamList param_list;
401 param_list.add("time",get_time());
402 param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
403 param_list.add("canvas",get_canvas());
405 param_list.add("value_desc",value_desc);
407 if(value_desc.parent_is_value_node())
408 param_list.add("parent_value_node",value_desc.get_parent_value_node());
410 if(value_desc.is_value_node())
411 param_list.add("value_node",value_desc.get_value_node());
413 if(value_desc.is_const())
415 // Fix 1868911: if we put a ValueBase holding a Canvas handle
416 // into the param_list and then export the canvas, the handle
417 // will miss out of having its reference count reduced,
418 // because by the time the handle is destructed the canvas
419 // will no longer be inline. So let's not propogate that
420 // ValueBase any further than here.
421 if (value_desc.get_value_type() == ValueBase::TYPE_CANVAS)
422 param_list.add("value",Canvas::LooseHandle(value_desc.get_value().get(Canvas::LooseHandle())));
424 param_list.add("value",value_desc.get_value());
427 if(value_desc.parent_is_layer_param())
429 param_list.add("parent_layer",value_desc.get_layer());
430 param_list.add("parent_layer_param",value_desc.get_param_name());
434 synfigapp::SelectionManager::ChildrenList children_list;
435 children_list=get_selection_manager()->get_selected_children();
436 if(!value_desc.parent_is_canvas() && children_list.size()==1)
438 param_list.add("dest",value_desc);
439 param_list.add("src",children_list.front().get_value_node());
446 CanvasInterface::generate_param_list(const std::list<synfigapp::ValueDesc> &value_desc_list)
448 synfigapp::Action::ParamList param_list;
449 param_list.add("time",get_time());
450 param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
451 param_list.add("canvas",get_canvas());
453 std::list<synfigapp::ValueDesc>::const_iterator iter;
454 for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
456 param_list.add("value_desc",*iter);
457 if(iter->is_value_node())
459 param_list.add("value_node",iter->get_value_node());
468 CanvasInterface::set_rend_desc(const synfig::RendDesc &rend_desc)
470 Action::Handle action(Action::create("CanvasRendDescSet"));
476 action->set_param("canvas",get_canvas());
477 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
478 action->set_param("rend_desc",rend_desc);
480 if(!get_instance()->perform_action(action))
481 get_ui_interface()->error(_("Action Failed."));
485 CanvasInterface::set_name(const synfig::String &x)
487 Action::Handle action(Action::create("CanvasNameSet"));
493 action->set_param("canvas",get_canvas());
494 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
495 action->set_param("name",x);
497 if(!get_instance()->perform_action(action))
498 get_ui_interface()->error(_("Action Failed."));
500 signal_id_changed_();
504 CanvasInterface::set_description(const synfig::String &x)
506 Action::Handle action(Action::create("CanvasDescriptionSet"));
512 action->set_param("canvas",get_canvas());
513 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
514 action->set_param("description",x);
516 if(!get_instance()->perform_action(action))
517 get_ui_interface()->error(_("Action Failed."));
521 CanvasInterface::set_id(const synfig::String &x)
523 Action::Handle action(Action::create("CanvasIdSet"));
529 action->set_param("canvas",get_canvas());
530 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
531 action->set_param("id",x);
533 if(!get_instance()->perform_action(action))
534 get_ui_interface()->error(_("Action Failed."));
536 signal_id_changed_();
541 CanvasInterface::jump_to_next_keyframe()
543 synfig::info("Current time: %s",get_time().get_string().c_str());
546 synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_next(get_time()));
547 synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
548 set_time(keyframe.get_time());
550 catch(...) { synfig::warning("Unable to find next keyframe"); }
554 CanvasInterface::jump_to_prev_keyframe()
556 synfig::info("Current time: %s",get_time().get_string().c_str());
559 synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(get_time()));
560 synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
561 set_time(keyframe.get_time());
563 catch(...) { synfig::warning("Unable to find prev keyframe"); }
567 CanvasInterface::import(const synfig::String &filename, synfig::String &errors, synfig::String &warnings, bool resize_image)
569 Action::PassiveGrouper group(get_instance().get(),_("Import Image"));
571 synfig::info("Attempting to import "+filename);
573 if (filename_extension(filename) == "")
575 get_ui_interface()->error(_("Filename must have an extension!"));
579 String ext(filename_extension(filename));
580 if (ext.size()) ext = ext.substr(1); // skip initial '.'
581 std::transform(ext.begin(),ext.end(),ext.begin(),&::tolower);
583 if(ext=="svg"){//I don't like it, but worse is nothing
584 Layer::Handle _new_layer(add_layer_to("PasteCanvas",get_canvas()));
585 Layer::Handle _aux_layer(add_layer_to("svg_layer",get_canvas()));
587 _aux_layer->set_param("filename",ValueBase(filename));
588 _new_layer->set_param("canvas",ValueBase(_aux_layer->get_param("canvas")));
590 Action::Handle action(Action::LayerRemove::create());
594 action->set_param("canvas",get_canvas());
595 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
596 action->set_param("layer",_aux_layer);
597 if(!action->is_ready()){
598 get_ui_interface()->error(_("Action Not Ready"));
601 if(!get_instance()->perform_action(action)){
602 get_ui_interface()->error(_("Action Failed."));
606 signal_layer_new_description()(_new_layer,filename);
610 // If this is a SIF file, then we need to do things slightly differently
611 if(ext=="sif" || ext=="sifz")try
613 Canvas::Handle outside_canvas(synfig::open_canvas(filename, errors, warnings));
615 throw String(_("Unable to open this composition")) + ":\n\n" + errors;
617 Layer::Handle layer(add_layer_to("PasteCanvas",get_canvas()));
619 throw String(_("Unable to create \"Paste Canvas\" layer"));
620 if(!layer->set_param("canvas",ValueBase(outside_canvas)))
622 get_canvas()->register_external_canvas(filename, outside_canvas);
624 //layer->set_description(basename(filename));
625 signal_layer_new_description()(layer,filename);
630 get_ui_interface()->error(filename + ": " + x);
635 get_ui_interface()->error(_("Uncaught exception when attempting\nto open this composition -- ")+filename);
639 if(!Importer::book().count(ext))
641 get_ui_interface()->error(_("I don't know how to open images of this type -- ")+ext);
647 Layer::Handle layer(add_layer_to("Import",get_canvas()));
651 if(!layer->set_param("filename",ValueBase(filename)))
653 w=layer->get_param("_width").get(int());
654 h=layer->get_param("_height").get(int());
657 Vector x, size=ValueBase(get_canvas()->rend_desc().get_br()-get_canvas()->rend_desc().get_tl());
659 // vector from top left of canvas to bottom right
662 if(abs(size[0])<abs(size[1])) // if canvas is tall and thin
664 x[0]=size[0]; // use full width
665 x[1]=size[0]/w*h; // and scale for height
666 if((size[0]<0) ^ (size[1]<0))
669 else // else canvas is short and fat (or maybe square)
671 x[1]=size[1]; // use full height
672 x[0]=size[1]/h*w; // and scale for width
673 if((size[0]<0) ^ (size[1]<0))
681 if((size[0]<0)) x[0]=-x[0];
682 if((size[1]<0)) x[1]=-x[1];
685 if(!layer->set_param("tl",ValueBase(-x/2)))
687 if(!layer->set_param("br",ValueBase(x/2)))
692 if(!layer->set_param("tl",ValueBase(get_canvas()->rend_desc().get_tl())))
694 if(!layer->set_param("br",ValueBase(get_canvas()->rend_desc().get_br())))
698 layer->set_description(basename(filename));
699 signal_layer_new_description()(layer,filename);
705 get_ui_interface()->error("Unable to import "+filename);
713 CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
715 ValueNode::Handle value_node();
716 waypoint_duplicate(value_desc.get_value_node(), waypoint);
720 CanvasInterface::waypoint_duplicate(ValueNode::Handle value_node,synfig::Waypoint waypoint)
722 Action::Handle action(Action::create("WaypointSetSmart"));
728 waypoint.make_unique();
729 waypoint.set_time(get_time());
731 action->set_param("canvas",get_canvas());
732 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
733 action->set_param("waypoint",waypoint);
734 action->set_param("time",get_time());
735 action->set_param("value_node",value_node);
737 if(!get_instance()->perform_action(action))
738 get_ui_interface()->error(_("Action Failed."));
742 CanvasInterface::waypoint_remove(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
744 ValueNode::Handle value_node();
745 waypoint_remove(value_desc.get_value_node(), waypoint);
749 CanvasInterface::waypoint_remove(ValueNode::Handle value_node,synfig::Waypoint waypoint)
751 Action::Handle action(Action::create("WaypointRemove"));
757 action->set_param("canvas",get_canvas());
758 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
759 action->set_param("waypoint",waypoint);
760 action->set_param("value_node",value_node);
762 if(!get_instance()->perform_action(action))
763 get_ui_interface()->error(_("Action Failed."));
768 CanvasInterface::auto_export(synfig::ValueNode::Handle /*value_node*/)
771 // Check to see if we are already exported.
772 if(value_node->is_exported())
775 Action::Handle action(Action::create("ValueNodeAdd"));
781 String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
783 action->set_param("canvas",get_canvas());
784 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
785 action->set_param("new",value_node);
786 action->set_param("name",name);
788 if(!get_instance()->perform_action(action))
789 get_ui_interface()->error(_("Action Failed."));
794 CanvasInterface::auto_export(const ValueDesc& /*value_desc*/)
796 // THIS FUNCTION IS DEPRECATED, AND IS NOW A STUB.
798 // Check to see if we are already exported.
799 if(value_desc.is_exported())
802 Action::Handle action(Action::create("ValueDescExport"));
808 String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
810 action->set_param("canvas",get_canvas());
811 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
812 action->set_param("value_desc",value_desc);
813 action->set_param("name",name);
815 if(!get_instance()->perform_action(action))
816 get_ui_interface()->error(_("Action Failed."));
821 CanvasInterface::change_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value)
823 // If this isn't really a change, then don't bother
824 if(new_value==value_desc.get_value(get_time()))
827 // If this change needs to take place elsewhere, then so be it.
828 if(value_desc.get_canvas())
830 if (value_desc.get_canvas()->get_root() != get_canvas()->get_root())
832 etl::handle<Instance> instance;
833 instance=find_instance(value_desc.get_canvas()->get_root());
836 return instance->find_canvas_interface(value_desc.get_canvas())->change_value(value_desc,new_value);
839 get_ui_interface()->error(_("The value you are trying to edit is in a composition\nwhich doesn't seem to be open. Open that composition and you\nshould be able to edit this value as normal."));
846 { synfig::warning("Can't get canvas from value desc...?"); }
849 synfigapp::Action::Handle action(synfigapp::Action::create("ValueDescSet"));
855 action->set_param("canvas",get_canvas());
856 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
857 action->set_param("time",get_time());
858 action->set_param("value_desc",value_desc);
859 action->set_param("new_value",new_value);
861 return get_instance()->perform_action(action);
865 CanvasInterface::set_meta_data(const synfig::String& key,const synfig::String& data)
867 get_canvas()->set_meta_data(key,data);
871 // this function goes with find_important_value_descs()
873 _process_value_desc(const synfigapp::ValueDesc& value_desc,std::vector<synfigapp::ValueDesc>& out, synfig::GUIDSet& guid_set)
877 if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
879 Canvas::Handle canvas;
880 canvas=value_desc.get_value().get(canvas);
881 if(!canvas || !canvas->is_inline())
883 ret+=CanvasInterface::find_important_value_descs(canvas,out,guid_set);
886 if(value_desc.is_value_node())
888 ValueNode::Handle value_node(value_desc.get_value_node());
890 if(guid_set.count(value_node->get_guid()))
892 guid_set.insert(value_node->get_guid());
894 if(LinkableValueNode::Handle::cast_dynamic(value_node))
896 if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
898 out.push_back(value_desc);
901 // Process the linkable ValueNode's children
902 LinkableValueNode::Handle value_node_copy(LinkableValueNode::Handle::cast_dynamic(value_node));
904 for(i=0;i<value_node_copy->link_count();i++)
906 ValueNode::Handle link(value_node_copy->get_link(i));
907 if(!link->is_exported())
908 ret+=_process_value_desc(ValueDesc(value_node_copy,i),out,guid_set);
911 else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
913 out.push_back(value_desc);
922 CanvasInterface::find_important_value_descs(synfig::Canvas::Handle canvas,std::vector<synfigapp::ValueDesc>& out,synfig::GUIDSet& guid_set)
925 if(!canvas->is_inline())
927 ValueNodeList::const_iterator iter;
930 iter=canvas->value_node_list().begin();
931 iter!=canvas->value_node_list().end();
933 ret+=_process_value_desc(ValueDesc(canvas,(*iter)->get_id()),out,guid_set);
936 Canvas::const_iterator iter;
938 for(iter=canvas->begin();iter!=canvas->end();++iter)
940 Layer::Handle layer(*iter);
942 Layer::DynamicParamList::const_iterator iter;
944 iter=layer->dynamic_param_list().begin();
945 iter!=layer->dynamic_param_list().end();
948 if(!iter->second->is_exported())
949 ret+=_process_value_desc(ValueDesc(layer,iter->first),out,guid_set);
951 ValueBase value(layer->get_param("canvas"));
953 ret+=_process_value_desc(ValueDesc(layer,"canvas"),out,guid_set);
960 CanvasInterface::find_important_value_descs(std::vector<synfigapp::ValueDesc>& out)
963 return find_important_value_descs(get_canvas(),out,tmp);
967 CanvasInterface::seek_frame(int frames)
971 float fps(get_canvas()->rend_desc().get_frame_rate());
972 Time newtime(get_time()+(float)frames/fps);
973 newtime=newtime.round(fps);
975 if(newtime<=get_canvas()->rend_desc().get_time_start())
976 newtime=get_canvas()->rend_desc().get_time_start();
977 if(newtime>=get_canvas()->rend_desc().get_time_end())
978 newtime=get_canvas()->rend_desc().get_time_end();
983 CanvasInterface::seek_time(synfig::Time time)
988 float fps(get_canvas()->rend_desc().get_frame_rate());
990 if(time>=synfig::Time::end())
992 set_time(get_canvas()->rend_desc().get_time_end());
995 if(time<=synfig::Time::begin())
997 set_time(get_canvas()->rend_desc().get_time_start());
1001 Time newtime(get_time()+time);
1002 newtime=newtime.round(fps);
1004 if(newtime<=get_canvas()->rend_desc().get_time_start())
1005 newtime=get_canvas()->rend_desc().get_time_start();
1006 if(newtime>=get_canvas()->rend_desc().get_time_end())
1007 newtime=get_canvas()->rend_desc().get_time_end();