X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fsynfig%2Fvaluenode.h;h=62940c3fbeeb6bd2770ffcf560d3529c3f51a114;hb=64591d2bbceaf68a64008a0044e2fef3454e44ac;hp=82cdc5620690e3c6bc99a73448e23e675bd53152;hpb=5ddcf36f04cfbd10fabda4e3c5633cb27cdd4c0a;p=synfig.git diff --git a/synfig-core/trunk/src/synfig/valuenode.h b/synfig-core/trunk/src/synfig/valuenode.h index 82cdc56..62940c3 100644 --- a/synfig-core/trunk/src/synfig/valuenode.h +++ b/synfig-core/trunk/src/synfig/valuenode.h @@ -1,8 +1,8 @@ /* === S Y N F I G ========================================================= */ /*! \file valuenode.h -** \brief Template Header +** \brief Header file for implementation of the "Placeholder" valuenode conversion. ** -** $Id: valuenode.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $ +** $Id$ ** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley @@ -59,6 +59,28 @@ # define DCAST_HACK_ENABLE() #endif +#define CHECK_TYPE_AND_SET_VALUE(variable, type) \ + /* I don't think this ever happens - maybe remove this code? */ \ + if (get_type() == ValueBase::TYPE_NIL) { \ + warning("%s:%d get_type() IS nil sometimes!", \ + __FILE__, __LINE__); \ + return false; \ + } \ + if (get_type() != ValueBase::TYPE_NIL && \ + !(ValueBase::same_type_as(value->get_type(), type)) && \ + !PlaceholderValueNode::Handle::cast_dynamic(value)) { \ + error(_("%s:%d wrong type for %s: need %s but got %s"), \ + __FILE__, __LINE__, \ + link_local_name(i).c_str(), \ + ValueBase::type_local_name(type).c_str(), \ + ValueBase::type_local_name(value->get_type()).c_str()); \ + return false; \ + } \ + variable = value; \ + signal_child_changed()(i); \ + signal_value_changed()(); \ + return true + /* === T Y P E D E F S ===================================================== */ /* === C L A S S E S & S T R U C T S ======================================= */ @@ -173,7 +195,7 @@ public: public: //! Returns the value of the ValueNode at time \a t - virtual ValueBase operator()(Time t)const + virtual ValueBase operator()(Time /*t*/)const { return ValueBase(); } //! \internal Sets the id of the ValueNode @@ -190,6 +212,9 @@ public: //! Returns the localized name of the ValueNode type virtual String get_local_name()const=0; + //! Return a full description of the ValueNode and its parentage + virtual String get_description(bool show_exported_name = true)const; + //! \writeme virtual ValueNode* clone(const GUID& deriv_guid=GUID())const=0; @@ -256,7 +281,7 @@ public: static Handle create(ValueBase::Type type=ValueBase::TYPE_NIL); protected: - virtual void get_times_vfunc(Node::time_set &set) const {} + virtual void get_times_vfunc(Node::time_set &/*set*/) const {} }; // END of class PlaceholderValueNode @@ -324,6 +349,9 @@ public: ValueNode::LooseHandle get_link(int i)const; ValueNode::LooseHandle get_link(const String &name)const { return get_link(get_link_index_from_name(name)); } + String + get_description(int index, bool show_exported_name = true)const; + protected: //! Sets the type of the ValueNode void set_type(ValueBase::Type t) { ValueNode::set_type(t); }