From c74ce4738eff208de3bef4b63929b6975a896e93 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 3 Sep 2007 19:13:34 +0000 Subject: [PATCH] Rename ValueBase::same_as() to ValueBase::same_type_as(), since it compares types, not values. git-svn-id: http://svn.voria.com/code@578 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/modules/example/metaballs.cpp | 6 +++--- .../trunk/src/modules/lyr_freetype/lyr_freetype.cpp | 2 +- synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp | 2 +- synfig-core/trunk/src/modules/lyr_std/import.cpp | 2 +- synfig-core/trunk/src/modules/lyr_std/julia.cpp | 4 ++-- synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp | 4 ++-- synfig-core/trunk/src/modules/lyr_std/rotate.cpp | 2 +- synfig-core/trunk/src/modules/mod_geometry/outline.cpp | 2 +- synfig-core/trunk/src/modules/mod_geometry/star.cpp | 8 ++++---- .../trunk/src/modules/mod_gradient/lineargradient.cpp | 4 ++-- synfig-core/trunk/src/modules/mod_noise/distort.cpp | 2 +- synfig-core/trunk/src/modules/mod_noise/noise.cpp | 2 +- synfig-core/trunk/src/modules/mod_particle/plant.cpp | 2 +- synfig-core/trunk/src/synfig/layer.cpp | 2 +- synfig-core/trunk/src/synfig/layer.h | 4 ++-- synfig-core/trunk/src/synfig/layer_composite.cpp | 4 ++-- synfig-core/trunk/src/synfig/layer_pastecanvas.cpp | 2 +- synfig-core/trunk/src/synfig/layer_polygon.cpp | 2 +- synfig-core/trunk/src/synfig/value.h | 14 +++++++------- synfig-core/trunk/src/synfig/valuenode_timedswap.cpp | 4 ++-- synfig-studio/trunk/src/gtkmm/duckmatic.cpp | 10 +++++----- synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp | 4 ++-- synfig-studio/trunk/src/gtkmm/layertree.cpp | 2 +- synfig-studio/trunk/src/gtkmm/layertreestore.cpp | 2 +- 24 files changed, 46 insertions(+), 46 deletions(-) diff --git a/synfig-core/trunk/src/modules/example/metaballs.cpp b/synfig-core/trunk/src/modules/example/metaballs.cpp index 5559f93..f7550f9 100644 --- a/synfig-core/trunk/src/modules/example/metaballs.cpp +++ b/synfig-core/trunk/src/modules/example/metaballs.cpp @@ -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; diff --git a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp index 321692f..d0ff1e5 100644 --- a/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp +++ b/synfig-core/trunk/src/modules/lyr_freetype/lyr_freetype.cpp @@ -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)); diff --git a/synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp b/synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp index 30619bf..3c2c155 100644 --- a/synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/booleancurve.cpp @@ -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 bv; int size = value.get_list().size(); diff --git a/synfig-core/trunk/src/modules/lyr_std/import.cpp b/synfig-core/trunk/src/modules/lyr_std/import.cpp index f6dae6c..28801a1 100644 --- a/synfig-core/trunk/src/modules/lyr_std/import.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/import.cpp @@ -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()) { diff --git a/synfig-core/trunk/src/modules/lyr_std/julia.cpp b/synfig-core/trunk/src/modules/lyr_std/julia.cpp index bb32cd3..9efd7d1 100644 --- a/synfig-core/trunk/src/modules/lyr_std/julia.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/julia.cpp @@ -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; diff --git a/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp b/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp index 9901436..3343bb2 100644 --- a/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/mandelbrot.cpp @@ -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; diff --git a/synfig-core/trunk/src/modules/lyr_std/rotate.cpp b/synfig-core/trunk/src/modules/lyr_std/rotate.cpp index 963e8e5..2e6c0b0 100644 --- a/synfig-core/trunk/src/modules/lyr_std/rotate.cpp +++ b/synfig-core/trunk/src/modules/lyr_std/rotate.cpp @@ -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(); diff --git a/synfig-core/trunk/src/modules/mod_geometry/outline.cpp b/synfig-core/trunk/src/modules/mod_geometry/outline.cpp index 69d635f..e540fa5 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/outline.cpp +++ b/synfig-core/trunk/src/modules/mod_geometry/outline.cpp @@ -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(); diff --git a/synfig-core/trunk/src/modules/mod_geometry/star.cpp b/synfig-core/trunk/src/modules/mod_geometry/star.cpp index 4dfc358..e317d0c 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/star.cpp +++ b/synfig-core/trunk/src/modules/mod_geometry/star.cpp @@ -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(); diff --git a/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp b/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp index f8bf419..603e761 100644 --- a/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp +++ b/synfig-core/trunk/src/modules/mod_gradient/lineargradient.cpp @@ -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(); diff --git a/synfig-core/trunk/src/modules/mod_noise/distort.cpp b/synfig-core/trunk/src/modules/mod_noise/distort.cpp index c9571d3..4c8f871 100644 --- a/synfig-core/trunk/src/modules/mod_noise/distort.cpp +++ b/synfig-core/trunk/src/modules/mod_noise/distort.cpp @@ -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; diff --git a/synfig-core/trunk/src/modules/mod_noise/noise.cpp b/synfig-core/trunk/src/modules/mod_noise/noise.cpp index ce9852c..c3e1e5e 100644 --- a/synfig-core/trunk/src/modules/mod_noise/noise.cpp +++ b/synfig-core/trunk/src/modules/mod_noise/noise.cpp @@ -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; diff --git a/synfig-core/trunk/src/modules/mod_particle/plant.cpp b/synfig-core/trunk/src/modules/mod_particle/plant.cpp index 6dbd106..b5f0158 100644 --- a/synfig-core/trunk/src/modules/mod_particle/plant.cpp +++ b/synfig-core/trunk/src/modules/mod_particle/plant.cpp @@ -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; diff --git a/synfig-core/trunk/src/synfig/layer.cpp b/synfig-core/trunk/src/synfig/layer.cpp index 6a36ca9..4b99ed0 100644 --- a/synfig-core/trunk/src/synfig/layer.cpp +++ b/synfig-core/trunk/src/synfig/layer.cpp @@ -266,7 +266,7 @@ Layer::on_changed() bool Layer::set_param(const String ¶m, 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; diff --git a/synfig-core/trunk/src/synfig/layer.h b/synfig-core/trunk/src/synfig/layer.h index 1716c87..4f2fb10 100644 --- a/synfig-core/trunk/src/synfig/layer.h +++ b/synfig-core/trunk/src/synfig/layer.h @@ -62,10 +62,10 @@ #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) diff --git a/synfig-core/trunk/src/synfig/layer_composite.cpp b/synfig-core/trunk/src/synfig/layer_composite.cpp index 8a4188e..24f640d 100644 --- a/synfig-core/trunk/src/synfig/layer_composite.cpp +++ b/synfig-core/trunk/src/synfig/layer_composite.cpp @@ -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(value.get(int())); else return Layer::set_param(param,value); diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index 4cfa767..3c9d834 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -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; diff --git a/synfig-core/trunk/src/synfig/layer_polygon.cpp b/synfig-core/trunk/src/synfig/layer_polygon.cpp index 5445355..94de2b9 100644 --- a/synfig-core/trunk/src/synfig/layer_polygon.cpp +++ b/synfig-core/trunk/src/synfig/layer_polygon.cpp @@ -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(); diff --git a/synfig-core/trunk/src/synfig/value.h b/synfig-core/trunk/src/synfig/value.h index 228eab1..53dc12a 100644 --- a/synfig-core/trunk/src/synfig/value.h +++ b/synfig-core/trunk/src/synfig/value.h @@ -200,7 +200,7 @@ public: //! Checks the type of the parameter against itself. Returns true if they are of the same type. template 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 const T &get(const T& x)const { - assert(is_valid() && same_as(x)); + assert(is_valid() && same_type_as(x)); return *static_cast(data); } float get(const float &)const { return get(Real()); } @@ -234,7 +234,7 @@ public: template void put(T* x)const { - assert(same_as(*x)); + assert(same_type_as(*x)); *x=*static_cast(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(ValueBase): Type Mismatch"); } @@ -410,7 +410,7 @@ public: Value& operator=(const ValueBase& x) { - if(!x.same_as(T())) + if(!x.same_type_as(T())) throw Exception::BadType("Value(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(ValueBase): Type Mismatch"); } Value() @@ -446,7 +446,7 @@ public: Value& operator=(const ValueBase& x) { - if(!x.same_as(T())) + if(!x.same_type_as(T())) throw Exception::BadType("Value(ValueBase): Type Mismatch"); return ValueBase::operator=(x); } diff --git a/synfig-core/trunk/src/synfig/valuenode_timedswap.cpp b/synfig-core/trunk/src/synfig/valuenode_timedswap.cpp index 986ed7e..7469bf1 100644 --- a/synfig-core/trunk/src/synfig/valuenode_timedswap.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_timedswap.cpp @@ -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) ) ) diff --git a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp index 5dbbaf0..957b76b 100644 --- a/synfig-studio/trunk/src/gtkmm/duckmatic.cpp +++ b/synfig-studio/trunk/src/gtkmm/duckmatic.cpp @@ -1455,7 +1455,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handleset_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::handleset_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::handleset_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::handleset_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::handleset_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()) diff --git a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp index fd9a9c7..80b91b9 100644 --- a/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp +++ b/synfig-studio/trunk/src/gtkmm/layeractionmanager.cpp @@ -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); } diff --git a/synfig-studio/trunk/src/gtkmm/layertree.cpp b/synfig-studio/trunk/src/gtkmm/layertree.cpp index 0fcaa11..ba63485 100644 --- a/synfig-studio/trunk/src/gtkmm/layertree.cpp +++ b/synfig-studio/trunk/src/gtkmm/layertree.cpp @@ -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(); } diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp index 680d933..c76b003 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp @@ -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()); -- 2.7.4