From 6d911b8b43b6a82b5373c3acaf6d4007aa999e0d Mon Sep 17 00:00:00 2001 From: dooglus Date: Fri, 14 Nov 2008 17:52:30 +0000 Subject: [PATCH] Fix 2116947: "Pasting/importing across different image areas". When pasting nested pastecanvases, update the renddesc of all of them rather than just the outermost one. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2200 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/layer_pastecanvas.cpp | 18 ++++++++++++++++++ synfig-core/trunk/src/synfig/layer_pastecanvas.h | 2 ++ synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index e456a03..2423392 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -241,6 +241,24 @@ Layer_PasteCanvas::set_sub_canvas(etl::handle x) on_canvas_set(); } +// when a pastecanvas that contains another pastecanvas is copy/pasted +// from one document to another, only the outermost pastecanvas was +// getting its renddesc set to match that of its new parent. this +// function is used to recurse through the pastecanvas copying its +// renddesc to any pastecanvases it contains (bug #2116947, svn r2200) +void +Layer_PasteCanvas::update_renddesc() +{ + if(!get_canvas() || !canvas || !canvas->is_inline()) return; + + canvas->rend_desc()=get_canvas()->rend_desc(); + for (Context context = canvas->get_context(); !context->empty(); context++) + { + etl::handle paste = etl::handle::cast_dynamic(*context); + if (paste) paste->update_renddesc(); + } +} + // This is called whenever the parent canvas gets set/changed void Layer_PasteCanvas::on_canvas_set() diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.h b/synfig-core/trunk/src/synfig/layer_pastecanvas.h index 843ee1e..3a3811e 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.h +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.h @@ -99,6 +99,8 @@ private: bool extra_reference; public: + void update_renddesc(); + virtual void on_canvas_set(); void set_muck_with_time(bool x=false) { muck_with_time_=x; } diff --git a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp index 5b7834c..26769ff 100644 --- a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp +++ b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp @@ -33,6 +33,7 @@ #include "layeractionmanager.h" #include "layertree.h" #include +#include #include #include "instance.h" #include @@ -400,6 +401,9 @@ LayerActionManager::paste() return; } + etl::handle paste = etl::handle::cast_dynamic(layer); + if (paste) paste->update_renddesc(); + // synfig::info("DEPTH=%d",depth); // Action to move the layer (if necessary) -- 2.7.4