X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fapp.cpp;h=18cab60718d31006cd071894dbf9832b66f466df;hb=930476c3da70528b28ea747f93ebbf48a42e2f54;hp=8525e0a8285a39160cb2bd037a6579b260eb3671;hpb=859a0475c289b406b9cc75473a52757dc859f1d1;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 8525e0a..18cab60 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -8,6 +8,7 @@ ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** Copyright (c) 2007, 2008 Chris Moore ** Copyright (c) 2008 Gerald Young +** Copyright (c) 2008 Carlos López ** ** This package is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public License as @@ -274,6 +275,7 @@ bool studio::App::use_colorspace_gamma=true; bool studio::App::single_threaded=false; #endif bool studio::App::restrict_radius_ducks=false; +bool studio::App::resize_imported_images=false; String studio::App::custom_filename_prefix(DEFAULT_FILENAME_PREFIX); int studio::App::preferred_x_size=480; int studio::App::preferred_y_size=270; @@ -510,6 +512,11 @@ public: value=strprintf("%i",(int)App::restrict_radius_ducks); return true; } + if(key=="resize_imported_images") + { + value=strprintf("%i",(int)App::resize_imported_images); + return true; + } if(key=="browser_command") { value=App::browser_command; @@ -599,6 +606,12 @@ public: App::restrict_radius_ducks=i; return true; } + if(key=="resize_imported_images") + { + int i(atoi(value.c_str())); + App::resize_imported_images=i; + return true; + } if(key=="browser_command") { App::browser_command=value; @@ -642,6 +655,7 @@ public: #endif ret.push_back("auto_recover_backup_interval"); ret.push_back("restrict_radius_ducks"); + ret.push_back("resize_imported_images"); ret.push_back("browser_command"); ret.push_back("custom_filename_prefix"); ret.push_back("preferred_x_size"); @@ -1142,6 +1156,11 @@ App::App(int *argc, char ***argv): // Initialize the Synfig library try { synfigapp_main=etl::smart_ptr(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); } + catch(std::runtime_error x) + { + get_ui_interface()->error(strprintf("%s\n\n%s", _("Failed to initialize synfig!"), x.what())); + throw; + } catch(...) { get_ui_interface()->error(_("Failed to initialize synfig!")); @@ -1256,9 +1275,7 @@ App::App(int *argc, char ***argv): if(!getenv("SYNFIG_DISABLE_DRAW" )) state_manager->add_state(&state_draw); // Enabled for now. Let's see whether they're good enough yet. if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch); - - // Disabled by default - it doesn't work properly? - if(getenv("SYNFIG_ENABLE_WIDTH" )) state_manager->add_state(&state_width); + if(!getenv("SYNFIG_DISABLE_WIDTH" )) state_manager->add_state(&state_width); // Enabled since 0.61.09 studio_init_cb.task(_("Init ModPalette...")); module_list_.push_back(new ModPalette()); module_list_.back()->start(); @@ -1433,7 +1450,8 @@ App::set_recent_file_window_size(etl::handle instance) // find the canvas synfig::Canvas::Handle canvas; try { - canvas = instance->get_canvas()->find_canvas(String(canvas_window_size, current, separator-current)); + String warnings; + canvas = instance->get_canvas()->find_canvas(String(canvas_window_size, current, separator-current), warnings); } catch(Exception::IDNotFound) { // can't find the canvas; skip to the next canvas or return @@ -1728,6 +1746,7 @@ App::reset_initial_window_configuration() synfigapp::Main::settings().set_value("pref.single_threaded","0"); #endif synfigapp::Main::settings().set_value("pref.restrict_radius_ducks","0"); + synfigapp::Main::settings().set_value("pref.resize_imported_images","0"); synfigapp::Main::settings().set_value("pref.custom_filename_prefix",DEFAULT_FILENAME_PREFIX); synfigapp::Main::settings().set_value("pref.preferred_x_size","480"); synfigapp::Main::settings().set_value("pref.preferred_y_size","270"); @@ -2340,8 +2359,9 @@ App::open_as(std::string filename,std::string as) try { OneMoment one_moment; + String errors, warnings; - etl::handle canvas(open_canvas_as(filename,as)); + etl::handle canvas(open_canvas_as(filename,as,errors,warnings)); if(canvas && get_instance(canvas)) { get_instance(canvas)->find_canvas_view(canvas)->present(); @@ -2351,8 +2371,11 @@ App::open_as(std::string filename,std::string as) else { if(!canvas) - throw (String)strprintf(_("Unable to open file \"%s\""),filename.c_str()); + throw (String)strprintf(_("Unable to load \"%s\":\n\n"),filename.c_str()) + errors; + if (warnings != "") + dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); + if (as.find(custom_filename_prefix.c_str()) != 0) add_recent_file(as); @@ -2374,6 +2397,11 @@ App::open_as(std::string filename,std::string as) dialog_error_blocking(_("Error"), x); return false; } + catch(runtime_error x) + { + dialog_error_blocking(_("Error"), x.what()); + return false; + } catch(...) { dialog_error_blocking(_("Error"), _("Uncaught error on file open (BUG)"));