Restrict 'radius' ducks to the top right corner of the plane. This allows us to...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 9 Feb 2008 00:01:10 +0000 (00:01 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sat, 9 Feb 2008 00:01:10 +0000 (00:01 +0000)
git-svn-id: http://svn.voria.com/code@1632 1f10aa63-cdf2-0310-b900-c93c546f37ac

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

index 110a356..a8b4219 100644 (file)
@@ -556,6 +556,32 @@ Duckmatic::signal_edited_selected_ducks()
                                throw String("Bad edit");
                        }
                }
+#ifdef RESTRICT_RADIUS_DUCKS_TO_ONE_QUARTER
+               else if ((*iter)->is_radius())
+               {
+                       Point point((*iter)->get_point());
+                       bool changed = false;
+
+                       if (point[0] * (flip_x_ ? -1 : 1) < 0)
+                       {
+                               point[0] = 0;
+                               changed = true;
+                       }
+                       if (point[1] * (flip_y_ ? -1 : 1) < 0)
+                       {
+                               point[1] = 0;
+                               changed = true;
+                       }
+
+                       if (changed) (*iter)->set_point(point);
+
+                       if(!(*iter)->signal_edited()(point))
+                       {
+                               selected_ducks=old_set;
+                               throw String("Bad edit");
+                       }
+               }
+#endif
                else
                {
                        if(!(*iter)->signal_edited()((*iter)->get_point()))
index 2b160cf..3b6137e 100644 (file)
@@ -78,6 +78,8 @@ public:
 #include <map>
 #endif
 
+#define RESTRICT_RADIUS_DUCKS_TO_ONE_QUARTER
+
 /* === T Y P E D E F S ===================================================== */
 
 /* === C L A S S E S & S T R U C T S ======================================= */
index ed7a744..21c17af 100644 (file)
@@ -228,6 +228,13 @@ Renderer_Ducks::render_vfunc(
                origin[0]=(origin[0]-window_startx)/pw;
                origin[1]=(origin[1]-window_starty)/ph;
 
+#ifdef RESTRICT_RADIUS_DUCKS_TO_ONE_QUARTER
+               if((*iter)->is_radius())
+               {
+                       if (point[0] < origin[0]) point[0] = origin[0];
+                       if (point[1] > origin[1]) point[1] = origin[1];
+               }
+#endif
 
                bool selected(get_work_area()->duck_is_selected(*iter));
                bool hover(*iter==hover_duck);
@@ -374,7 +381,17 @@ Renderer_Ducks::render_vfunc(
 
                        if(hover)
                        {
+#ifdef RESTRICT_RADIUS_DUCKS_TO_ONE_QUARTER
+                               Point point2((*iter)->get_trans_point());
+                               Point origin2((*iter)->get_trans_origin());
+
+                               if ((point2[0] - origin2[0]) * pw < 0) point2[0] = origin2[0];
+                               if ((point2[1] - origin2[1]) * ph > 0) point2[1] = origin2[1];
+
+                               Distance real_mag((point2-origin2).mag(),Distance::SYSTEM_UNITS);
+#else
                                Distance real_mag(((*iter)->get_trans_point()-(*iter)->get_trans_origin()).mag(),Distance::SYSTEM_UNITS);
+#endif
                                real_mag.convert(App::distance_system,get_work_area()->get_rend_desc());
                                layout->set_text(real_mag.get_string());