From bb274448aa12e134bf978eef38f3c2d965e35db9 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 17 Nov 2008 10:21:29 +0000 Subject: [PATCH] Show a warning when using file>import to import a .sif file which references itself recursively. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2204 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/canvasview.cpp | 12 ++++++++++-- synfig-studio/trunk/src/synfigapp/canvasinterface.cpp | 3 +-- synfig-studio/trunk/src/synfigapp/canvasinterface.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index a9bda67..1abce20 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -3461,8 +3461,11 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr& con } else { - if(canvas_interface()->import(filename, App::resize_imported_images)) + String errors, warnings; + if(canvas_interface()->import(filename, errors, warnings, App::resize_imported_images)) success=true; + if (warnings != "") + App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); } continue; @@ -3569,8 +3572,13 @@ CanvasView::image_import() { // String filename(dirname(get_canvas()->get_file_name())); String filename("*.*"); + String errors, warnings; if(App::dialog_open_file(_("Import Image"), filename, IMAGE_DIR_PREFERENCE)) - canvas_interface()->import(filename, App::resize_imported_images); + { + canvas_interface()->import(filename, errors, warnings, App::resize_imported_images); + if (warnings != "") + App::dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); + } } Smach::event_result diff --git a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp index 297b7f2..13e5871 100644 --- a/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp +++ b/synfig-studio/trunk/src/synfigapp/canvasinterface.cpp @@ -560,7 +560,7 @@ CanvasInterface::jump_to_prev_keyframe() } bool -CanvasInterface::import(const synfig::String &filename, bool resize_image) +CanvasInterface::import(const synfig::String &filename, synfig::String &errors, synfig::String &warnings, bool resize_image) { Action::PassiveGrouper group(get_instance().get(),_("Import Image")); @@ -579,7 +579,6 @@ CanvasInterface::import(const synfig::String &filename, bool resize_image) // If this is a SIF file, then we need to do things slightly differently if(ext=="sif" || ext=="sifz")try { - String errors, warnings; Canvas::Handle outside_canvas(synfig::open_canvas(filename, errors, warnings)); if(!outside_canvas) throw String(_("Unable to open this composition")) + ":\n\n" + errors; diff --git a/synfig-studio/trunk/src/synfigapp/canvasinterface.h b/synfig-studio/trunk/src/synfigapp/canvasinterface.h index ba4dbb3..5bb3ec0 100644 --- a/synfig-studio/trunk/src/synfigapp/canvasinterface.h +++ b/synfig-studio/trunk/src/synfigapp/canvasinterface.h @@ -271,7 +271,7 @@ public: void set_rend_desc(const synfig::RendDesc &rend_desc); - bool import(const synfig::String &filename, bool resize_image=false); + bool import(const synfig::String &filename, synfig::String &errors, synfig::String &warnings, bool resize_image=false); void waypoint_duplicate(synfigapp::ValueDesc value_desc,synfig::Waypoint waypoint); -- 2.7.4