void JSObjectProxy::addBindingsClass( KJS::ExecState *exec, KJS::Object & /*object*/ ) { KJS::Identifier clazzid; QObject *o = obj; Bindings::BindingObject *bo = dynamic_cast<Bindings::BindingObject *>( o ); if ( bo ) { clazzid = KJS::Identifier( bo->jsClassName() ? bo->jsClassName() : obj->className() ); } else { clazzid = KJS::Identifier( obj->className() ); } KJS::Object global = js->globalObject(); if ( global.hasProperty( exec, clazzid ) ) { kdDebug( 80001 ) << "addBindingsClass() " << clazzid.qstring() << " already known" << endl; KJS::Object clazz = global.get( exec, clazzid ).toObject( exec ); Bindings::JSFactoryImp *imp = dynamic_cast<Bindings::JSFactoryImp *>( clazz.imp() ); if ( !imp ) { kdWarning() << "addBindingsClass() Class was not created by normal means" << endl; return ; } kdDebug( 80001 ) << "addBindingsClass() Adding enums" << endl; imp->setDefaultValue( js->builtinObject().construct( exec, KJS::List() ) ); addBindingsEnum( exec, clazz ); } else { kdWarning() << "addBindingsClass() " << clazzid.qstring() << " not known" << endl; } }
KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const { QString plugin = item.qstring(); const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList(); for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) { if (it.data()._name == plugin) { return KJS::Object(new KstBindPluginModule(exec, it.data())); } } const KstPluginInfoList pluginInfo = KstDataObject::pluginInfoList(); for (KstPluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) { if (it.key() == plugin) { KstDataObjectPtr ptr = KstDataObject::plugin(it.key()); if (ptr) { KstBasicPluginPtr bp = kst_cast<KstBasicPlugin>(ptr); if (bp) { return KJS::Object(new KstBindPluginModule(exec, bp)); } } } } return KJS::Undefined(); }
KJS::Value KstBindWindowCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const { KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(item.qstring())); if (w) { return KJS::Object(new KstBindWindow(exec, w)); } return KJS::Undefined(); }
KJS::Value KstBindDataObjectCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const { KstReadLocker rl(&KST::dataObjectList.lock()); KstDataObjectPtr d = *KST::dataObjectList.findTag(item.qstring()); if (d) { return KJS::Object(KstBindDataObject::bind(exec, d)); } return KJS::Undefined(); }
KJS::Value KstBindPluginModuleCollection::extract(KJS::ExecState *exec, const KJS::Identifier& item) const { const QMap<QString,Plugin::Data>& pluginList = PluginCollection::self()->pluginList(); QString i = item.qstring(); for (QMap<QString,Plugin::Data>::ConstIterator it = pluginList.begin(); it != pluginList.end(); ++it) { if (it.data()._name == i) { return KJS::Object(new KstBindPluginModule(exec, it.data())); } } return KJS::Undefined(); }
bool KstBindDataObjectCollection::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; dataObjectCollectionProperties[i].name; ++i) { if (prop == dataObjectCollectionProperties[i].name) { return true; } } return KstBindCollection::hasProperty(exec, propertyName); }
bool KstBindTimeInterpretation::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; timeInterpretationProperties[i].name; ++i) { if (prop == timeInterpretationProperties[i].name) { return true; } } return KstBinding::hasProperty(exec, propertyName); }
bool KstBindPoint::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; pointProperties[i].name; ++i) { if (prop == pointProperties[i].name) { return true; } } return KstBinding::hasProperty(exec, propertyName); }
bool KstBindLegend::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; legendProperties[i].name; ++i) { if (prop == legendProperties[i].name) { return true; } } return KstBindBorderedViewObject::hasProperty(exec, propertyName); }
bool KstBindEllipse::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; ellipseProperties[i].name; ++i) { if (prop == ellipseProperties[i].name) { return true; } } return KstBindViewObject::hasProperty(exec, propertyName); }
KJS::Value KstBindKst::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (propertyName.qstring() == "version") { return KJS::String(KSTVERSION); } if (propertyName.qstring() == "scriptVersion") { return KJS::Number(1); } QString prop = propertyName.qstring(); for (int i = 0; kstProperties[i].name; ++i) { if (prop == kstProperties[i].name) { if (!kstProperties[i].get) { break; } return (this->*kstProperties[i].get)(exec); } } return KstBinding::get(exec, propertyName); }
KJS::Value KstBindTimeInterpretation::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; timeInterpretationProperties[i].name; ++i) { if (prop == timeInterpretationProperties[i].name) { if (!timeInterpretationProperties[i].get) { break; } return (this->*timeInterpretationProperties[i].get)(exec); } } return KstBinding::get(exec, propertyName); }
KJS::Value KstBindPoint::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; pointProperties[i].name; ++i) { if (prop == pointProperties[i].name) { if (!pointProperties[i].get) { break; } return (this->*pointProperties[i].get)(exec); } } return KstBinding::get(exec, propertyName); }
void KstBindTimeInterpretation::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) { QString prop = propertyName.qstring(); for (int i = 0; timeInterpretationProperties[i].name; ++i) { if (prop == timeInterpretationProperties[i].name) { if (!timeInterpretationProperties[i].set) { break; } (this->*timeInterpretationProperties[i].set)(exec, value); return; } } KstBinding::put(exec, propertyName, value, attr); }
bool KstBindKst::hasProperty(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { QString prop = propertyName.qstring(); for (int i = 0; kstProperties[i].name; ++i) { if (prop == kstProperties[i].name) { return true; } } if (prop == "version" || prop == "scriptVersion") { return true; } return KstBinding::hasProperty(exec, propertyName); }
void KstBindPlotLabel::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) { QString prop = propertyName.qstring(); for (int i = 0; plotLabelProperties[i].name; ++i) { if (prop == plotLabelProperties[i].name) { if (!plotLabelProperties[i].set) { break; } (this->*plotLabelProperties[i].set)(exec, value); return; } } KstBinding::put(exec, propertyName, value, attr); }
KJS::Value KstBindWindow::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (!_d) { return KstBinding::get(exec, propertyName); } QString prop = propertyName.qstring(); for (int i = 0; windowProperties[i].name; ++i) { if (prop == windowProperties[i].name) { if (!windowProperties[i].get) { break; } return (this->*windowProperties[i].get)(exec); } } return KstBinding::get(exec, propertyName); }
KJS::Value KstBindDataObjectCollection::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (id() > 0) { return KstBindCollection::get(exec, propertyName); } QString prop = propertyName.qstring(); for (int i = 0; dataObjectCollectionProperties[i].name; ++i) { if (prop == dataObjectCollectionProperties[i].name) { if (!dataObjectCollectionProperties[i].get) { break; } return (this->*dataObjectCollectionProperties[i].get)(exec); } } return KstBindCollection::get(exec, propertyName); }
KJS::Value KstBindCurve::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (!_d) { return KstBindDataObject::get(exec, propertyName); } QString prop = propertyName.qstring(); for (int i = 0; curveProperties[i].name; ++i) { if (prop == curveProperties[i].name) { if (!curveProperties[i].get) { break; } return (this->*curveProperties[i].get)(exec); } } return KstBindDataObject::get(exec, propertyName); }
KJS::Value KstBindLegend::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (!_d) { return KstBindBorderedViewObject::get(exec, propertyName); } QString prop = propertyName.qstring(); for (int i = 0; legendProperties[i].name; ++i) { if (prop == legendProperties[i].name) { if (!legendProperties[i].get) { break; } return (this->*legendProperties[i].get)(exec); } } return KstBindBorderedViewObject::get(exec, propertyName); }
KJS::Value KstBindEllipse::get(KJS::ExecState *exec, const KJS::Identifier& propertyName) const { if (!_d) { return KstBindViewObject::get(exec, propertyName); } QString prop = propertyName.qstring(); for (int i = 0; ellipseProperties[i].name; ++i) { if (prop == ellipseProperties[i].name) { if (!ellipseProperties[i].get) { break; } return (this->*ellipseProperties[i].get)(exec); } } return KstBindViewObject::get(exec, propertyName); }
void KstBindWindow::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) { if (!_d) { KstBinding::put(exec, propertyName, value, attr); return; } QString prop = propertyName.qstring(); for (int i = 0; windowProperties[i].name; ++i) { if (prop == windowProperties[i].name) { if (!windowProperties[i].set) { break; } (this->*windowProperties[i].set)(exec, value); return; } } KstBinding::put(exec, propertyName, value, attr); }
void KstBindEllipse::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) { if (!_d) { KstBindViewObject::put(exec, propertyName, value, attr); return; } QString prop = propertyName.qstring(); for (int i = 0; ellipseProperties[i].name; ++i) { if (prop == ellipseProperties[i].name) { if (!ellipseProperties[i].set) { break; } (this->*ellipseProperties[i].set)(exec, value); return; } } KstBindViewObject::put(exec, propertyName, value, attr); }
void KstBindPowerSpectrum::put(KJS::ExecState *exec, const KJS::Identifier& propertyName, const KJS::Value& value, int attr) { if (!_d) { KstBindDataObject::put(exec, propertyName, value, attr); return; } QString prop = propertyName.qstring(); for (int i = 0; powerSpectrumProperties[i].name; ++i) { if (prop == powerSpectrumProperties[i].name) { if (!powerSpectrumProperties[i].set) { break; } (this->*powerSpectrumProperties[i].set)(exec, value); return; } } KstBindDataObject::put(exec, propertyName, value, attr); }