Code

reimplement acceptsNumParams(); instead of making it a virtual function we just make...
authorcilix42 <cilix42@users.sourceforge.net>
Mon, 18 Aug 2008 00:32:47 +0000 (00:32 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Mon, 18 Aug 2008 00:32:47 +0000 (00:32 +0000)
src/live_effects/effect.cpp
src/live_effects/effect.h

index 3f12345ae2af7e736e8c57651302fb675574849b..1308a1860092d838346f1067ffadb5b41f808910 100644 (file)
@@ -107,6 +107,17 @@ const Util::EnumData<EffectType> LPETypeData[] = {
 };
 const Util::EnumDataConverter<EffectType> LPETypeConverter(LPETypeData, sizeof(LPETypeData)/sizeof(*LPETypeData));
 
+int
+Effect::acceptsNumParams(EffectType type) {
+    switch (type) {
+        case ANGLE_BISECTOR: return 3;
+        case PERP_BISECTOR: return 2;
+        case CIRCLE_3PTS: return 3;
+        case CIRCLE_WITH_RADIUS: return 2;
+        default: return 0;
+    }
+}
+
 Effect*
 Effect::New(EffectType lpenr, LivePathEffectObject *lpeobj)
 {
index c01cab5c384a45714154b553d8f2c9d1e1a28193..1bc3988ab49e3b4bf94d20a86e23684275467e92 100644 (file)
@@ -109,7 +109,8 @@ public:
     void writeParamsToSVG();
 
     virtual void acceptParamPath (SPPath *param_path);
-    virtual int acceptsNumParams() { return 0; }
+    static int acceptsNumParams(EffectType type);
+    int acceptsNumParams() { return acceptsNumParams(effectType()); }
     void doAcceptPathPreparations(SPLPEItem *lpeitem);
 
     inline bool pathParamAccepted() { return done_pathparam_set; }