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
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === H E A D E R S ======================================================= */
36 #include <synfig/valuenode_scale.h>
37 #include <synfig/valuenode_timedswap.h>
38 #include <synfig/valuenode_composite.h>
39 #include <synfig/valuenode_subtract.h>
40 #include <synfig/valuenode_linear.h>
41 #include <synfig/valuenode_reference.h>
42 #include <synfig/valuenode_twotone.h>
43 #include <synfig/valuenode_stripes.h>
44 #include <synfig/valuenode_bline.h>
46 #include <synfig/waypoint.h>
47 #include <synfig/loadcanvas.h>
48 #include <synfig/importer.h>
49 #include <synfig/guidset.h>
51 #include "canvasinterface.h"
54 #include "actions/layeradd.h"
55 #include "actions/valuedescconvert.h"
56 #include "actions/valuenodeadd.h"
57 #include "actions/editmodeset.h"
58 #include "action_system.h"
62 #include <synfig/gradient.h>
68 /* === U S I N G =========================================================== */
72 using namespace synfig;
73 using namespace synfigapp;
75 /* === M A C R O S ========================================================= */
77 /* === G L O B A L S ======================================================= */
79 /* === P R O C E D U R E S ================================================= */
81 /* === M E T H O D S ======================================================= */
83 CanvasInterface::CanvasInterface(etl::loose_handle<Instance> instance,etl::handle<synfig::Canvas> canvas):
86 cur_time_(canvas->rend_desc().get_frame_start()),
87 mode_(MODE_NORMAL|MODE_ANIMATE_PAST|MODE_ANIMATE_FUTURE)
89 set_selection_manager(get_instance()->get_selection_manager());
90 set_ui_interface(get_instance()->get_ui_interface());
93 CanvasInterface::~CanvasInterface()
95 if (getenv("SYNFIG_DEBUG_DESTRUCTORS"))
96 synfig::info("CanvasInterface::~CanvasInterface(): Deleted");
100 CanvasInterface::set_time(synfig::Time x)
102 if(get_canvas()->rend_desc().get_frame_rate())
104 float fps(get_canvas()->rend_desc().get_frame_rate());
105 Time r(x.round(fps));
106 //synfig::info("CanvasInterface::set_time(): %s rounded to %s\n",x.get_string(fps).c_str(),r.get_string(fps).c_str());
109 if(cur_time_.is_equal(x))
111 get_canvas()->set_time(cur_time_=x);
113 // update the time in all the child canvases
114 Canvas::Children children = get_canvas()->get_root()->children();
115 handle<CanvasInterface> interface;
116 for (Canvas::Children::iterator iter = children.begin(); iter != children.end(); iter++)
117 if ((interface = get_instance()->find_canvas_interface(*iter)) != this)
118 interface->set_time(interface->get_canvas()->get_time());
120 signal_time_changed()();
121 signal_dirty_preview()();
125 CanvasInterface::get_time()const
131 CanvasInterface::refresh_current_values()
133 get_canvas()->set_time(cur_time_);
134 signal_time_changed()();
135 signal_dirty_preview()();
138 etl::handle<CanvasInterface>
139 CanvasInterface::create(etl::loose_handle<Instance> instance, etl::handle<synfig::Canvas> canvas)
141 etl::handle<CanvasInterface> intrfc;
142 intrfc=new CanvasInterface(instance,canvas);
143 instance->canvas_interface_list().push_front(intrfc);
148 CanvasInterface::set_mode(Mode x)
150 Action::Handle action(Action::EditModeSet::create());
154 action->set_param("canvas",get_canvas());
155 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
156 action->set_param("edit_mode",x);
158 if(!action->is_ready())
160 get_ui_interface()->error(_("Action Not Ready, unable to change mode"));
165 if(!get_instance()->perform_action(action))
166 get_ui_interface()->error(_("Unable to change mode"));
169 // signal_mode_changed_(x);
172 CanvasInterface::Mode
173 CanvasInterface::get_mode()const
181 CanvasInterface::add_layer_to(synfig::String name, synfig::Canvas::Handle canvas, int depth)
183 synfigapp::Action::PassiveGrouper group(get_instance().get(),_("Add Layer To"));
185 Layer::Handle layer(Layer::create(name));
192 if(canvas!=get_canvas() && !canvas->is_inline())
194 synfig::error("Bad canvas passed to \"add_layer_to\"");
198 // automatically export the Index parameter of new Duplicate layers
199 if (name == "duplicate")
200 for (int i = 1; ; i++)
202 String name = strprintf(_("Index %d"), i);
205 canvas->find_value_node(name);
207 catch (Exception::IDNotFound x)
209 add_value_node(layer->dynamic_param_list().find("index")->second, name);
214 layer->set_canvas(canvas);
216 // Apply some defaults
217 if(layer->set_param("fg",synfigapp::Main::get_foreground_color()))
218 layer->set_param("bg",synfigapp::Main::get_background_color());
220 layer->set_param("color",synfigapp::Main::get_foreground_color());
222 layer->set_param("width",synfigapp::Main::get_bline_width().units(get_canvas()->rend_desc()));
223 layer->set_param("gradient",synfigapp::Main::get_gradient());
225 layer->set_param("amount",synfigapp::Main::get_opacity());
226 layer->set_param("blend_method",synfigapp::Main::get_blend_method());
229 // Grab the layer's list of parameters
230 Layer::ParamList paramlist=layer->get_param_list();
231 Layer::ParamList::iterator iter;
233 // loop through the static parameters
234 for(iter=paramlist.begin();iter!=paramlist.end();++iter)
236 ValueNode::Handle value_node;
238 // if we find any which are list values then make them
239 // into dynamic list valuenodes, unless every element of
240 // the list is a blinepoint, in which case convert it to a
242 if(iter->second.get_type()==ValueBase::TYPE_LIST)
244 // check whether it's a list of blinepoints only
245 vector<ValueBase> list(iter->second.get_list());
248 vector<ValueBase>::iterator iter2;
249 for (iter2 = list.begin(); iter2 != list.end(); iter2++)
250 if (iter2->get_type() != ValueBase::TYPE_BLINEPOINT)
252 if (iter2 == list.end())
254 value_node=LinkableValueNode::create("bline",iter->second);
255 ValueNode_BLine::Handle::cast_dynamic(value_node)->set_member_canvas(canvas);
260 value_node=LinkableValueNode::create("dynamic_list",iter->second);
262 // otherwise, if it's a type that can be converted to
263 // 'composite' (other than the types that can be radial
264 // composite) then do so
265 else if(LinkableValueNode::check_type("composite",iter->second.get_type()) &&
266 (iter->second.get_type()!=ValueBase::TYPE_COLOR &&
267 iter->second.get_type()!=ValueBase::TYPE_VECTOR))
268 value_node=LinkableValueNode::create("composite",iter->second);
271 layer->connect_dynamic_param(iter->first,value_node);
275 // Action to add the layer
276 Action::Handle action(Action::LayerAdd::create());
282 action->set_param("canvas",canvas);
283 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
284 action->set_param("new",layer);
286 if(!action->is_ready())
288 get_ui_interface()->error(_("Action Not Ready"));
292 if(!get_instance()->perform_action(action))
294 get_ui_interface()->error(_("Action Failed."));
298 // synfig::info("DEPTH=%d",depth);
300 // Action to move the layer (if necessary)
303 Action::Handle action(Action::create("layer_move"));
309 action->set_param("canvas",canvas);
310 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
311 action->set_param("layer",layer);
312 action->set_param("new_index",depth);
314 if(!action->is_ready())
316 get_ui_interface()->error(_("Move Action Not Ready"));
320 if(!get_instance()->perform_action(action))
322 get_ui_interface()->error(_("Move Action Failed."));
333 CanvasInterface::convert(ValueDesc value_desc, synfig::String type)
335 Action::Handle action(Action::ValueDescConvert::create());
341 action->set_param("canvas",get_canvas());
342 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
343 action->set_param("value_desc",value_desc);
344 action->set_param("type",type);
345 action->set_param("time",get_time());
347 if(!action->is_ready())
349 get_ui_interface()->error(_("Action Not Ready"));
353 if(get_instance()->perform_action(action))
356 get_ui_interface()->error(_("Action Failed."));
361 CanvasInterface::add_value_node(synfig::ValueNode::Handle value_node, synfig::String name)
365 get_ui_interface()->error(_("Empty name!"));
369 Action::Handle action(Action::ValueNodeAdd::create());
375 action->set_param("canvas",get_canvas());
376 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
377 action->set_param("new",value_node);
378 action->set_param("name",name);
380 if(!action->is_ready())
382 get_ui_interface()->error(_("Action Not Ready"));
386 if(get_instance()->perform_action(action))
389 get_ui_interface()->error(_("Action Failed."));
394 CanvasInterface::generate_param_list(const ValueDesc &value_desc)
396 synfigapp::Action::ParamList param_list;
397 param_list.add("time",get_time());
398 param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
399 param_list.add("canvas",get_canvas());
401 param_list.add("value_desc",value_desc);
403 if(value_desc.parent_is_value_node())
404 param_list.add("parent_value_node",value_desc.get_parent_value_node());
406 if(value_desc.is_value_node())
407 param_list.add("value_node",value_desc.get_value_node());
409 if(value_desc.is_const())
411 // Fix 1868911: if we put a ValueBase holding a Canvas handle
412 // into the param_list and then export the canvas, the handle
413 // will miss out of having its reference count reduced,
414 // because by the time the handle is destructed the canvas
415 // will no longer be inline. So let's not propogate that
416 // ValueBase any further than here.
417 if (value_desc.get_value_type() == ValueBase::TYPE_CANVAS)
418 param_list.add("value",Canvas::LooseHandle(value_desc.get_value().get(Canvas::LooseHandle())));
420 param_list.add("value",value_desc.get_value());
423 if(value_desc.parent_is_layer_param())
425 param_list.add("parent_layer",value_desc.get_layer());
426 param_list.add("parent_layer_param",value_desc.get_param_name());
430 synfigapp::SelectionManager::ChildrenList children_list;
431 children_list=get_selection_manager()->get_selected_children();
432 if(!value_desc.parent_is_canvas() && children_list.size()==1)
434 param_list.add("dest",value_desc);
435 param_list.add("src",children_list.front().get_value_node());
442 CanvasInterface::generate_param_list(const std::list<synfigapp::ValueDesc> &value_desc_list)
444 synfigapp::Action::ParamList param_list;
445 param_list.add("time",get_time());
446 param_list.add("canvas_interface",etl::handle<CanvasInterface>(this));
447 param_list.add("canvas",get_canvas());
449 std::list<synfigapp::ValueDesc>::const_iterator iter;
450 for(iter=value_desc_list.begin();iter!=value_desc_list.end();++iter)
452 param_list.add("value_desc",*iter);
453 if(iter->is_value_node())
455 param_list.add("value_node",iter->get_value_node());
464 CanvasInterface::set_rend_desc(const synfig::RendDesc &rend_desc)
466 Action::Handle action(Action::create("canvas_rend_desc_set"));
472 action->set_param("canvas",get_canvas());
473 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
474 action->set_param("rend_desc",rend_desc);
476 if(!get_instance()->perform_action(action))
477 get_ui_interface()->error(_("Action Failed."));
481 CanvasInterface::set_name(const synfig::String &x)
483 Action::Handle action(Action::create("canvas_name_set"));
489 action->set_param("canvas",get_canvas());
490 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
491 action->set_param("name",x);
493 if(!get_instance()->perform_action(action))
494 get_ui_interface()->error(_("Action Failed."));
496 signal_id_changed_();
500 CanvasInterface::set_description(const synfig::String &x)
502 Action::Handle action(Action::create("canvas_description_set"));
508 action->set_param("canvas",get_canvas());
509 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
510 action->set_param("description",x);
512 if(!get_instance()->perform_action(action))
513 get_ui_interface()->error(_("Action Failed."));
517 CanvasInterface::set_id(const synfig::String &x)
519 Action::Handle action(Action::create("canvas_id_set"));
525 action->set_param("canvas",get_canvas());
526 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
527 action->set_param("id",x);
529 if(!get_instance()->perform_action(action))
530 get_ui_interface()->error(_("Action Failed."));
532 signal_id_changed_();
537 CanvasInterface::jump_to_next_keyframe()
539 synfig::info("Current time: %s",get_time().get_string().c_str());
542 synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_next(get_time()));
543 synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
544 set_time(keyframe.get_time());
546 catch(...) { synfig::warning("Unable to find next keyframe"); }
550 CanvasInterface::jump_to_prev_keyframe()
552 synfig::info("Current time: %s",get_time().get_string().c_str());
555 synfig::Keyframe keyframe(*get_canvas()->keyframe_list().find_prev(get_time()));
556 synfig::info("Jumping to keyframe \"%s\" at %s",keyframe.get_description().c_str(),keyframe.get_time().get_string().c_str());
557 set_time(keyframe.get_time());
559 catch(...) { synfig::warning("Unable to find prev keyframe"); }
563 CanvasInterface::import(const synfig::String &filename, bool /*copy*/)
565 Action::PassiveGrouper group(get_instance().get(),_("Import Image"));
567 synfig::info("Attempting to import "+filename);
569 if (filename_extension(filename) == "")
571 get_ui_interface()->error(_("Filename must have an extension!"));
575 String ext(filename_extension(filename));
576 if (ext.size()) ext = ext.substr(1); // skip initial '.'
577 std::transform(ext.begin(),ext.end(),ext.begin(),&::tolower);
579 // If this is a SIF file, then we need to do things slightly differently
580 if(ext=="sif" || ext=="sifz")try
583 Canvas::Handle outside_canvas(synfig::open_canvas(filename));
585 throw String(_("Unable to open this composition"));
587 Layer::Handle layer(add_layer_to("PasteCanvas",get_canvas()));
589 throw String(_("Unable to create \"Paste Canvas\" layer"));
590 if(!layer->set_param("canvas",ValueBase(outside_canvas)))
593 //layer->set_description(basename(filename));
594 signal_layer_new_description()(layer,filename);
599 get_ui_interface()->error(x+" -- "+filename);
604 get_ui_interface()->error(_("Uncaught exception when attempting\nto open this composition -- ")+filename);
608 if(!Importer::book().count(ext))
610 get_ui_interface()->error(_("I don't know how to open images of this type -- ")+ext);
616 Layer::Handle layer(add_layer_to("Import",get_canvas()));
620 if(!layer->set_param("filename",ValueBase(filename)))
622 w=layer->get_param("_width").get(int());
623 h=layer->get_param("_height").get(int());
626 Vector size=ValueBase(get_canvas()->rend_desc().get_br()-get_canvas()->rend_desc().get_tl());
632 if((size[0]<0) ^ (size[1]<0))
639 if((size[0]<0) ^ (size[1]<0))
642 if(!layer->set_param("tl",ValueBase(-x/2)))
644 if(!layer->set_param("br",ValueBase(x/2)))
649 if(!layer->set_param("tl",ValueBase(get_canvas()->rend_desc().get_tl())))
651 if(!layer->set_param("br",ValueBase(get_canvas()->rend_desc().get_br())))
655 layer->set_description(basename(filename));
656 signal_layer_new_description()(layer,filename);
662 get_ui_interface()->error("Unable to import "+filename);
670 CanvasInterface::waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
672 ValueNode::Handle value_node();
673 waypoint_duplicate(value_desc.get_value_node(), waypoint);
677 CanvasInterface::waypoint_duplicate(ValueNode::Handle value_node,synfig::Waypoint waypoint)
679 Action::Handle action(Action::create("waypoint_set_smart"));
685 waypoint.make_unique();
686 waypoint.set_time(get_time());
688 action->set_param("canvas",get_canvas());
689 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
690 action->set_param("waypoint",waypoint);
691 action->set_param("time",get_time());
692 action->set_param("value_node",value_node);
694 if(!get_instance()->perform_action(action))
695 get_ui_interface()->error(_("Action Failed."));
699 CanvasInterface::waypoint_remove(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint)
701 ValueNode::Handle value_node();
702 waypoint_remove(value_desc.get_value_node(), waypoint);
706 CanvasInterface::waypoint_remove(ValueNode::Handle value_node,synfig::Waypoint waypoint)
708 Action::Handle action(Action::create("waypoint_remove"));
714 action->set_param("canvas",get_canvas());
715 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
716 action->set_param("waypoint",waypoint);
717 action->set_param("value_node",value_node);
719 if(!get_instance()->perform_action(action))
720 get_ui_interface()->error(_("Action Failed."));
725 CanvasInterface::auto_export(synfig::ValueNode::Handle /*value_node*/)
728 // Check to see if we are already exported.
729 if(value_node->is_exported())
732 Action::Handle action(Action::create("value_node_add"));
738 String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
740 action->set_param("canvas",get_canvas());
741 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
742 action->set_param("new",value_node);
743 action->set_param("name",name);
745 if(!get_instance()->perform_action(action))
746 get_ui_interface()->error(_("Action Failed."));
751 CanvasInterface::auto_export(const ValueDesc& /*value_desc*/)
753 // THIS FUNCTION IS DEPRECATED, AND IS NOW A STUB.
755 // Check to see if we are already exported.
756 if(value_desc.is_exported())
759 Action::Handle action(Action::create("value_desc_export"));
765 String name(strprintf(_("Unnamed%08d"),synfig::UniqueID().get_uid()));
767 action->set_param("canvas",get_canvas());
768 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
769 action->set_param("value_desc",value_desc);
770 action->set_param("name",name);
772 if(!get_instance()->perform_action(action))
773 get_ui_interface()->error(_("Action Failed."));
778 CanvasInterface::change_value(synfigapp::ValueDesc value_desc,synfig::ValueBase new_value)
780 // If this isn't really a change, then don't bother
781 if(new_value==value_desc.get_value(get_time()))
784 // If this change needs to take place elsewhere, then so be it.
785 if(value_desc.get_canvas())
787 if (value_desc.get_canvas()->get_root() != get_canvas()->get_root())
789 etl::handle<Instance> instance;
790 instance=find_instance(value_desc.get_canvas()->get_root());
793 return instance->find_canvas_interface(value_desc.get_canvas())->change_value(value_desc,new_value);
796 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."));
803 { synfig::warning("Can't get canvas from value desc...?"); }
806 synfigapp::Action::Handle action(synfigapp::Action::create("value_desc_set"));
812 action->set_param("canvas",get_canvas());
813 action->set_param("canvas_interface",etl::loose_handle<CanvasInterface>(this));
814 action->set_param("time",get_time());
815 action->set_param("value_desc",value_desc);
816 action->set_param("new_value",new_value);
818 return get_instance()->perform_action(action);
822 CanvasInterface::set_meta_data(const synfig::String& key,const synfig::String& data)
824 get_canvas()->set_meta_data(key,data);
828 // this function goes with find_important_value_descs()
830 _process_value_desc(const synfigapp::ValueDesc& value_desc,std::vector<synfigapp::ValueDesc>& out, synfig::GUIDSet& guid_set)
834 if(value_desc.get_value_type()==ValueBase::TYPE_CANVAS)
836 Canvas::Handle canvas;
837 canvas=value_desc.get_value().get(canvas);
838 if(!canvas || !canvas->is_inline())
840 ret+=CanvasInterface::find_important_value_descs(canvas,out,guid_set);
843 if(value_desc.is_value_node())
845 ValueNode::Handle value_node(value_desc.get_value_node());
847 if(guid_set.count(value_node->get_guid()))
849 guid_set.insert(value_node->get_guid());
851 if(LinkableValueNode::Handle::cast_dynamic(value_node))
853 if(ValueNode_DynamicList::Handle::cast_dynamic(value_node))
855 out.push_back(value_desc);
858 // Process the linkable ValueNode's children
859 LinkableValueNode::Handle value_node_copy(LinkableValueNode::Handle::cast_dynamic(value_node));
861 for(i=0;i<value_node_copy->link_count();i++)
863 ValueNode::Handle link(value_node_copy->get_link(i));
864 if(!link->is_exported())
865 ret+=_process_value_desc(ValueDesc(value_node_copy,i),out,guid_set);
868 else if(ValueNode_Animated::Handle::cast_dynamic(value_node))
870 out.push_back(value_desc);
879 CanvasInterface::find_important_value_descs(synfig::Canvas::Handle canvas,std::vector<synfigapp::ValueDesc>& out,synfig::GUIDSet& guid_set)
882 if(!canvas->is_inline())
884 ValueNodeList::const_iterator iter;
887 iter=canvas->value_node_list().begin();
888 iter!=canvas->value_node_list().end();
890 ret+=_process_value_desc(ValueDesc(canvas,(*iter)->get_id()),out,guid_set);
893 Canvas::const_iterator iter;
895 for(iter=canvas->begin();iter!=canvas->end();++iter)
897 Layer::Handle layer(*iter);
899 Layer::DynamicParamList::const_iterator iter;
901 iter=layer->dynamic_param_list().begin();
902 iter!=layer->dynamic_param_list().end();
905 if(!iter->second->is_exported())
906 ret+=_process_value_desc(ValueDesc(layer,iter->first),out,guid_set);
908 ValueBase value(layer->get_param("canvas"));
910 ret+=_process_value_desc(ValueDesc(layer,"canvas"),out,guid_set);
917 CanvasInterface::find_important_value_descs(std::vector<synfigapp::ValueDesc>& out)
920 return find_important_value_descs(get_canvas(),out,tmp);
924 CanvasInterface::seek_frame(int frames)
928 float fps(get_canvas()->rend_desc().get_frame_rate());
929 Time newtime(get_time()+(float)frames/fps);
930 newtime=newtime.round(fps);
932 if(newtime<=get_canvas()->rend_desc().get_time_start())
933 newtime=get_canvas()->rend_desc().get_time_start();
934 if(newtime>=get_canvas()->rend_desc().get_time_end())
935 newtime=get_canvas()->rend_desc().get_time_end();
940 CanvasInterface::seek_time(synfig::Time time)
945 float fps(get_canvas()->rend_desc().get_frame_rate());
947 if(time>=synfig::Time::end())
949 set_time(get_canvas()->rend_desc().get_time_end());
952 if(time<=synfig::Time::begin())
954 set_time(get_canvas()->rend_desc().get_time_start());
958 Time newtime(get_time()+time);
959 newtime=newtime.round(fps);
961 if(newtime<=get_canvas()->rend_desc().get_time_start())
962 newtime=get_canvas()->rend_desc().get_time_start();
963 if(newtime>=get_canvas()->rend_desc().get_time_end())
964 newtime=get_canvas()->rend_desc().get_time_end();