[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Dec 19 15:17:25 CET 2003
CVS commit by staikos:
filters are almost functional right now. just a few small FIXMEs to go...
M +2 -2 kstdatamanager_i.cpp 1.43
M +17 -1 kstfilter.cpp 1.3
M +4 -4 kstfilter.h 1.6
M +5 -2 kstfilteredvector.cpp 1.3
M +2 -3 kstplugin.h 1.22
--- kdeextragear-2/kst/kst/kstdatamanager_i.cpp #1.42:1.43
@@ -185,5 +185,5 @@ void KstObjectItem::update(bool recursiv
void KstObjectItem::updateButtons() {
- _dm->Edit->setEnabled(RTTI_OBJ_VECTOR != _rtti);
+ _dm->Edit->setEnabled(RTTI_OBJ_VECTOR != _rtti && RTTI_OBJ_FILTERED_VECTOR != _rtti);
_dm->Delete->setEnabled(_removable);
}
@@ -416,5 +416,5 @@ void KstDataManagerI::contextMenu(QListV
int id;
- if (koi->rtti() != RTTI_OBJ_VECTOR) {
+ if (koi->rtti() != RTTI_OBJ_VECTOR && koi->rtti() != RTTI_OBJ_FILTERED_VECTOR) {
id = m->insertItem(i18n("&Edit..."), this, SLOT(edit_I()));
}
--- kdeextragear-2/kst/kst/kstfilter.cpp #1.2:1.3
@@ -31,7 +31,23 @@ KstFilter::~KstFilter() {
-void KstFilter::apply(KstVectorPtr& v) {
+void KstFilter::apply(const KstVectorPtr in, KstVectorPtr out) {
+ double *inScalars = 0L;
+ double *outVector = out->value();
+ int outLen = out->length();
+
+ // FIXME: set scalars
+
+ int rc = plugin()->filter(in->value(), in->length(), inScalars, outVector, &outLen);
+
+ vectorRealloced(out, outVector, outLen);
+
+ delete inScalars;
}
+bool KstFilter::setPlugin(KSharedPtr<Plugin> plugin) {
+ _plugin = plugin;
+ return true;
+}
+
// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstfilter.h #1.5:1.6
@@ -29,5 +29,6 @@ class KstFilter : public KstPlugin {
virtual ~KstFilter();
- virtual void apply(KstVectorPtr& v);
+ virtual void apply(const KstVectorPtr in, KstVectorPtr out);
+ virtual bool setPlugin(KSharedPtr<Plugin> plugin);
};
@@ -40,9 +41,8 @@ class KstFilterSet : public KstObjectLis
virtual ~KstFilterSet() {}
- virtual void apply(KstVectorPtr& v) {
+ virtual void apply(const KstVectorPtr in, KstVectorPtr out) {
for (Iterator it = begin(); it != end(); ++it) {
// FIXME: must use temps here
- // FIXME: add the inline optimization
- (*it)->apply(v);
+ (*it)->apply(in, out);
}
}
--- kdeextragear-2/kst/kst/kstfilteredvector.cpp #1.2:1.3
@@ -20,4 +20,5 @@
KstFilteredVector::KstFilteredVector(KstVectorPtr parent, KstFilterSetPtr filterSet)
: KstVector(parent->tagName() + "-" + filterSet->name(), parent->length()), _parent(parent), _filterSet(filterSet) {
+ update();
}
@@ -28,7 +29,9 @@ KstFilteredVector::~KstFilteredVector()
KstObject::UpdateType KstFilteredVector::update(int update_counter) {
- KstObject::UpdateType ut = KstVector::update(update_counter);
+ _parent->update(update_counter);
- // FIXME
+ _filterSet->apply(_parent, KstVectorPtr(this));
+
+ KstObject::UpdateType ut = KstVector::update(update_counter);
return ut;
--- kdeextragear-2/kst/kst/kstplugin.h #1.21:1.22
@@ -44,5 +44,5 @@ public:
bool isValid() const;
- bool setPlugin(KSharedPtr<Plugin> plugin);
+ virtual bool setPlugin(KSharedPtr<Plugin> plugin);
KSharedPtr<Plugin> plugin() const;
@@ -51,9 +51,8 @@ public:
protected:
virtual void _showDialog();
+ KSharedPtr<Plugin> _plugin;
private:
void commonConstructor();
-
- KSharedPtr<Plugin> _plugin;
unsigned _inScalarCnt, _inArrayCnt, _outScalarCnt, _outArrayCnt;
};
More information about the Kst
mailing list