Show a warning when using file>import to import a .sif file which references itself...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 17 Nov 2008 10:21:29 +0000 (10:21 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 17 Nov 2008 10:21:29 +0000 (10:21 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2204 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/synfigapp/canvasinterface.cpp
synfig-studio/trunk/src/synfigapp/canvasinterface.h

index a9bda67..1abce20 100644 (file)
@@ -3461,8 +3461,11 @@ CanvasView::on_drop_drag_data_received(const Glib::RefPtr<Gdk::DragContext>& 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
index 297b7f2..13e5871 100644 (file)
@@ -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;
index ba4dbb3..5bb3ec0 100644 (file)
@@ -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);