Author: Carlos Lopez <genet...@gmail.com>
Date:   Mon Jul 18 21:35:48 2011 +0200

Add homogeneous parameter to Advanced Outline Layer. It is not functional yet.

---

 .../src/modules/mod_geometry/advanced_outline.cpp  |   60 ++++++++++++++++++--
 .../src/modules/mod_geometry/advanced_outline.h    |    2 +
 2 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp 
b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
index b3193b3..3ccec0e 100644
--- a/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
+++ b/synfig-core/src/modules/mod_geometry/advanced_outline.cpp
@@ -490,6 +490,7 @@ Advanced_Outline::set_param(const String & param, const 
ValueBase &value)
                wplist_=value;
                return true;
        }
+       IMPORT_AS(homogeneous_, "homogeneous");
        if(param=="vector_list")
                return false;
        return Layer_Polygon::set_param(param,value);
@@ -520,6 +521,7 @@ Advanced_Outline::get_param(const String& param)const
        EXPORT_AS(end_tip_,"end_tip");
        EXPORT_AS(width_, "width");
        EXPORT_AS(wplist_, "wplist");
+       EXPORT_AS(homogeneous_,"homogeneous");
        EXPORT_NAME();
        EXPORT_VERSION();
        if(param=="vector_list")
@@ -584,6 +586,10 @@ Advanced_Outline::get_param_vocab()const
                .set_origin("origin")
                .set_description(_("List of width Points that defines the 
variable width"))
        );
+       ret.push_back(ParamDesc("homogeneous")
+               .set_local_name(_("Homogeneous"))
+               .set_description(_("When checked the position is bline length 
based"))
+       );
        return ret;
 }
 
@@ -596,23 +602,38 @@ Advanced_Outline::connect_dynamic_param(const String& 
param, etl::loose_handle<V
                if(!connect_bline_to_wplist(x))
                        synfig::warning("Advanced Outline: WPList doesn't 
accept new bline");
        }
+       if(param=="homogeneous")
+       {
+               if(!connect_homogeneous_to_wplist(x))
+                       synfig::warning("Advanced Outline: WPList doesn't 
accept new homogeneous");
+       }
        if(param=="wplist")
        {
                if(Layer::connect_dynamic_param(param, x))
                {
                        DynamicParamList::const_iterator 
iter(dynamic_param_list().find("bline"));
                        if(iter==dynamic_param_list().end())
-                               {
-                                       synfig::warning("BLine doesn't exist 
yet!!");
-                                       return false;
-                               }
+                       {
+                               synfig::warning("BLine doesn't exist yet!!");
+                               return false;
+                       }
                        else if(!connect_bline_to_wplist(iter->second))
                        {
                                synfig::warning("Advanced Outline: WPList 
doesn't accept new bline");
                                return false;
                        }
-                       else
-                               return true;
+                       iter=dynamic_param_list().find("homogeneous");
+                       if(iter==dynamic_param_list().end())
+                       {
+                               synfig::warning("Homogenous doesn't exist 
yet!!");
+                               return false;
+                       }
+                       else if(!connect_homogeneous_to_wplist(iter->second))
+                       {
+                               synfig::warning("Advanced Outline: WPList 
doesn't accept new homogeneous");
+                               return false;
+                       }
+                       return true;
                }
                else
                        return false;
@@ -653,6 +674,33 @@ 
Advanced_Outline::connect_bline_to_wplist(etl::loose_handle<ValueNode> x)
        return true;
 }
 
+bool
+Advanced_Outline::connect_homogeneous_to_wplist(etl::loose_handle<ValueNode> x)
+{
+       if(x->get_type() != ValueBase::TYPE_BOOL)
+       {
+               synfig::info("Not a bool");
+               return false;
+       }
+       ValueNode::LooseHandle vnode;
+       DynamicParamList::const_iterator 
iter(dynamic_param_list().find("wplist"));
+       if(iter==dynamic_param_list().end())
+       {
+               synfig::warning("WPList doesn't exist yet");
+               return false;
+       }
+       ValueNode_WPList::Handle 
wplist(ValueNode_WPList::Handle::cast_dynamic(iter->second));
+       if(!wplist)
+       {
+               synfig::info("WPList is not ready: NULL");
+               return false;
+       }
+       if(!wplist->link_count())
+               
synfig::warning("Advanced_Outline::connect_homogeneous_to_wplist: 
WPList::link_count()=0");
+       wplist->set_homogeneous(ValueNode::Handle(x));
+       return true;
+}
+
 
 Real
 Advanced_Outline::bline_to_bezier(Real bline_pos, Real origin, Real 
bezier_size)
diff --git a/synfig-core/src/modules/mod_geometry/advanced_outline.h 
b/synfig-core/src/modules/mod_geometry/advanced_outline.h
index d4702f3..d634774 100644
--- a/synfig-core/src/modules/mod_geometry/advanced_outline.h
+++ b/synfig-core/src/modules/mod_geometry/advanced_outline.h
@@ -58,6 +58,7 @@ private:
        synfig::Real width_;
        synfig::Real expand_;
        Real smoothness_;
+       bool homogeneous_;
 
 public:
        enum CuspType
@@ -81,6 +82,7 @@ public:
 private:
 
        bool connect_bline_to_wplist(etl::loose_handle<ValueNode> x);
+       bool connect_homogeneous_to_wplist(etl::loose_handle<ValueNode> x);
        Real bline_to_bezier(Real bline_pos, Real origin, Real bezier_size);
        Real bezier_to_bline(Real bezier_pos, Real origin, Real bezier_size);
        void add_tip(std::vector<Point> &side_a, std::vector<Point> &side_b, 
const Point vertex, const Vector tangent, const WidthPoint wp);


------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Synfig-devl mailing list
Synfig-devl@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to