X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Ftrunk%2Fsrc%2Fmodules%2Fmod_geometry%2Fstar.cpp;h=eda68971db0e1b84a556698d84aeab847a9c95b8;hb=2669ed203c4766b4fd66949d8b7c815cccc0bce6;hp=161e5b3c8db815f09680bac8fdcf7f5aa4bf1331;hpb=70bcefce2ab011a11014f36fc129b473cc0bc61e;p=synfig.git diff --git a/synfig-core/trunk/src/modules/mod_geometry/star.cpp b/synfig-core/trunk/src/modules/mod_geometry/star.cpp index 161e5b3..eda6897 100644 --- a/synfig-core/trunk/src/modules/mod_geometry/star.cpp +++ b/synfig-core/trunk/src/modules/mod_geometry/star.cpp @@ -2,6 +2,8 @@ /*! \file star.cpp ** \brief Template Header ** +** $Id$ +** ** \legal ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** @@ -59,7 +61,7 @@ SYNFIG_LAYER_SET_NAME(Star,"star"); SYNFIG_LAYER_SET_LOCAL_NAME(Star,_("Star")); SYNFIG_LAYER_SET_CATEGORY(Star,_("Geometry")); SYNFIG_LAYER_SET_VERSION(Star,"0.1"); -SYNFIG_LAYER_SET_CVS_ID(Star,"$Id: star.cpp,v 1.1.1.1 2005/01/04 01:23:10 darco Exp $"); +SYNFIG_LAYER_SET_CVS_ID(Star,"$Id$"); /* === P R O C E D U R E S ================================================= */ @@ -71,7 +73,8 @@ Star::Star(): radius1(1.0), radius2(0.38), points(5), - angle(Angle::deg(90)) + angle(Angle::deg(90)), + regular_polygon(false) { sync(); } @@ -88,7 +91,8 @@ Star::sync() Angle dist1(dist_between_points*i+angle); Angle dist2(dist_between_points*i+dist_between_points/2+angle); vector_list.push_back(Point(Angle::cos(dist1).get()*radius1,Angle::sin(dist1).get()*radius1)); - vector_list.push_back(Point(Angle::cos(dist2).get()*radius2,Angle::sin(dist2).get()*radius2)); + if (!regular_polygon) + vector_list.push_back(Point(Angle::cos(dist2).get()*radius2,Angle::sin(dist2).get()*radius2)); } clear(); add_polygon(vector_list); @@ -97,21 +101,21 @@ Star::sync() bool Star::set_param(const String & param, const ValueBase &value) { - if( param=="radius1" && value.same_as(radius1)) + if( param=="radius1" && value.same_type_as(radius1)) { value.put(&radius1); sync(); return true; } - if( param=="radius2" && value.same_as(radius2)) + if( param=="radius2" && value.same_type_as(radius2)) { value.put(&radius2); sync(); return true; } - if( param=="points" && value.same_as(points)) + if( param=="points" && value.same_type_as(points)) { value.put(&points); if(points<2)points=2; @@ -119,13 +123,20 @@ Star::set_param(const String & param, const ValueBase &value) return true; } - if( param=="angle" && value.same_as(angle)) + if( param=="angle" && value.same_type_as(angle)) { value.put(&angle); sync(); return true; } + if(param=="regular_polygon" && value.same_type_as(regular_polygon)) + { + value.put(®ular_polygon); + sync(); + return true; + } + if(param=="vector_list") return false; @@ -139,6 +150,7 @@ Star::get_param(const String& param)const EXPORT(radius2); EXPORT(points); EXPORT(angle); + EXPORT(regular_polygon); EXPORT_NAME(); EXPORT_VERSION(); @@ -182,5 +194,10 @@ Star::get_param_vocab()const .set_description(_("The number of points in the star")) ); + ret.push_back(ParamDesc("regular_polygon") + .set_local_name(_("Regular Polygon")) + .set_description(_("Whether to draw a star or a regular polygon")) + ); + return ret; }