Rename ValueBase::same_as() to ValueBase::same_type_as(), since it compares types...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Sep 2007 19:13:34 +0000 (19:13 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 3 Sep 2007 19:13:34 +0000 (19:13 +0000)
git-svn-id: http://svn.voria.com/code@578 1f10aa63-cdf2-0310-b900-c93c546f37ac

24 files changed:
synfig-core/trunk/src/modules/example/metaballs.cpp
synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp
synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp
synfig-core/trunk/src/modules/lyr_std/import.cpp
synfig-core/trunk/src/modules/lyr_std/julia.cpp
synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp
synfig-core/trunk/src/modules/lyr_std/rotate.cpp
synfig-core/trunk/src/modules/mod_geometry/outline.cpp
synfig-core/trunk/src/modules/mod_geometry/star.cpp
synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp
synfig-core/trunk/src/modules/mod_noise/distort.cpp
synfig-core/trunk/src/modules/mod_noise/noise.cpp
synfig-core/trunk/src/modules/mod_particle/plant.cpp
synfig-core/trunk/src/synfig/layer.cpp
synfig-core/trunk/src/synfig/layer.h
synfig-core/trunk/src/synfig/layer_composite.cpp
synfig-core/trunk/src/synfig/layer_pastecanvas.cpp
synfig-core/trunk/src/synfig/layer_polygon.cpp
synfig-core/trunk/src/synfig/value.h
synfig-core/trunk/src/synfig/valuenode_timedswap.cpp
synfig-studio/trunk/src/gtkmm/duckmatic.cpp
synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp
synfig-studio/trunk/src/gtkmm/layertree.cpp
synfig-studio/trunk/src/gtkmm/layertreestore.cpp

index 5559f93..f7550f9 100644 (file)
@@ -73,19 +73,19 @@ Metaballs::Metaballs():
 bool
 Metaballs::set_param(const String & param, const ValueBase &value)
 {
-       if(     param=="centers" && value.same_as(centers))
+       if(     param=="centers" && value.same_type_as(centers))
        {
                centers = value;
                return true;
        }
 
-       if(     param=="weights" && value.same_as(weights))
+       if(     param=="weights" && value.same_type_as(weights))
        {
                weights = value;
                return true;
        }
 
-       if(     param=="radii" && value.same_as(radii))
+       if(     param=="radii" && value.same_type_as(radii))
        {
                radii = value;
                return true;
index 321692f..d0ff1e5 100644 (file)
@@ -449,7 +449,7 @@ lyr_freetype::set_param(const String & param, const ValueBase &value)
 {
        Mutex::Lock lock(mutex);
 /*
-       if(param=="font" && value.same_as(font))
+       if(param=="font" && value.same_type_as(font))
        {
                new_font(etl::basename(value.get(font)),style,weight);
                family=etl::basename(value.get(font));
index 30619bf..3c2c155 100644 (file)
@@ -68,7 +68,7 @@ BooleanCurve::~BooleanCurve()
 
 bool BooleanCurve::set_param(const String & param, const synfig::ValueBase &value)
 {
-       if(param=="regions" && value.same_as(regions))
+       if(param=="regions" && value.same_type_as(regions))
        {
                vector<BLinePoint> bv;
                int size = value.get_list().size();
index f6dae6c..28801a1 100644 (file)
@@ -83,7 +83,7 @@ Import::set_param(const String & param, const ValueBase &value)
 {
        try{
        IMPORT(time_offset);
-       if(param=="filename" && value.same_as(filename))
+       if(param=="filename" && value.same_type_as(filename))
        {
                if(!get_canvas())
                {
index bb32cd3..9efd7d1 100644 (file)
@@ -143,7 +143,7 @@ Julia::set_param(const String & param, const ValueBase &value)
        IMPORT(smooth_outside);
        IMPORT(broken);
 
-       if(param=="iterations" && value.same_as(iterations))
+       if(param=="iterations" && value.same_type_as(iterations))
        {
                iterations=value.get(iterations);
                if(iterations<0)
@@ -152,7 +152,7 @@ Julia::set_param(const String & param, const ValueBase &value)
                        iterations=500000;
                return true;
        }
-       if(param=="bailout" && value.same_as(bailout))
+       if(param=="bailout" && value.same_type_as(bailout))
        {
                bailout=value.get(bailout);
                bailout*=bailout;
index 9901436..3343bb2 100644 (file)
@@ -146,7 +146,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value)
        IMPORT(gradient_inside);
        IMPORT(gradient_outside);
 
-       if(param=="iterations" && value.same_as(iterations))
+       if(param=="iterations" && value.same_type_as(iterations))
        {
                iterations=value.get(iterations);
                if(iterations<0)
@@ -155,7 +155,7 @@ Mandelbrot::set_param(const String & param, const ValueBase &value)
                        iterations=500000;
                return true;
        }
-       if(param=="bailout" && value.same_as(bailout))
+       if(param=="bailout" && value.same_type_as(bailout))
        {
                bailout=value.get(bailout);
                bailout*=bailout;
index 963e8e5..2e6c0b0 100644 (file)
@@ -79,7 +79,7 @@ Rotate::set_param(const String & param, const ValueBase &value)
 {
        IMPORT(origin);
 
-       if(param=="amount" && value.same_as(amount))
+       if(param=="amount" && value.same_type_as(amount))
        {
                amount=value.get(amount);
                sin_val=Angle::sin(amount).get();
index 69d635f..e540fa5 100644 (file)
@@ -728,7 +728,7 @@ Outline::set_param(const String & param, const ValueBase &value)
                return true;
        }
 
-       if(     param=="width_list" && value.same_as(width_list))
+       if(     param=="width_list" && value.same_type_as(width_list))
        {
                width_list=value;
                //sync();
index 4dfc358..e317d0c 100644 (file)
@@ -99,21 +99,21 @@ Star::sync()
 bool
 Star::set_param(const String & param, const ValueBase &value)
 {
-       if(     param=="radius1" && value.same_as(radius1))
+       if(     param=="radius1" && value.same_type_as(radius1))
        {
                value.put(&radius1);
                sync();
                return true;
        }
 
-       if(     param=="radius2" && value.same_as(radius2))
+       if(     param=="radius2" && value.same_type_as(radius2))
        {
                value.put(&radius2);
                sync();
                return true;
        }
 
-       if(     param=="points" && value.same_as(points))
+       if(     param=="points" && value.same_type_as(points))
        {
                value.put(&points);
                if(points<2)points=2;
@@ -121,7 +121,7 @@ Star::set_param(const String & param, const ValueBase &value)
                return true;
        }
 
-       if(     param=="angle" && value.same_as(angle))
+       if(     param=="angle" && value.same_type_as(angle))
        {
                value.put(&angle);
                sync();
index f8bf419..603e761 100644 (file)
@@ -138,13 +138,13 @@ LinearGradient::hit_check(synfig::Context context, const synfig::Point &point)co
 bool
 LinearGradient::set_param(const String & param, const ValueBase &value)
 {
-       if(param=="p1" && value.same_as(p1))
+       if(param=="p1" && value.same_type_as(p1))
        {
                p1=value.get(p1);
                sync();
                return true;
        }
-       if(param=="p2" && value.same_as(p2))
+       if(param=="p2" && value.same_type_as(p2))
        {
                p2=value.get(p2);
                sync();
index c9571d3..4c8f871 100644 (file)
@@ -154,7 +154,7 @@ NoiseDistort::hit_check(synfig::Context context, const synfig::Point &point)cons
 bool
 NoiseDistort::set_param(const String & param, const ValueBase &value)
 {
-       if(param=="seed" && value.same_as(int()))
+       if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
                return true;
index ce9852c..c3e1e5e 100644 (file)
@@ -203,7 +203,7 @@ Noise::hit_check(synfig::Context context, const synfig::Point &point)const
 bool
 Noise::set_param(const String & param, const ValueBase &value)
 {
-       if(param=="seed" && value.same_as(int()))
+       if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
                return true;
index 6dbd106..b5f0158 100644 (file)
@@ -251,7 +251,7 @@ Plant::set_param(const String & param, const ValueBase &value)
 
                return true;
        }
-       if(param=="seed" && value.same_as(int()))
+       if(param=="seed" && value.same_type_as(int()))
        {
                random.set_seed(value.get(int()));
                needs_sync_=true;
index 6a36ca9..4b99ed0 100644 (file)
@@ -266,7 +266,7 @@ Layer::on_changed()
 bool
 Layer::set_param(const String &param, const ValueBase &value)
 {
-       if(param=="z_depth" && value.same_as(z_depth_))
+       if(param=="z_depth" && value.same_type_as(z_depth_))
        {
                z_depth_=value.get(z_depth_);
                return true;
index 1716c87..4f2fb10 100644 (file)
 #define SYNFIG_LAYER_INIT(class) synfig::Layer* class::create() { return new class(); }
 
 //! \writeme
-#define IMPORT_PLUS(x,y) if(param==#x && value.same_as(x)) { value.put(&x);{y;}return true;}
+#define IMPORT_PLUS(x,y) if(param==#x && value.same_type_as(x)) { value.put(&x);{y;}return true;}
 
 //! \writeme
-#define IMPORT_AS(x,y) if(param==y && value.same_as(x)) { value.put(&x); return true;}
+#define IMPORT_AS(x,y) if(param==y && value.same_type_as(x)) { value.put(&x); return true;}
 
 //! \writeme
 #define IMPORT(x) IMPORT_AS(x,#x)
index 8a4188e..24f640d 100644 (file)
@@ -150,10 +150,10 @@ Layer_Composite::get_param_vocab()const
 bool
 Layer_Composite::set_param(const String & param, const ValueBase &value)
 {
-       if(param=="amount" && value.same_as(amount_))
+       if(param=="amount" && value.same_type_as(amount_))
                amount_=value.get(amount_);
        else
-       if(param=="blend_method" && value.same_as(int()))
+       if(param=="blend_method" && value.same_type_as(int()))
                blend_method_=static_cast<Color::BlendMethod>(value.get(int()));
        else
                return Layer::set_param(param,value);
index 4cfa767..3c9d834 100644 (file)
@@ -146,7 +146,7 @@ Layer_PasteCanvas::set_param(const String & param, const ValueBase &value)
 {
        IMPORT(origin);
 
-       if(param=="canvas" && value.same_as(Canvas::Handle()))
+       if(param=="canvas" && value.same_type_as(Canvas::Handle()))
        {
                set_sub_canvas(value.get(Canvas::Handle()));
                return true;
index 5445355..94de2b9 100644 (file)
@@ -139,7 +139,7 @@ Layer_Polygon::clear()
 bool
 Layer_Polygon::set_param(const String & param, const ValueBase &value)
 {
-       if(     param=="vector_list" && value.same_as(vector_list))
+       if(     param=="vector_list" && value.same_type_as(vector_list))
        {
                vector_list=value;
                Layer_Shape::clear();
index 228eab1..53dc12a 100644 (file)
@@ -200,7 +200,7 @@ public:
 
        //! Checks the type of the parameter against itself. Returns true if they are of the same type.
        template <class T> bool
-       same_as(const T &x)const
+       same_type_as(const T &x)const
        {
                const Type testtype(get_type(x));
 
@@ -216,7 +216,7 @@ public:
        template <typename T>
        const T &get(const T& x)const
        {
-               assert(is_valid() && same_as(x));
+               assert(is_valid() && same_type_as(x));
                return *static_cast<const T*>(data);
        }
        float get(const float &)const { return get(Real()); }
@@ -234,7 +234,7 @@ public:
        template <typename T>
        void put(T* x)const
        {
-               assert(same_as(*x));
+               assert(same_type_as(*x));
                *x=*static_cast<const T*>(data);
        }
        void put(float* x)const { *x=get(Real()); }
@@ -390,7 +390,7 @@ public:
 
        Value(const ValueBase &x):ValueBase(x)
        {
-               if(!x.same_as(T()))
+               if(!x.same_type_as(T()))
                        throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
        }
 
@@ -410,7 +410,7 @@ public:
 
        Value<T>& operator=(const ValueBase& x)
        {
-               if(!x.same_as(T()))
+               if(!x.same_type_as(T()))
                        throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
                return ValueBase::operator=(x);
        }
@@ -427,7 +427,7 @@ public:
        }
        Value(const ValueBase &x):ValueBase(x)
        {
-               if(!x.same_as(T()))
+               if(!x.same_type_as(T()))
                        throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
        }
        Value()
@@ -446,7 +446,7 @@ public:
 
        Value<T>& operator=(const ValueBase& x)
        {
-               if(!x.same_as(T()))
+               if(!x.same_type_as(T()))
                        throw Exception::BadType("Value<T>(ValueBase): Type Mismatch");
                return ValueBase::operator=(x);
        }
index 986ed7e..7469bf1 100644 (file)
@@ -131,7 +131,7 @@ bool
 ValueNode_TimedSwap::set_swap_time(const ValueNode::Handle &x)
 {
        if(!x
-               || !ValueBase(ValueBase::TYPE_TIME).same_as(x->get_type())
+               || !ValueBase(ValueBase::TYPE_TIME).same_type_as(x->get_type())
                && !PlaceholderValueNode::Handle::cast_dynamic(x)
        )
                return false;
@@ -155,7 +155,7 @@ bool
 ValueNode_TimedSwap::set_swap_length(const ValueNode::Handle &x)
 {
        if(!x || (
-               !ValueBase(ValueBase::TYPE_TIME).same_as(x->get_type())
+               !ValueBase(ValueBase::TYPE_TIME).same_type_as(x->get_type())
                && !PlaceholderValueNode::Handle::cast_dynamic(x)
                )
        )
index 5dbbaf0..957b76b 100644 (file)
@@ -1455,7 +1455,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                                duck->set_origin(last_duck());
 /*
                                                                ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
-                                                               if(value.same_as(synfig::Point()))
+                                                               if(value.same_type_as(synfig::Point()))
                                                                        duck->set_origin(value.get(synfig::Point()));
 */
                                                        }
@@ -1484,7 +1484,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                                duck->set_origin(last_duck());
 /*
                                                                ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
-                                                               if(value.same_as(synfig::Point()))
+                                                               if(value.same_type_as(synfig::Point()))
                                                                        duck->set_origin(value.get(synfig::Point()));
 */
                                                }
@@ -1506,7 +1506,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                width->set_name(guid_string(synfigapp::ValueDesc(value_node,i))+".w");
                                                {
                                                        ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_hint()).get_value(get_time()));
-                                                       if(value.same_as(synfig::Real()))
+                                                       if(value.same_type_as(synfig::Real()))
                                                                width->set_scalar(value.get(synfig::Real())*0.5f);
                                                }
                                        }
@@ -1612,7 +1612,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                                duck->set_origin(last_duck());
 /*
                                                                ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
-                                                               if(value.same_as(synfig::Point()))
+                                                               if(value.same_type_as(synfig::Point()))
                                                                        duck->set_origin(value.get(synfig::Point()));
 */
 //                                             if(!param_desc->get_origin().empty())
@@ -1767,7 +1767,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                                duck->set_origin(last_duck());
 /*
                                                                ValueBase value(synfigapp::ValueDesc(value_desc.get_layer(),param_desc->get_origin()).get_value(get_time()));
-                                                               if(value.same_as(synfig::Point()))
+                                                               if(value.same_type_as(synfig::Point()))
                                                                        duck->set_origin(value.get(synfig::Point()));
 */
 //                                             if(!param_desc->get_origin().empty())
index fd9a9c7..80b91b9 100644 (file)
@@ -432,7 +432,7 @@ LayerActionManager::amount_inc()
        while(!layer_list.empty())
        {
                ValueBase value(layer_list.front()->get_param("amount"));
-               if(value.same_as(Real()))
+               if(value.same_type_as(Real()))
                {
                        get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
                }
@@ -456,7 +456,7 @@ LayerActionManager::amount_dec()
        while(!layer_list.empty())
        {
                ValueBase value(layer_list.front()->get_param("amount"));
-               if(value.same_as(Real()))
+               if(value.same_type_as(Real()))
                {
                        get_canvas_interface()->change_value(synfigapp::ValueDesc(layer_list.front(),"amount"),value.get(Real())+adjust);
                }
index 0fcaa11..ba63485 100644 (file)
@@ -648,7 +648,7 @@ LayerTree::on_selection_changed()
        button_duplicate->set_sensitive(true);
        button_delete->set_sensitive(true);
 
-       if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_as(Real()))
+       if(layer_list.size()==1 && (*layer_list.begin())->get_param("amount").is_valid()&& (*layer_list.begin())->get_param("amount").same_type_as(Real()))
        {
                quick_layer=*layer_list.begin();
        }
index 680d933..c76b003 100644 (file)
@@ -185,7 +185,7 @@ LayerTreeStore::get_value_vfunc (const Gtk::TreeModel::iterator& iter, int colum
                x.set(false);
 
                ValueBase v(layer->get_param("children_lock"));
-               if(v.same_as(bool()))
+               if(v.same_type_as(bool()))
                        x.set(v.get(bool()));
 
                g_value_init(value.gobj(),x.value_type());