Draw in the complete outline of a selected polygon if it is 'looped'. This allows...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 20 Feb 2008 15:30:33 +0000 (15:30 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 20 Feb 2008 15:30:33 +0000 (15:30 +0000)
git-svn-id: http://svn.voria.com/code@1787 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/duckmatic.cpp

index 084f642..75212d4 100644 (file)
@@ -1695,6 +1695,7 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                        if(value_node->get_contained_type()==ValueBase::TYPE_VECTOR)
                        {
                                Bezier bezier;
+                               etl::handle<Duck> first_duck, duck;
                                int first = -1;
                                for(i=0;i<value_node->link_count();i++)
                                {
@@ -1702,11 +1703,14 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                continue;
                                        if(!add_to_ducks(synfigapp::ValueDesc(value_node,i),canvas_view,transform_stack))
                                                return false;
-                                       etl::handle<Duck> duck(last_duck());
+                                       duck = last_duck();
 
                                        // remember the index of the first vertex we didn't skip
                                        if (first == -1)
+                                       {
                                                first = i;
+                                               first_duck = duck;
+                                       }
 
                                        if(param_desc)
                                        {
@@ -1741,6 +1745,27 @@ Duckmatic::add_to_ducks(const synfigapp::ValueDesc& value_desc,etl::handle<Canva
                                                                synfigapp::ValueDesc(value_node,i)));
                                        }
                                }
+
+                               if (value_node->get_loop() && first != -1 && first_duck != duck)
+                               {
+                                       duck = first_duck;
+
+                                       bezier.p1=bezier.p2;bezier.c1=bezier.c2;
+                                       bezier.p2=bezier.c2=duck;
+
+                                       handle<Bezier> bezier_(new Bezier());
+                                       bezier_->p1=bezier.p1;
+                                       bezier_->c1=bezier.c1;
+                                       bezier_->p2=bezier.p2;
+                                       bezier_->c2=bezier.c2;
+                                       add_bezier(bezier_);
+                                       last_bezier()->signal_user_click(2).connect(
+                                               sigc::bind(
+                                                       sigc::mem_fun(
+                                                               *canvas_view,
+                                                               &studio::CanvasView::popup_param_menu_bezier),
+                                                       synfigapp::ValueDesc(value_node,first)));
+                               }
                        }
                        /*else if(value_node->get_contained_type()==ValueBase::TYPE_SEGMENT)
                        {