summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3558342)
raw | patch | inline | side by side (parent: 3558342)
author | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Sun, 12 Aug 2007 09:35:38 +0000 (09:35 +0000) | ||
committer | nicholasbishop <nicholasbishop@users.sourceforge.net> | |
Sun, 12 Aug 2007 09:35:38 +0000 (09:35 +0000) |
* Changed SPFeTurbulence/FilterTurbulence to use an enum for the type field
* Added type setting to the filter dialog
* Added type setting to the filter dialog
index 2dbb33e65a0751ecc7134d5a1583ca52f033a574..7a5fc1dcd7e3b6a6cf781b548d8242bb3962d6fc 100644 (file)
stitchTiles=st;
}
-void FilterTurbulence::set_type(int t){
+void FilterTurbulence::set_type(FilterTurbulenceType t){
type=t;
}
index bdb52e7b78316b239e5990cee7364f70c1e51bd8..8f7849f884264ac7381b35b33f541f1bc78a6eef 100644 (file)
namespace NR {
+enum FilterTurbulenceType {
+ TURBULENCE_FRACTALNOISE,
+ TURBULENCE_TURBULENCE,
+ TURBULENCE_ENDTYPE
+};
+
class FilterTurbulence : public FilterPrimitive {
public:
FilterTurbulence();
virtual void set_numOctaves(int num);
virtual void set_seed(double s);
virtual void set_stitchTiles(bool st);
- virtual void set_type(int t);
+ virtual void set_type(FilterTurbulenceType t);
private:
double XbaseFrequency, YbaseFrequency;
int numOctaves;
double seed;
bool stitchTiles;
- int type;
+ FilterTurbulenceType type;
};
} /* namespace NR */
diff --git a/src/filter-enums.cpp b/src/filter-enums.cpp
index d9f0a39861787ce03472b75e0e457d2694a13bd7..111cd62f9ea860a25563d5dfec920a781cfad5e9 100644 (file)
--- a/src/filter-enums.cpp
+++ b/src/filter-enums.cpp
@@ -101,6 +101,13 @@ const EnumData<NR::FilterMorphologyOperator> MorphologyOperatorData[NR::MORPHOLO
};
const EnumDataConverter<NR::FilterMorphologyOperator> MorphologyOperatorConverter(MorphologyOperatorData, NR::MORPHOLOGY_OPERATOR_END);
+// feTurbulence
+const EnumData<NR::FilterTurbulenceType> TurbulenceTypeData[NR::TURBULENCE_ENDTYPE] = {
+ {NR::TURBULENCE_FRACTALNOISE, _("Fractal Noise"), "fractalNoise"},
+ {NR::TURBULENCE_TURBULENCE, _("Turbulence"), "turbulence"}
+};
+const EnumDataConverter<NR::FilterTurbulenceType> TurbulenceTypeConverter(TurbulenceTypeData, NR::TURBULENCE_ENDTYPE);
+
// Light source
const EnumData<LightSource> LightSourceData[LIGHT_ENDSOURCE] = {
{LIGHT_DISTANT, _("Distance Light"), "svg:feDistanceLight"},
diff --git a/src/filter-enums.h b/src/filter-enums.h
index 37c7e6f0d7b677e195757f2f05dbde115f82d4f4..c1e3fcdcc7a74794fc9120d3d0efba2903ee267d 100644 (file)
--- a/src/filter-enums.h
+++ b/src/filter-enums.h
#include "display/nr-filter-composite.h"
#include "display/nr-filter-convolve-matrix.h"
#include "display/nr-filter-morphology.h"
+#include "display/nr-filter-turbulence.h"
#include "display/nr-filter-types.h"
#include "util/enums.h"
// Morphology operator
extern const Inkscape::Util::EnumData<NR::FilterMorphologyOperator> MorphologyOperatorData[NR::MORPHOLOGY_OPERATOR_END];
extern const Inkscape::Util::EnumDataConverter<NR::FilterMorphologyOperator> MorphologyOperatorConverter;
+// Turbulence type
+extern const Inkscape::Util::EnumData<NR::FilterTurbulenceType> TurbulenceTypeData[NR::TURBULENCE_ENDTYPE];
+extern const Inkscape::Util::EnumDataConverter<NR::FilterTurbulenceType> TurbulenceTypeConverter;
// Lighting
enum LightSource {
LIGHT_DISTANT,
index effdd777ee1ed657785901a7ca473381b33b598a..dfff840e0faa8bb00abd1d939195a9bdf5f4d2db 100644 (file)
--- a/src/sp-feturbulence.cpp
+++ b/src/sp-feturbulence.cpp
return false; // 'noStitch' is default
}
-static int sp_feTurbulence_read_type(gchar const *value){
- if (!value) return 1; // 'turbulence' is default
+static NR::FilterTurbulenceType sp_feTurbulence_read_type(gchar const *value){
+ if (!value) return NR::TURBULENCE_TURBULENCE; // 'turbulence' is default
switch(value[0]){
case 'f':
- if (strncmp(value, "fractalNoise", 12) == 0) return 0;
+ if (strncmp(value, "fractalNoise", 12) == 0) return NR::TURBULENCE_FRACTALNOISE;
break;
case 't':
- if (strncmp(value, "turbulence", 10) == 0) return 1;
+ if (strncmp(value, "turbulence", 10) == 0) return NR::TURBULENCE_TURBULENCE;
break;
}
- return 1; // 'turbulence' is default
+ return NR::TURBULENCE_TURBULENCE; // 'turbulence' is default
}
/**
int read_int;
double read_num;
bool read_bool;
+ NR::FilterTurbulenceType read_type;
switch(key) {
/*DEAL WITH SETTING ATTRIBUTES HERE*/
}
break;
case SP_ATTR_TYPE:
- read_int = sp_feTurbulence_read_type(value);
- if (read_int != feTurbulence->type){
- feTurbulence->type = read_int;
+ read_type = sp_feTurbulence_read_type(value);
+ if (read_type != feTurbulence->type){
+ feTurbulence->type = read_type;
object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
break;
diff --git a/src/sp-feturbulence.h b/src/sp-feturbulence.h
index 7f9adae130ad91c086e7023e3e7a26bf4184c8a4..40e1c0a4281fc1b030236c24cda3a56fbd79e256 100644 (file)
--- a/src/sp-feturbulence.h
+++ b/src/sp-feturbulence.h
#include "sp-filter.h"
#include "sp-feturbulence-fns.h"
#include "number-opt-number.h"
+#include "display/nr-filter-turbulence.h"
/* FeTurbulence base class */
class SPFeTurbulenceClass;
int numOctaves;
double seed;
bool stitchTiles;
- int type;
+ NR::FilterTurbulenceType type;
};
struct SPFeTurbulenceClass {
index c871d447e494d210c90fa798f0f8d7cf3d9fd578..24ba5cfc82017aa61ad2e503adcf3fbb4dd780c8 100644 (file)
_settings->type(NR_FILTER_TURBULENCE);
_settings->add_checkbutton(SP_ATTR_STITCHTILES, _("Stitch Tiles"), "stitch", "noStitch");
+ _settings->add_combo(SP_ATTR_TYPE, _("Type"), TurbulenceTypeConverter);
_settings->add_dualspinslider(SP_ATTR_BASEFREQUENCY, _("Base Frequency"), 0, 100, 1, 0.01, 1);
_settings->add_spinslider(SP_ATTR_NUMOCTAVES, _("Octaves"), 1, 10, 1, 1, 0);
_settings->add_spinslider(SP_ATTR_SEED, _("Seed"), 0, 1000, 1, 1, 0);