26 #ifndef __SYNFIG_MODULE_H
27 #define __SYNFIG_MODULE_H
47 #define MODULE_DESC_BEGIN(x) struct x##_modclass : public synfig::Module { x##_modclass(synfig::ProgressCallback *callback=NULL);
50 #define MODULE_NAME(x) virtual const char * Name() { return x; }
53 #define MODULE_DESCRIPTION(x) virtual const char * Desc() { return x; }
56 #define MODULE_AUTHOR(x) virtual const char * Author() { return x; }
59 #define MODULE_VERSION(x) virtual const char * Version() { return x; }
62 #define MODULE_COPYRIGHT(x) virtual const char * Copyright() { return x; }
65 #define MODULE_CONSTRUCTOR(x) bool constructor_(synfig::ProgressCallback *cb) { return x(cb); }
68 #define MODULE_DESTRUCTOR(x) virtual void destructor_() { return x(); }
71 #define MODULE_DESC_END };
76 #define MODULE_INVENTORY_BEGIN(x) extern "C" { \
77 synfig::Module* _##x##_LTX_new_instance(synfig::ProgressCallback *cb) \
78 { if(SYNFIG_CHECK_VERSION()){x##_modclass *mod=new x##_modclass(cb); mod->constructor_(cb); return mod; }\
79 if(cb)cb->error(#x": Unable to load module due to version mismatch."); return NULL; } \
80 }; x##_modclass::x##_modclass(synfig::ProgressCallback *) {
83 #define MODULE_INVENTORY_BEGIN(x) extern "C" { \
84 synfig::Module* x##_LTX_new_instance(synfig::ProgressCallback *cb) \
85 { if(SYNFIG_CHECK_VERSION()){x##_modclass *mod=new x##_modclass(cb); mod->constructor_(cb); return mod; }\
86 if(cb)cb->error(#x": Unable to load module due to version mismatch."); return NULL; } \
87 }; x##_modclass::x##_modclass(synfig::ProgressCallback *) {
91 #define BEGIN_LAYERS {
100 #define LAYER(class) \
101 synfig::Layer::register_in_book( \
102 synfig::Layer::BookEntry(class::create, \
104 dgettext("synfig", class::local_name__), \
110 #define LAYER_ALIAS(class,alias) \
111 synfig::Layer::register_in_book( \
112 synfig::Layer::BookEntry(class::create, \
115 CATEGORY_DO_NOT_USE, \
123 #define BEGIN_TARGETS {
126 synfig::Target::book()[synfig::String(x::name__)].factory = \
127 reinterpret_cast<synfig::Target::Factory> (x::create); \
128 synfig::Target::book()[synfig::String(x::name__)].filename = \
129 synfig::String(x::ext__); \
130 synfig::Target::book()[synfig::String(x::name__)].target_param = \
131 synfig::TargetParam(); \
132 synfig::Target::ext_book()[synfig::String(x::ext__)]=x::name__;
134 #define TARGET_EXT(x,y) synfig::Target::ext_book()[synfig::String(y)]=x::name__;
137 #define END_TARGETS }
140 #define BEGIN_IMPORTERS {
143 #define IMPORTER_EXT(x,y) \
144 synfig::Importer::book()[synfig::String(y)]=synfig::Importer::BookEntry(x::create, x::supports_file_system_wrapper__);
147 #define IMPORTER(x) IMPORTER_EXT(x,x::ext__)
150 #define CAIROIMPORTER_EXT(x,y) \
151 synfig::CairoImporter::book()[synfig::String(y)]=synfig::CairoImporter::BookEntry(x::create, x::supports_file_system_wrapper__);
154 #define CAIROIMPORTER(x) CAIROIMPORTER_EXT(x,x::ext__)
157 #define END_IMPORTERS }
160 #define BEGIN_VALUENODES { synfig::LinkableValueNode::Book &book(synfig::LinkableValueNode::book());
163 #define VALUENODE(class,name,local,version) \
164 book[name].factory=reinterpret_cast<synfig::LinkableValueNode::Factory>(&class::create); \
165 book[name].check_type=&class::check_type; \
166 book[name].local_name=local; \
167 book[name].release_version=version;
170 #define END_VALUENODES }
173 #define MODULE_INVENTORY_END }
181 class ProgressCallback;
200 typedef std::map<String, Handle >
Book;
221 virtual const char *
Name() {
return " "; }
222 virtual const char *
Desc() {
return " "; }
223 virtual const char *
Author() {
return " "; }
224 virtual const char *
Version() {
return " "; }