X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=synfig-core%2Ftags%2Fsynfig_0_61_03%2Fsynfig-core%2Fsrc%2Fsynfig%2Fvaluenode_dynamiclist.h;fp=synfig-core%2Ftags%2Fsynfig_0_61_03%2Fsynfig-core%2Fsrc%2Fsynfig%2Fvaluenode_dynamiclist.h;h=0000000000000000000000000000000000000000;hb=3a6643238c67c043fc3592837a05d6d2861967f1;hp=c7877ce81f8693f4748ae9b7493cd24c4442bbe5;hpb=47fce282611fbba1044921d22ca887f9b53ad91a;p=synfig.git diff --git a/synfig-core/tags/synfig_0_61_03/synfig-core/src/synfig/valuenode_dynamiclist.h b/synfig-core/tags/synfig_0_61_03/synfig-core/src/synfig/valuenode_dynamiclist.h deleted file mode 100644 index c7877ce..0000000 --- a/synfig-core/tags/synfig_0_61_03/synfig-core/src/synfig/valuenode_dynamiclist.h +++ /dev/null @@ -1,245 +0,0 @@ -/* === S Y N F I G ========================================================= */ -/*! \file valuenode_dynamiclist.h -** \brief Template Header -** -** $Id: valuenode_dynamiclist.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $ -** -** \legal -** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley -** -** This package is free software; you can redistribute it and/or -** modify it under the terms of the GNU General Public License as -** published by the Free Software Foundation; either version 2 of -** the License, or (at your option) any later version. -** -** This package is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -** General Public License for more details. -** \endlegal -*/ -/* ========================================================================= */ - -/* === S T A R T =========================================================== */ - -#ifndef __SYNFIG_VALUENODE_DYNAMICLIST_H -#define __SYNFIG_VALUENODE_DYNAMICLIST_H - -/* === H E A D E R S ======================================================= */ - -#include -#include - -#include "valuenode.h" -#include "time.h" -#include "uniqueid.h" -#include "activepoint.h" - -/* === M A C R O S ========================================================= */ - -/* === C L A S S E S & S T R U C T S ======================================= */ - -namespace synfig { -class ValueNode_BLine; - -/*! \class ValueNode_DynamicList -** \brief Animated List ValueNode -** -** This ValueNode was originaly set up to have a list -** of ValueNodes and their associated "on" and "off" points. -** ie: Any time that was directly after an "on" point, -** the item would be "on", and any time that was directly -** after an "off" point would be "off". This is pretty intuitive. -** However, it does have it's problems. -** -** The problems arrise when we introduce the concept of a -** Keyframe. Keyframes can be manipulated via the Synfig -** Application Library. They allow the user to quickly -** and "automagickly" rearange an animation by moving -** the associated keyframes. With they old way that the -** "on" and "off" points were handled, this task became -** overly complicated. -** -** What is required is a "symetric" system of describing -** "on" and "off" points. Instead of the point representing -** the state of the item after that point in time, we have -** the point represent only that frame. The state -** of the item is calculated by looking at the points -** around it: If either (or both) points are "on", then the -** current state is "on". Otherwise, the point is "off" -** -** This may be a bit confusing at first, but it is required -** if we want the keyframe mechanism to "just work". -*/ -class ValueNode_DynamicList : public LinkableValueNode -{ -public: - - /*! \class ListEntry - ** \brief Contains a potential list item, and associated timing information - ** - ** This structure contains a RHandle to a ValueNode, - ** as well as the associated on/off timing information - ** which determines when this item is included in the list. - ** - ** The timing information is stored in the member timing_info. - */ - struct ListEntry : public UniqueID - { - friend class ValueNode_DynamicList; - friend class ValueNode_BLine; - public: - typedef synfig::Activepoint Activepoint; - - typedef std::list ActivepointList; - - typedef std::pair findresult; - typedef std::pair const_findresult; - - - private: - mutable Node::time_set times; - public: - ValueNode::RHandle value_node; - - ActivepointList timing_info; - - private: - int index; - etl::loose_handle parent_; - void set_parent_value_node(const etl::loose_handle &x) { parent_=x; } - - public: - - int get_index()const { return index; } - - - bool status_at_time(const Time &x)const; - - float amount_at_time(const Time &x, bool *rising=0)const; - - ActivepointList::iterator add(Time time, bool status, int priority=0); - ActivepointList::iterator add(const Activepoint &x); - - findresult find_uid(const UniqueID& x); - const_findresult find_uid(const UniqueID& x)const; - - findresult find_time(const Time& x); - const_findresult find_time(const Time& x)const; - - ActivepointList::iterator find(const UniqueID& x); - ActivepointList::const_iterator find(const UniqueID& x)const; - ActivepointList::iterator find(const Time& x); - ActivepointList::const_iterator find(const Time& x)const; - ActivepointList::iterator find_prev(const Time& x); - ActivepointList::const_iterator find_prev(const Time& x)const; - ActivepointList::iterator find_next(const Time& x); - ActivepointList::const_iterator find_next(const Time& x)const; - - Activepoint new_activepoint_at_time(const Time& x)const; - - ActivepointList::iterator add(Time time) - { return add(time, status_at_time(time)); } - - void erase(const UniqueID& x); - - int find(const Time& begin,const Time& end,std::vector& list); - - const synfig::Node::time_set &get_times() const; - - const etl::loose_handle &get_parent_value_node()const { return parent_; } - - ListEntry(); - ListEntry(const ValueNode::Handle &value_node); - ListEntry(const ValueNode::Handle &value_node,Time begin, Time end); - }; // END of struct ValueNode_DynamicList::ListEntry - - typedef etl::handle Handle; - typedef etl::handle ConstHandle; - -protected: - ValueNode_DynamicList(ValueBase::Type container_type=ValueBase::TYPE_NIL); - - ValueBase::Type container_type; - - bool loop_; - - -public: - std::vector list; - -public: - - void add(const ValueNode::Handle &value_node, int index=-1); - void add(const ListEntry &value_node, int index=-1); - void erase(const ValueNode::Handle &value_node); - void reindex(); - - int find_next_valid_entry(int x, Time t)const; - int find_prev_valid_entry(int x, Time t)const; - - virtual ValueNode::LooseHandle get_link_vfunc(int i)const; - - virtual int link_count()const; - - virtual String link_name(int i)const; - - virtual ValueBase operator()(Time t)const; - - virtual ~ValueNode_DynamicList(); - - virtual String link_local_name(int i)const; - virtual int get_link_index_from_name(const String &name)const; - - virtual String get_name()const; - virtual String get_local_name()const; - - bool get_loop()const { return loop_; } - void set_loop(bool x) { loop_=x; } - - ValueBase::Type get_contained_type()const; - - - template static Handle - create(iterator begin, iterator end) - { - Handle ret=create((*begin)->get_type()); - for(;begin!=end;++begin) - ret->add(ListEntry(*begin)); - return ret; - } - - void insert_time(const Time& location, const Time& delta); - //void manipulate_time(const Time& old_begin,const Time& old_end,const Time& new_begin,const Time& new_end); - - virtual ValueNode* clone(const GUID& deriv_guid=GUID())const; - - virtual ListEntry create_list_entry(int index, Time time=0, Real origin=0.5); - -protected: - - virtual bool set_link_vfunc(int i,ValueNode::Handle x); - LinkableValueNode* create_new()const; - - virtual void get_times_vfunc(Node::time_set &set) const; - -public: - /*! \note The construction parameter (\a id) is the type that the list - ** contains, rather than the type that it will yield - ** (which is ValueBase::TYPE_LIST) - */ - static Handle create(ValueBase::Type id=ValueBase::TYPE_NIL); - using synfig::LinkableValueNode::get_link_vfunc; - using synfig::LinkableValueNode::set_link_vfunc; - static bool check_type(ValueBase::Type type); - static ValueNode_DynamicList* create_from(const ValueBase &x=ValueBase::TYPE_GRADIENT); -}; // END of class ValueNode_DynamicList - -typedef ValueNode_DynamicList::ListEntry::Activepoint Activepoint; -typedef ValueNode_DynamicList::ListEntry::ActivepointList ActivepointList; - -}; // END of namespace synfig - -/* === E N D =============================================================== */ - -#endif