From: dooglus Date: Sun, 9 Nov 2008 17:24:01 +0000 (+0000) Subject: Four of the modules provide features available from the tools in the main toolbox... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=10607b8897203cd8c6606827e01bb94508645775;p=synfig.git Four of the modules provide features available from the tools in the main toolbox. If any of these four modules fails to load, refuse to start studio. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2173 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-core/trunk/src/synfig/main.cpp b/synfig-core/trunk/src/synfig/main.cpp index edc0b64..7643590 100644 --- a/synfig-core/trunk/src/synfig/main.cpp +++ b/synfig-core/trunk/src/synfig/main.cpp @@ -308,6 +308,8 @@ synfig::Main::Main(const synfig::String& basepath,ProgressCallback *cb): std::list::iterator iter; + Module::register_default_modules(cb); + for(i=0,iter=modules_to_load.begin();iter!=modules_to_load.end();++iter,i++) { Module::Register(*iter,cb); diff --git a/synfig-core/trunk/src/synfig/module.cpp b/synfig-core/trunk/src/synfig/module.cpp index 3e026a4..7d32db2 100644 --- a/synfig-core/trunk/src/synfig/module.cpp +++ b/synfig-core/trunk/src/synfig/module.cpp @@ -95,10 +95,15 @@ Module::subsys_stop() return true; } -bool -register_default_modules() +void +Module::register_default_modules(ProgressCallback *callback) { - return true; + #define REGISTER_MODULE(module) if (!Register(module, callback)) \ + throw std::runtime_error(strprintf(_("Unable to load module '%s'"), module)) + REGISTER_MODULE("lyr_freetype"); + REGISTER_MODULE("mod_geometry"); + REGISTER_MODULE("mod_gradient"); + REGISTER_MODULE("mod_particle"); } Module::Book& @@ -184,5 +189,5 @@ synfig::Module::Register(const String &module_name, ProgressCallback *callback) if(callback)callback->task(strprintf(_("Success for \"%s\""),module_name.c_str())); #endif - return false; + return true; } diff --git a/synfig-core/trunk/src/synfig/module.h b/synfig-core/trunk/src/synfig/module.h index a1d63ed..26638cd 100644 --- a/synfig-core/trunk/src/synfig/module.h +++ b/synfig-core/trunk/src/synfig/module.h @@ -182,7 +182,7 @@ public: static bool subsys_init(const String &prefix); static bool subsys_stop(); - static bool register_default_modules(); + static void register_default_modules(ProgressCallback *cb=NULL); static void Register(Handle mod); static bool Register(const String &module_name, ProgressCallback *cb=NULL);