Use map of static values indexed by parameter name instead of the macros and the...
authorCarlos Lopez <genetita@gmail.com>
Sat, 28 Aug 2010 09:10:56 +0000 (11:10 +0200)
committerCarlos Lopez <genetita@gmail.com>
Sat, 28 Aug 2010 09:10:56 +0000 (11:10 +0200)
15 files changed:
synfig-core/src/modules/lyr_std/curvewarp.cpp
synfig-core/src/modules/lyr_std/curvewarp.h
synfig-core/src/modules/mod_filter/blur.cpp
synfig-core/src/modules/mod_filter/blur.h
synfig-core/src/modules/mod_filter/radialblur.cpp
synfig-core/src/modules/mod_filter/radialblur.h
synfig-core/src/modules/mod_geometry/circle.cpp
synfig-core/src/modules/mod_geometry/circle.h
synfig-core/src/synfig/layer.h
synfig-core/src/synfig/layer_bitmap.cpp
synfig-core/src/synfig/layer_bitmap.h
synfig-core/src/synfig/layer_motionblur.cpp
synfig-core/src/synfig/layer_motionblur.h
synfig-core/src/synfig/layer_pastecanvas.cpp
synfig-core/src/synfig/layer_pastecanvas.h

index 4e6306a..865d35f 100644 (file)
@@ -169,6 +169,8 @@ CurveWarp::CurveWarp():
        bline[1].set_width(1.0f);
 
        sync();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 inline Point
@@ -380,27 +382,12 @@ CurveWarp::get_param(const String & param)const
 bool
 CurveWarp::set_param_static(const String &param, const bool x)
 {
-
-       SET_STATIC(origin, x)
-       SET_STATIC(perp_width, x)
-       SET_STATIC(start_point, x)
-       SET_STATIC(end_point, x)
-       SET_STATIC(fast, x)
-
        return Layer::set_param_static(param, x);
 }
 
 bool
 CurveWarp::get_param_static(const String &param)const
 {
-
-       GET_STATIC(origin)
-       GET_STATIC(perp_width)
-       GET_STATIC(start_point)
-       GET_STATIC(end_point)
-       GET_STATIC(fast)
-
-
        return Layer::get_param_static(param);
 }
 
index cb79e8f..ae83ba0 100644 (file)
@@ -60,12 +60,6 @@ private:
        Vector perp_;
        bool fast;
 
-       bool origin_static;
-       bool perp_width_static;
-       bool start_point_static;
-       bool end_point_static;
-       bool fast_static;
-
        void sync();
 
 public:
index 5ef3567..7946c36 100644 (file)
@@ -80,10 +80,11 @@ inline void clamp(synfig::Vector &v)
 Blur_Layer::Blur_Layer():
        Layer_Composite(1.0,Color::BLEND_STRAIGHT),
        size(0.1,0.1),
-       type(Blur::FASTGAUSSIAN),
-       size_static(false),
-       type_static(true)
+       type(Blur::FASTGAUSSIAN)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("blend_method", true);
 }
 
 bool
@@ -110,20 +111,12 @@ Blur_Layer::get_param(const String &param)const
 bool
 Blur_Layer::set_param_static(const String &param, const bool x)
 {
-
-       SET_STATIC(size, x)
-       SET_STATIC(type, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
 bool
 Blur_Layer::get_param_static(const String &param)const
 {
-
-       GET_STATIC(size)
-       GET_STATIC(type)
-
        return Layer_Composite::get_param_static(param);
 }
 
index c51946f..419c6a4 100644 (file)
@@ -44,9 +44,6 @@ private:
        synfig::Point   size;
        int                             type;
 
-       bool size_static;
-       bool type_static;
-
 public:
        Blur_Layer();
 
index ad54927..f5d5972 100644 (file)
@@ -69,6 +69,9 @@ RadialBlur::RadialBlur():
        size    (0.2),
        fade_out(false)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("blend_method",true);
 }
 
 RadialBlur::~RadialBlur()
@@ -101,22 +104,12 @@ RadialBlur::get_param(const String &param)const
 bool
 RadialBlur::set_param_static(const String &param, const bool x)
 {
-
-       SET_STATIC(origin, x)
-       SET_STATIC(size, x)
-       SET_STATIC(fade_out, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
 bool
 RadialBlur::get_param_static(const String &param)const
 {
-
-       GET_STATIC(origin)
-       GET_STATIC(size)
-       GET_STATIC(fade_out)
-
        return Layer_Composite::get_param_static(param);
 }
 
index dd4a402..fad7b30 100644 (file)
@@ -53,10 +53,6 @@ private:
        Real size;
        bool fade_out;
 
-       bool origin_static;
-       bool size_static;
-       bool fade_out_static;
-
 public:
        RadialBlur();
        ~RadialBlur();
index db5ff8a..6721ad4 100644 (file)
@@ -66,15 +66,11 @@ Circle::Circle():
        radius                  (1),
        feather                 (0),
        invert                  (false),
-       falloff                 (FALLOFF_INTERPOLATION_LINEAR),
-       color_static    (false),
-       origin_static   (false),
-       radius_static   (false),
-       feather_static  (false),
-       invert_static   (true),
-       falloff_static  (true)
+       falloff                 (FALLOFF_INTERPOLATION_LINEAR)
 {
        constructcache();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
@@ -126,14 +122,6 @@ Circle::get_param(const String &param)const
 bool
 Circle::set_param_static(const String &param, const bool x)
 {
-
-       SET_STATIC(color, x)
-       SET_STATIC(radius, x)
-       SET_STATIC(feather, x)
-       SET_STATIC(invert, x)
-       SET_STATIC(origin, x)
-       SET_STATIC(falloff, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
@@ -141,14 +129,6 @@ Circle::set_param_static(const String &param, const bool x)
 bool
 Circle::get_param_static(const String &param) const
 {
-
-       GET_STATIC(color)
-       GET_STATIC(radius)
-       GET_STATIC(feather)
-       GET_STATIC(invert)
-       GET_STATIC(origin)
-       GET_STATIC(falloff)
-
        return Layer_Composite::get_param_static(param);
 }
 
index e6624e8..29193c3 100644 (file)
@@ -53,13 +53,6 @@ private:
        bool invert;
        int falloff;
 
-       bool color_static;
-       bool origin_static;
-       bool radius_static;
-       bool feather_static;
-       bool invert_static;
-       bool falloff_static;
-
        //Caching system for circle
        struct CircleDataCache
        {
index 46657f0..87ec5bb 100644 (file)
 //! This is used as the category for layer book entries which represent aliases of layers.
 //! It prevents these layers showing up in the menu.
 #define CATEGORY_DO_NOT_USE "Do Not Use"
-
+/*
 //! x=variable name, y=static bool value
 #define SET_STATIC(x,y)                                                                                                                                        \
        if(param==#x && x ## _static != y)                                                                                                      \
 #define GET_STATIC(x)                                                                                                                                  \
        if(param==#x)                                                                                                                                           \
                return x ## _static;                                                                                                                    \
-
+*/
 
 /* === T Y P E D E F S ===================================================== */
 
index 7338078..742b023 100644 (file)
@@ -67,12 +67,11 @@ synfig::Layer_Bitmap::Layer_Bitmap():
        c                               (1),
        surface                 (128,128),
        trimmed                 (false),
-       gamma_adjust    (1.0),
-       tl_static               (false),
-       br_static               (false),
-       c_static                (true),
-       gamma_adjust_static(false)
+       gamma_adjust    (1.0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("c", true);
 }
 
 bool
@@ -530,12 +529,6 @@ Layer_Bitmap::get_bounding_rect()const
 bool
 Layer_Bitmap::set_param_static(const String &param, const bool x)
 {
-
-       SET_STATIC(tl, x)
-       SET_STATIC(br, x)
-       SET_STATIC(c, x)
-       SET_STATIC(gamma_adjust, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
@@ -543,11 +536,5 @@ Layer_Bitmap::set_param_static(const String &param, const bool x)
 bool
 Layer_Bitmap::get_param_static(const String &param) const
 {
-
-       GET_STATIC(tl)
-       GET_STATIC(br)
-       GET_STATIC(c)
-       GET_STATIC(gamma_adjust)
-
        return Layer_Composite::get_param_static(param);
 }
index 7578f8c..018570d 100644 (file)
@@ -50,15 +50,11 @@ public:
        Point tl;
        Point br;
        int c;
-       bool tl_static;
-       bool br_static;
-       bool c_static;
        mutable Surface surface;
        mutable bool trimmed;
        mutable unsigned int width, height, top, left;
 
        Real gamma_adjust;
-       bool gamma_adjust_static;
 
        Layer_Bitmap();
 
index c0e27ea..03bd076 100644 (file)
@@ -66,13 +66,10 @@ Layer_MotionBlur::Layer_MotionBlur():
        subsamples_factor       (1.0),
        subsampling_type        (SUBSAMPLING_HYPERBOLIC),
        subsample_start         (0.0),
-       subsample_end           (1.0),
-       aperture_static                         (false),
-       subsamples_factor_static        (false),
-       subsampling_type_static         (true),
-       subsample_start_static          (false),
-       subsample_end_static            (false)
+       subsample_end           (1.0)
 {
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
 }
 
 bool
@@ -274,12 +271,6 @@ Layer_MotionBlur::accelerated_render(Context context,Surface *surface,int qualit
 bool
 Layer_MotionBlur::set_param_static(const String &param, const bool x)
 {
-       SET_STATIC(aperture, x)
-       SET_STATIC(subsamples_factor, x)
-       SET_STATIC(subsampling_type, x)
-       SET_STATIC(subsample_start, x)
-       SET_STATIC(subsample_end, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
@@ -287,12 +278,5 @@ Layer_MotionBlur::set_param_static(const String &param, const bool x)
 bool
 Layer_MotionBlur::get_param_static(const String &param) const
 {
-
-       GET_STATIC(aperture)
-       GET_STATIC(subsamples_factor)
-       GET_STATIC(subsampling_type)
-       GET_STATIC(subsample_start)
-       GET_STATIC(subsample_end)
-
        return Layer_Composite::get_param_static(param);
 }
index 43d946b..31e2c17 100644 (file)
@@ -56,12 +56,6 @@ private:
        Real subsample_end;
        mutable Time time_cur;
 
-       bool aperture_static;
-       bool subsamples_factor_static;
-       bool subsampling_type_static;
-       bool subsample_start_static;
-       bool subsample_end_static;
-
 public:
        Layer_MotionBlur();
        virtual bool set_param(const String & param, const synfig::ValueBase &value);
index 920ecfe..6cdd09f 100644 (file)
@@ -87,17 +87,14 @@ Layer_PasteCanvas::Layer_PasteCanvas():
        depth(0),
        zoom(0),
        time_offset(0),
-       extra_reference(false),
-       origin_static(false),
-       focus_static(false),
-       canvas_static(false),
-       zoom_static(false),
-       time_offset_static(false),
-       children_lock_static(true)
+       extra_reference(false)
 {
        children_lock=false;
        muck_with_time_=true;
        curr_time=Time::begin();
+       Layer::Vocab voc(get_param_vocab());
+       Layer::fill_static(voc);
+       set_param_static("children_lock", true);
 }
 
 Layer_PasteCanvas::~Layer_PasteCanvas()
@@ -576,13 +573,6 @@ void Layer_PasteCanvas::get_times_vfunc(Node::time_set &set) const
 bool
 Layer_PasteCanvas::set_param_static(const String &param, const bool x)
 {
-       SET_STATIC(origin, x)
-       SET_STATIC(focus, x)
-       SET_STATIC(canvas, x)
-       SET_STATIC(zoom, x)
-       SET_STATIC(time_offset, x)
-       SET_STATIC(children_lock, x)
-
        return Layer_Composite::set_param_static(param, x);
 }
 
@@ -590,12 +580,5 @@ Layer_PasteCanvas::set_param_static(const String &param, const bool x)
 bool
 Layer_PasteCanvas::get_param_static(const String &param) const
 {
-       GET_STATIC(origin)
-       GET_STATIC(focus)
-       GET_STATIC(canvas)
-       GET_STATIC(zoom)
-       GET_STATIC(time_offset)
-       GET_STATIC(children_lock)
-
        return Layer_Composite::get_param_static(param);
 }
index 73c0d83..0ae2c98 100644 (file)
@@ -76,13 +76,6 @@ private:
        //! signal connection for children. Seems to be used only here
        sigc::connection child_changed_connection;
 
-       bool origin_static;
-       bool focus_static;
-       bool canvas_static;
-       bool zoom_static;
-       bool time_offset_static;
-       bool children_lock_static;
-
        // Nasty hack: Remember whether we called an extra ref() when
        // setting the canvas, so we know whether to call an extra unref()
        // when finished with the canvas.