[Kst] extragear/graphics/kst
George Staikos
staikos at kde.org
Mon Dec 19 17:32:01 CET 2005
SVN commit 489733 by staikos:
- can't reproduce the memory error
- fix plugin module setting
M +1 -5 devel-docs/RELEASE_PLAN
M +8 -5 kst/extensions/js/bind_plugin.cpp
M +1 -0 kst/extensions/js/bind_pluginmodule.h
M +30 -0 kst/extensions/js/kstbinding.cpp
M +2 -0 kst/extensions/js/kstbinding.h
--- trunk/extragear/graphics/kst/devel-docs/RELEASE_PLAN #489732:489733
@@ -6,19 +6,15 @@
- KstScript:
- Curve and images need reworking
- Additional plot bindings?
- - Line and Arrow orientations fixed (1.2.1)
- Invalid child object creation
- UI:
- plot children adjust relative to the plot region
- - Printing
- clipping of lines/arrows (1.2.1?)
- Saving works?
- Docs
- fix extdate compile issue
- Speedup for planck time input
- margin/padding becomes tenths of font size(0)
- - *** glibc detected *** free(): invalid pointer: 0xbfff43b0 ***
- happens when changing sample range with planck database
2) Review changes to .kst format
1.3 Release Plan - data analysis release (Apr 31 2006 :-))
@@ -70,4 +66,4 @@
- Time should automatically set axis labels and choose proper index vector
- Selection points are clipped
- mutable collection entries (1.2.1?)
-
+ - deal with holes in data
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_plugin.cpp #489732:489733
@@ -83,7 +83,7 @@
static PluginProperties pluginProperties[] = {
- { "module", 0L, &KstBindPlugin::module },
+ { "module", &KstBindPlugin::setModule, &KstBindPlugin::module },
{ "lastError", 0L, &KstBindPlugin::lastError },
{ "valid", 0L, &KstBindPlugin::valid },
{ 0L, 0L, 0L }
@@ -204,10 +204,13 @@
exec->setException(eobj);
return;
}
- KstPluginPtr d = makePlugin(_d);
- if (d) {
- KstWriteLocker wl(d);
- //d->setPlugin(); FIXME - then enable above
+ KstSharedPtr<Plugin> m = KstBinding::extractPluginModule(exec, value);
+ if (m) {
+ KstPluginPtr d = makePlugin(_d);
+ if (d) {
+ KstWriteLocker wl(d);
+ d->setPlugin(m);
+ }
}
}
--- trunk/extragear/graphics/kst/kst/extensions/js/bind_pluginmodule.h #489732:489733
@@ -99,6 +99,7 @@
KJS::Value outputs(KJS::ExecState *exec) const;
protected:
+ friend class KstBinding;
KstBindPluginModule(int id);
void addBindings(KJS::ExecState *exec, KJS::Object& obj);
--- trunk/extragear/graphics/kst/kst/extensions/js/kstbinding.cpp #489732:489733
@@ -23,12 +23,14 @@
#include "bind_datavector.h"
#include "bind_object.h"
#include "bind_plot.h"
+#include "bind_pluginmodule.h"
#include "bind_vector.h"
#include "bind_window.h"
#include <kst.h>
#include <kstdatacollection.h>
#include <kstviewwindow.h>
+#include <plugincollection.h>
KstBinding::KstBinding(const QString& name, bool hasConstructor)
: KJS::ObjectImp(), _name(name), _id(hasConstructor ? KST_BINDING_CONSTRUCTOR : KST_BINDING_NOCONSTRUCTOR) {
@@ -114,6 +116,34 @@
}
+KstSharedPtr<Plugin> KstBinding::extractPluginModule(KJS::ExecState *exec, const KJS::Value& value, bool doThrow) {
+ switch (value.type()) {
+ case KJS::ObjectType:
+ {
+ KstSharedPtr<Plugin> dp;
+ KstBindPluginModule *imp = dynamic_cast<KstBindPluginModule*>(value.toObject(exec).imp());
+ if (imp) {
+ Plugin::Data d = imp->_d;
+ PluginCollection *pc = PluginCollection::self();
+ dp = pc->plugin(d._name);
+ }
+ if (!dp && doThrow) {
+ KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
+ exec->setException(eobj);
+ }
+ return dp;
+ }
+ // fall through and throw
+ default:
+ if (doThrow) {
+ KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
+ exec->setException(eobj);
+ }
+ return 0L;
+ }
+}
+
+
KstDataObjectPtr KstBinding::extractDataObject(KJS::ExecState *exec, const KJS::Value& value, bool doThrow) {
switch (value.type()) {
case KJS::ObjectType:
--- trunk/extragear/graphics/kst/kst/extensions/js/kstbinding.h #489732:489733
@@ -24,6 +24,7 @@
#include <kstdatasource.h>
#include <kstvcurve.h>
#include <kstvector.h>
+#include <plugin.h>
class KstViewWindow;
@@ -50,6 +51,7 @@
static KstDataSourcePtr extractDataSource(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
static KstDataObjectPtr extractDataObject(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
+ static KstSharedPtr<Plugin> extractPluginModule(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
static KstVectorPtr extractVector(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
static KstVCurvePtr extractVCurve(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
static KstViewWindow *extractWindow(KJS::ExecState*, const KJS::Value&, bool doThrow = true);
More information about the Kst
mailing list