Use a map of static values instead of hard coded names.
[synfig.git] / synfig-core / src / synfig / layer.h
index 51bf681..19faddb 100644 (file)
 //! 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)                                                                                                      \
+       {                                                                                                                                                                       \
+               x ## _static = y;                                                                                                                               \
+               return true;                                                                                                                                    \
+       }
+
+#define GET_STATIC(x)                                                                                                                                  \
+       if(param==#x)                                                                                                                                           \
+               return x ## _static;                                                                                                                    \
+
+
 /* === T Y P E D E F S ===================================================== */
 
 /* === C L A S S E S & S T R U C T S ======================================= */
@@ -257,10 +270,12 @@ private:
        String description_;
 
        //! The depth parameter of the layer in the layer stack
-       float z_depth_;
+       float z_depth;
 
        //! True if zdepth is not affected when in animation mode
-       bool z_depth_static;
+       //bool z_depth_static;
+       typedef std::map<String, bool> Sparams;
+       Sparams static_params;
 
        //! \writeme
        mutable Time dirty_time_;
@@ -380,13 +395,13 @@ public:
        int get_depth()const;
 
        //! Gets the non animated z depth of the layer
-       float get_z_depth()const { return z_depth_; }
+       float get_z_depth()const { return z_depth; }
 
        //! Gets the z depth of the layer at a time t
        float get_z_depth(const synfig::Time& t)const;
 
        //! Sets the z depth of the layer (non animated)
-       void set_z_depth(float x) { z_depth_=x; }
+       void set_z_depth(float x) { z_depth=x; }
 
        //! Sets the Canvas that this Layer is a part of
        void set_canvas(etl::loose_handle<Canvas> canvas);