#include "time.h"
#include "context.h"
#include "layer_pastecanvas.h"
+#include "loadcanvas.h"
#include <sigc++/bind.h>
#endif
/* === M A C R O S ========================================================= */
+#define ALLOW_CLONE_NON_INLINE_CANVASES
+
struct _CanvasCounter
{
static int counter;
{
name=get_id()+"_CLONE";
+#ifndef ALLOW_CLONE_NON_INLINE_CANVASES
throw runtime_error("Cloning of non-inline canvases is not yet supported");
+#endif // ALLOW_CLONE_NON_INLINE_CANVASES
}
Handle canvas(new Canvas(name));
parent()->set_file_name(file_name);
else
{
+ String old_name(file_name_);
file_name_=file_name;
- signal_file_name_changed_();
+
+ // when a canvas is made, its name is ""
+ // then, before it's saved or even edited, it gets a name like "Synfig Animation 23", in the local language
+ // we don't want to register the canvas' filename in the canvas map until it gets a real filename
+ if (old_name != "")
+ {
+ file_name_=file_name;
+ std::map<synfig::String, etl::loose_handle<Canvas> >::iterator iter;
+ for(iter=get_open_canvas_map().begin();iter!=get_open_canvas_map().end();++iter)
+ if(iter->second==this)
+ break;
+ if (iter == get_open_canvas_map().end())
+ CanvasParser::register_canvas_in_map(this, file_name);
+ else
+ signal_file_name_changed_();
+ }
}
}
!composite->reads_context())
{
Canvas::Handle sub_canvas(Canvas::create_inline(op_canvas));
- sub_canvas->push_back(composite = composite->clone());
+ // don't use clone() because it re-randomizes the seeds of any random valuenodes
+ sub_canvas->push_back(composite = composite->simple_clone());
layer = Layer::create("PasteCanvas");
composite->set_description(strprintf("Wrapped clone of '%s'", composite->get_non_empty_description().c_str()));
layer->set_description(strprintf("PasteCanvas wrapper for '%s'", composite->get_non_empty_description().c_str()));