Author: Carlos Lopez <[email protected]>
Date:   Mon Oct 17 21:05:00 2011 +0200

Add code to avoid set upper boundary the same as lower boundary

---

 .../src/synfigapp/actions/valuedescset.cpp         |   25 ++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/synfig-studio/src/synfigapp/actions/valuedescset.cpp 
b/synfig-studio/src/synfigapp/actions/valuedescset.cpp
index 02b9f97..6a5aa8e 100644
--- a/synfig-studio/src/synfigapp/actions/valuedescset.cpp
+++ b/synfig-studio/src/synfigapp/actions/valuedescset.cpp
@@ -668,6 +668,31 @@ Action::ValueDescSet::prepare()
                        else
                                local_value=value_desc.get_value();
                }
+       // if value desc has parent value node and parent is composite 
widthpoint type and index is 4 or 5
+       // then we are changing the value of a widthpoint boundary.
+       // It is needed to check that we aren't doing the boundary range zero
+
+       if(value_desc.parent_is_value_node() && 
ValueNode_Composite::Handle::cast_dynamic(value_desc.get_parent_value_node()))
+       {
+               ValueNode_Composite::Handle parent_value_node;
+               
parent_value_node=parent_value_node.cast_dynamic(value_desc.get_parent_value_node());
+               assert(parent_value_node);
+               int i=value_desc.get_index();
+               if(parent_value_node->get_type() == ValueBase::TYPE_WIDTHPOINT 
&& (i==4 || i==5))
+               {
+                       ValueNode::Handle 
low(parent_value_node->get_link("lower_bound"));
+                       ValueNode::Handle 
upp(parent_value_node->get_link("upper_bound"));
+                       Real new_value(value.get(Real()));
+                       Real lower = (*low)(Time(0.0)).get(Real());
+                       Real upper = (*upp)(Time(0.0)).get(Real());
+                       if( (i==4 && new_value > (upper- 0.00000001))
+                       ||  (i==5 && new_value < (lower+ 0.00000001)) )
+                       {
+                               throw Error(_("It is forbidden to set lower 
boundary equal or bigger than upper boundary"));
+                               return;
+                       }
+               }
+       }
        // If we are in animate editing mode
        if(get_edit_mode()&MODE_ANIMATE && !local_value.get_static())
        {


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl

Reply via email to