[Kst] branches/work/kst/portto4/kst/src

Barth Netterfield netterfield at astro.utoronto.ca
Tue Mar 22 19:45:11 CET 2011


SVN commit 1225665 by netterfield:

While getting into the XNUM bug for plugins, I got distracted into fixing names in
the view scalar dialog.

The names should probably also have the short name as well...



 M  +13 -2     libkstapp/primitivemodel.h  
 M  +1 -0      libkstmath/basicplugin.cpp  
 M  +9 -1      libkstmath/dataobject.cpp  
 M  +1 -1      libkstmath/dataobject.h  
 M  +1 -1      widgets/scalarselector.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/primitivemodel.h #1225664:1225665
@@ -77,6 +77,9 @@
   void addMeta(T* m, PrimitiveTreeItem* parent = 0);
 
   template<class T>
+  void addOrphanMeta(T* m, PrimitiveTreeItem* parent = 0);
+
+  template<class T>
   void addMetas(const PrimitiveMap& metarMap, PrimitiveTreeItem* parent);
 
   template<class T>
@@ -112,7 +115,7 @@
       addPrimitivesMetas<T>(kst_cast<Primitive>(obj));
     } else if (kst_cast<T>(obj)) {
       if (kst_cast<T>(obj) && kst_cast<T>(obj)->orphan()) {
-        addMeta<T>(kst_cast<T>(obj));
+        addOrphanMeta<T>(kst_cast<T>(obj));
       }
     } else if (kst_cast<DataObject>(obj)) {
       addDataObjectsMetas<T>(kst_cast<DataObject>(obj));
@@ -130,7 +133,12 @@
   addPrimitiveTreeItem(QList<QVariant>() << m->slaveName() << m->value(), parent);
 }
 
+template<class T>
+void PrimitiveModel::addOrphanMeta(T* m, PrimitiveTreeItem* parent) {
+  addPrimitiveTreeItem(QList<QVariant>() << m->descriptiveName() << m->value(), parent);
+}
 
+
 template<class T>
 void PrimitiveModel::addMetas(const PrimitiveMap& metarMap, PrimitiveTreeItem* parent) {
   foreach(const PrimitivePtr& m, metarMap) {
@@ -162,7 +170,7 @@
 void PrimitiveModel::addDataObjectsMetas(DataObjectPtr dataObject, PrimitiveTreeItem* parent) {
   PrimitiveTreeItem* item = addPrimitiveTreeItem(QList<QVariant>() << dataObject->Name(), parent);
 
-  ObjectList<Primitive> primitives = dataObject->outputPrimitives();
+  ObjectList<Primitive> primitives = dataObject->outputPrimitives(false);
   foreach(PrimitivePtr prim, primitives) {
     if (   kst_cast<Vector>(prim)
         || kst_cast<Matrix>(prim)
@@ -170,8 +178,11 @@
     {
       addPrimitivesMetas<T>(prim.data(), item);
     }
+    if (kst_cast<T>(prim)) {
+      addMeta<T>(kst_cast<T>(prim), item);
   }
 }
+}
 
 
 }
--- branches/work/kst/portto4/kst/src/libkstmath/basicplugin.cpp #1225664:1225665
@@ -214,6 +214,7 @@
   StringPtr s = store()->createObject<String>();
   s->setProvider(this);
   s->setSlaveName(txt);
+  s->setOrphan(false);
   _outputStrings.insert(type, s);
 }
 
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.cpp #1225664:1225665
@@ -135,32 +135,40 @@
 }
 
 
-PrimitiveList DataObject::outputPrimitives()  const {
+PrimitiveList DataObject::outputPrimitives(bool include_decendants)  const {
   PrimitiveList primitive_list;
 
   int n = _outputMatrices.count();
   for (int i = 0; i< n; i++) {
       primitive_list.append(kst_cast<Primitive>(_outputMatrices.values().at(i)));
+      if (include_decendants) {
       primitive_list.append(_outputMatrices.values().at(i)->outputPrimitives());
   }
+  }
 
   n = _outputStrings.count();
   for (int i = 0; i< n; i++) {
       primitive_list.append(kst_cast<Primitive>(_outputStrings.values().at(i)));
+      if (include_decendants) {
       primitive_list.append(_outputStrings.values().at(i)->outputPrimitives());
   }
+  }
 
   n = _outputScalars.count();
   for (int i = 0; i< n; i++) {
       primitive_list.append(kst_cast<Primitive>(_outputScalars.values().at(i)));
+      if (include_decendants) {
       primitive_list.append(_outputScalars.values().at(i)->outputPrimitives());
   }
+  }
 
   n = _outputVectors.count();
   for (int i = 0; i< n; i++) {
       primitive_list.append(kst_cast<Primitive>(_outputVectors.values().at(i)));
+      if (include_decendants) {
       primitive_list.append(_outputVectors.values().at(i)->outputPrimitives());
   }
+  }
 
   return primitive_list;
 }
--- branches/work/kst/portto4/kst/src/libkstmath/dataobject.h #1225664:1225665
@@ -97,7 +97,7 @@
     MatrixMap& outputMatrices() { return _outputMatrices; }
 
     virtual PrimitiveList inputPrimitives() const;
-    PrimitiveList outputPrimitives() const;
+    PrimitiveList outputPrimitives(bool include_descendants = true) const;
 
     virtual void load(const QXmlStreamReader& s);
     virtual void save(QXmlStreamWriter& s);
--- branches/work/kst/portto4/kst/src/widgets/scalarselector.cpp #1225664:1225665
@@ -112,7 +112,7 @@
     scalar->setValue(value);
     scalar->setOrphan(true);
     scalar->setEditable(true);
-
+    scalar->setDescriptiveName(QString());
     scalar->writeLock();
     scalar->registerChange();
     scalar->unlock();


More information about the Kst mailing list