26 #ifndef __SYNFIG_APP_ACTION_H
27 #define __SYNFIG_APP_ACTION_H
31 #include <synfig/string.h>
32 #include <synfig/canvas.h>
34 #include <ETL/stringf>
35 #include <ETL/trivial>
40 #include <synfig/layer.h>
41 #include <synfig/canvas.h>
42 #include <synfig/valuenode.h>
44 #include <synfig/value.h>
45 #include <synfig/activepoint.h>
46 #include <synfig/valuenodes/valuenode_animated.h>
47 #include <synfig/string.h>
48 #include <synfig/keyframe.h>
55 #define ACTION_MODULE_EXT public: \
56 static const char name__[], local_name__[], version__[], cvs_id__[], task__[]; \
57 static const Category category__; \
58 static const int priority__; \
59 static Action::Base *create(); \
60 virtual synfig::String get_name()const; \
61 virtual synfig::String get_local_name()const;
64 #define ACTION_SET_NAME(class,x) const char class::name__[]=x
66 #define ACTION_SET_CATEGORY(class,x) const Category class::category__(x)
68 #define ACTION_SET_TASK(class,x) const char class::task__[]=x
70 #define ACTION_SET_PRIORITY(class,x) const int class::priority__=x
72 #define ACTION_SET_LOCAL_NAME(class,x) const char class::local_name__[]=x
74 #define ACTION_SET_VERSION(class,x) const char class::version__[]=x
76 #define ACTION_SET_CVS_ID(class,x) const char class::cvs_id__[]=x
79 #define ACTION_INIT_NO_GET_LOCAL_NAME(class) \
80 Action::Base* class::create() { return new class(); } \
81 synfig::String class::get_name()const { return name__; }
83 #define ACTION_INIT(class) \
84 ACTION_INIT_NO_GET_LOCAL_NAME(class) \
85 synfig::String class::get_local_name()const { return dgettext("synfigstudio",local_name__); }
92 class ProgressCallback;
124 synfig::String desc_;
132 va_start(args,format);
133 desc_=etl::vstrprintf(format,args);
140 va_start(args,format);
141 desc_=etl::vstrprintf(format,args);
182 {
return static_cast<Category>(int(lhs)|int(rhs)); }
197 class Base :
public etl::shared_object
212 virtual synfig::String
get_name()
const =0;
217 static synfig::String
get_layer_descriptions(
const std::list<synfig::Layer::Handle> layers, synfig::String singular_prefix =
"", synfig::String plural_prefix =
"");
218 static synfig::String
get_layer_descriptions(
const std::list<std::pair<synfig::Layer::Handle,int> > layers, synfig::String singular_prefix =
"", synfig::String plural_prefix =
"");
241 void set_active(
bool x) { active_=x; }
246 virtual void undo()=0;
251 virtual void ref()
const;
252 virtual bool unref()
const;
263 etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
282 virtual bool set_param(
const synfig::String& name,
const Param &);
295 typedef std::list< etl::handle<Action::Undoable> >
ActionList;
318 void add_action(etl::handle<Undoable> action);
330 synfig::String name_;
336 Group(
const synfig::String &str=
"Group");
339 virtual synfig::String
get_name()
const {
return name_; }
343 virtual bool set_param(
const synfig::String& ,
const Param &)
const {
return false; }
368 typedef std::map<synfig::String,BookEntry>
Book;
373 iterator
find(
const synfig::String& x);