[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kig
From: Maurizio Paolini <paolini () dmf ! unicatt ! it>
Date: 2005-12-11 15:48:52
Message-ID: 1134316132.105582.29819.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 487698 by paolini:
Now construction by center and radius can also be done
using the NumericTextImp (noti yet circle_by_center_and_diameter).
Compatibility with old kig files is preserved. User can still
click on a segment.
M +2 -2 kig/kigpartui.rc
M +0 -1 macros/Makefile.am
M +7 -0 misc/builtin_stuff.cc
M +70 -3 objects/circle_type.cc
M +2 -1 objects/transform_types.cc
--- trunk/KDE/kdeedu/kig/kig/kigpartui.rc #487697:487698
@@ -58,7 +58,7 @@
<text>&Circles && Arcs</text>
<Action name="objects_new_circlebcp" />
<Action name="objects_new_circlebtp" />
- <Action name="objects_new_circlebps" />
+ <Action name="objects_new_circlebpr" />
<Action name="objects_new_circlebpd" />
<Action name="objects_new_circlebcl" />
<Action name="objects_new_arcbtp" />
@@ -227,7 +227,7 @@
<text>Circles && Arcs</text>
<Action name="objects_new_circlebcp" />
<Action name="objects_new_circlebtp" />
- <Action name="objects_new_circlebps" />
+ <Action name="objects_new_circlebpr" />
<Action name="objects_new_circlebpd" />
<Action name="objects_new_arcbtp" />
<ActionList name="user_circle_types" />
--- trunk/KDE/kdeedu/kig/macros/Makefile.am #487697:487698
@@ -2,7 +2,6 @@
builtinmacro_DATA = \
circle_by_center_and_line.kigt \
circle_by_point_and_diameter.kigt \
- circle_by_point_and_segment.kigt \
equitriangle.kigt \
evolute.kigt \
osculating_circle.kigt \
--- trunk/KDE/kdeedu/kig/misc/builtin_stuff.cc #487697:487698
@@ -107,6 +107,13 @@
ctors->add( c );
actions->add( new ConstructibleAction( c, "objects_new_circlebtp" ) );
+ c = new SimpleObjectTypeConstructor(
+ CircleBPRType::instance(), I18N_NOOP( "Circle by Point && Radius" ),
+ I18N_NOOP( "A circle defined by its center and the length of the radius" ),
+ "circlebps" );
+ ctors->add( c );
+ actions->add( new ConstructibleAction( c, "objects_new_circlebpr" ) );
+
// declare this object static to this function, so it gets deleted
// at the end of the program, without us having to wonder about
// deleting it.. We don't want to register this
--- trunk/KDE/kdeedu/kig/objects/circle_type.cc #487697:487698
@@ -21,11 +21,72 @@
#include "bogus_imp.h"
#include "line_imp.h"
#include "point_imp.h"
+#include "text_imp.h"
#include "../misc/common.h"
#include <klocale.h>
+double getDoubleFromImp( const ObjectImp* obj, bool& valid );
+
+class LengthImpType
+ : public ObjectImpType
+{
+public:
+ LengthImpType( const ObjectImpType* parent, const char* internalname,
+ const char* translatedname,
+ const char* selectstatement,
+ const char* selectnamestatement,
+ const char* removeastatement,
+ const char* addastatement,
+ const char* moveastatement,
+ const char* attachtothisstatement,
+ const char* showastatement,
+ const char* hideastatement );
+ ~LengthImpType();
+ virtual bool match( const ObjectImpType* t ) const;
+};
+
+//LengthImpType::LengthImpType( const ObjectImpType* parent,
+// const char* internalname,
+// const char* translatedname,
+// const char* selectstatement,
+// const char* selectnamestatement,
+// const char* removeastatement,
+// const char* addastatement,
+// const char* moveastatement,
+// const char* attachtothisstatement,
+// const char* showastatement,
+// const char* hideastatement )
+// : ObjectImpType( parent, internalname, translatedname, selectstatement,
+// selectnamestatement, removeastatement, addastatement,
+// moveastatement, attachtothisstatement,
+// showastatement, hideastatement )
+//{
+//}
+//
+//LengthImpType::~LengthImpType()
+//{
+//}
+//
+//bool LengthImpType::match( const ObjectImpType* t ) const
+//{
+// return t == this || t == SegmentImp::stype() || t == NumericTextImp::stype();
+//}
+
+static const LengthImpType lengthimp(
+ ObjectImp::stype(), "length-object",
+ I18N_NOOP( "length" ),
+ I18N_NOOP( "Select this length" ),
+ I18N_NOOP( "Select length %1" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" ),
+ I18N_NOOP( "SHOULD NOT BE SEEN" )
+ );
+
static const char constructcirclethroughpointstat[] = I18N_NOOP( "Construct a circle \
through this point" );
static const char constructcirclewithcenterstat[] = I18N_NOOP( "Construct a circle \
with this center" ); @@ -146,8 +207,10 @@
static const ArgsParser::spec argsspecCircleBPR[] =
{
- { PointImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", false },
- { DoubleImp::stype(), "SHOULD NOT BE SEEN", "SHOULD NOT BE SEEN", false }
+ { PointImp::stype(), constructcirclewithcenterstat,
+ I18N_NOOP( "Select the center of the new circle..." ), false },
+ { &lengthimp, I18N_NOOP( "With this radius" ),
+ I18N_NOOP( "Select the length of the radius..." ), false }
};
KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( CircleBPRType )
@@ -171,7 +234,11 @@
{
if ( ! margsparser.checkArgs( args ) ) return new InvalidImp;
const Coordinate c = static_cast<const PointImp*>( args[0] )->coordinate();
- double r = static_cast<const DoubleImp*>( args[1] )->data();
+ bool valid;
+ double r = getDoubleFromImp( args[1], valid);
+ if ( ! valid ) return new InvalidImp;
+ r = fabs( r );
+ // double r = static_cast<const DoubleImp*>( args[1] )->data();
return new CircleImp( c, r );
}
--- trunk/KDE/kdeedu/kig/objects/transform_types.cc #487697:487698
@@ -90,7 +90,8 @@
bool LengthImpType::match( const ObjectImpType* t ) const
{
- return t == this || t == SegmentImp::stype() || t == NumericTextImp::stype();
+ return t == this || t == SegmentImp::stype() || t == NumericTextImp::stype()
+ || t == DoubleImp::stype();
}
static const LengthImpType lengthimp(
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic