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

Andrew Walker arwalker at sumusltd.com
Thu Dec 6 02:16:16 CET 2007


SVN commit 745352 by arwalker:

CCBUG:153153 Fix hierarchical naming convention for vectorView, basicPlugin, and cPlugin

 M  +0 -2      libkst/kstobject.h  
 M  +1 -2      libkstapp/kstbasicdialog_i.cpp  
 M  +1 -4      libkstapp/kstplugindialog_i.cpp  
 M  +4 -1      libkstapp/kstvvdialog_i.cpp  
 M  +27 -1     libkstmath/kstbasicplugin.cpp  
 M  +3 -2      libkstmath/kstbasicplugin.h  
 M  +30 -6     libkstmath/kstcplugin.cpp  
 M  +4 -3      libkstmath/kstcplugin.h  
 M  +38 -1     libkstmath/kstvectorview.cpp  
 M  +2 -0      libkstmath/kstvectorview.h  


--- branches/work/kst/1.6/kst/src/libkst/kstobject.h #745351:745352
@@ -416,6 +416,4 @@
   return dynamic_cast<T*>(object.data());
 }
 
-
 #endif
-// vim: ts=2 sw=2 et
--- branches/work/kst/1.6/kst/src/libkstapp/kstbasicdialog_i.cpp #745351:745352
@@ -300,7 +300,7 @@
     return false;
   }
 
-  ptr->setTagName(newTag);
+  ptr->setTagName(_tagName->text());
 
   ptr->inputVectors().clear();
   ptr->inputScalars().clear();
@@ -571,4 +571,3 @@
 }
 
 #include "kstbasicdialog_i.moc"
-
--- branches/work/kst/1.6/kst/src/libkstapp/kstplugindialog_i.cpp #745351:745352
@@ -612,7 +612,7 @@
     return false;
   }
 
-  pp->setTagName(KstObjectTag(_tagName->text(), KstObjectTag::globalTagContext));  // FIXME: tag context always global?
+  pp->setTagName(_tagName->text());
 
   int pitem = _w->PluginCombo->currentItem();
   KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]);
@@ -900,7 +900,4 @@
   }
 }
 
-
 #include "kstplugindialog_i.moc"
-
-// vim: ts=2 sw=2 et
--- branches/work/kst/1.6/kst/src/libkstapp/kstvvdialog_i.cpp #745351:745352
@@ -566,8 +566,11 @@
       _tagName->setFocus();
       return false;
     }
-    vp->setTagName(KstObjectTag(tag_name, vp->tag().context())); // FIXME: doesn't allow changing tag context
 
+    vp->writeLock();
+    vp->setTagName(tag_name);
+    vp->unlock();
+
     _xVectorDirty = true;
     _yVectorDirty = true;
     _interpTypeDirty = true;
--- branches/work/kst/1.6/kst/src/libkstmath/kstbasicplugin.cpp #745351:745352
@@ -83,6 +83,7 @@
   return KstDataObjectPtr(plugin);
 }
 
+
 void KstBasicPlugin::showNewDialog() {
   //FIXME shouldn't tagName() == propertyString() ??
   KstDialogs::self()->showBasicPluginDialog(propertyString());
@@ -257,7 +258,7 @@
     QDomElement e = n.toElement();
     if (!e.isNull()) {
       if (e.tagName() == "tag") {
-        setTagName(KstObjectTag::fromString(e.text()));
+        KstObject::setTagName(KstObjectTag::fromString(e.text()));
       } else if (e.tagName() == "ivector") {
         _inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
       } else if (e.tagName() == "iscalar") {
@@ -507,3 +508,28 @@
   return value;
 }
 
+
+void KstBasicPlugin::setTagName(const KstObjectTag& tag) {
+  KstObject::setTagName(tag);
+}
+
+
+void KstBasicPlugin::setTagName(const QString &in_tag) {
+  KstObjectTag newTag(in_tag, tag().context());
+
+  if (newTag == tag()) {
+    return;
+  }
+
+  KstObject::setTagName(newTag);
+
+  for (KstVectorMap::Iterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+  for (KstScalarMap::Iterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+  for (KstStringMap::Iterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+}
--- branches/work/kst/1.6/kst/src/libkstmath/kstbasicplugin.h #745351:745352
@@ -50,6 +50,9 @@
     //Provide an impl...
     virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap&);
 
+    virtual void setTagName(const QString& tag);
+    virtual void setTagName(const KstObjectTag& tag);
+
   public slots:
     //Pure virtual slots from KstDataObject
     //Each plugin can provide an implementation or use the default
@@ -105,5 +108,3 @@
 typedef KstObjectList<KstBasicPluginPtr> KstBasicPluginList;
 
 #endif
-
-// vim: ts=2 sw=2 et
--- branches/work/kst/1.6/kst/src/libkstmath/kstcplugin.cpp #745351:745352
@@ -1,5 +1,5 @@
 /***************************************************************************
-                                kstplugin.cpp
+                                kstcplugin.cpp
                              -------------------
     begin                : May 15 2003
     copyright            : (C) 2003 The University of Toronto
@@ -449,14 +449,14 @@
 
 QString KstCPlugin::label(int precision) const {
   QString label;
-  
+
   label = i18n("%1: %2").arg(plugin()->data()._readableName).arg(tagName());
   if ((outputVectors())["Parameters"]) {
     QString strParamName;
     QString strValue;
     int length = (outputVectors())["Parameters"]->length();
     int i = 0;
-    
+
     for (strParamName = plugin()->parameterName(0); 
         !strParamName.isEmpty() && i < length; 
         strParamName = plugin()->parameterName(++i)) {
@@ -720,7 +720,7 @@
   for (KstStringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) {
     plugin->inputStrings().insert(iter.key(), iter.data());  
   }
-  
+
   // create new outputs
   for (KstVectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
     KstWriteLocker blockVectorUpdates(&KST::vectorList.lock());
@@ -735,7 +735,7 @@
     KstStringPtr s = new KstString(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), plugin.data()); // FIXME: unique tag generation
     plugin->outputStrings().insert(iter.key(), s);
   }
-  
+
   // set the same plugin
   plugin->setPlugin(_plugin);
   plugin->setTagName(KstObjectTag(tag().tag() + "'", tag().context())); // FIXME: unique tag generation method
@@ -743,4 +743,28 @@
   return KstDataObjectPtr(plugin);
 }
 
-// vim: ts=2 sw=2 et
+
+void KstCPlugin::setTagName(const KstObjectTag& tag) {
+  KstObject::setTagName(tag);
+}
+
+
+void KstCPlugin::setTagName(const QString &in_tag) {
+  KstObjectTag newTag(in_tag, tag().context());
+
+  if (newTag == tag()) {
+    return;
+  }
+
+  KstObject::setTagName(newTag);
+
+  for (KstVectorMap::Iterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+  for (KstScalarMap::Iterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+  for (KstStringMap::Iterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
+    (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag()));
+  }
+}
--- branches/work/kst/1.6/kst/src/libkstmath/kstcplugin.h #745351:745352
@@ -1,5 +1,5 @@
 /***************************************************************************
-                                 kstplugin.h
+                                 kstcplugin.h
                              -------------------
     begin                : May 15 2003
     copyright            : (C) 2003 The University of Toronto
@@ -58,6 +58,9 @@
 
     virtual KstDataObjectPtr makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap);
 
+    virtual void setTagName(const QString& tag);
+    virtual void setTagName(const KstObjectTag& tag);
+
   protected:
     static void countScalarsAndVectors(const QValueList<Plugin::Data::IOValue>& table, unsigned& scalars, unsigned& vectors);
     virtual void showNewDialog();
@@ -84,5 +87,3 @@
 typedef KstObjectList<KstCPluginPtr> KstCPluginList;
 
 #endif
-
-// vim: ts=2 sw=2 et
--- branches/work/kst/1.6/kst/src/libkstmath/kstvectorview.cpp #745351:745352
@@ -61,6 +61,7 @@
   commonConstructor(in_tag);
 }
 
+
 KstVectorView::KstVectorView(const QDomElement &e)
 : KstDataObject(e) {
 
@@ -132,7 +133,7 @@
   _typeString = i18n("Vector View");
   _type = "VectorView";
 
-  setTagName(KstObjectTag::fromString(in_tag));
+  KstObject::setTagName(KstObjectTag::fromString(in_tag));
 
   KstVectorPtr v = new KstVector(KstObjectTag("X", tag()), 0, this);
   _cxVector = _outputVectors.insert(OUT_XVECTOR, v);
@@ -365,6 +366,7 @@
   return setLastUpdateResult(UPDATE);
 }
 
+
 void KstVectorView::setXminScalar(KstScalarPtr xmin) {
   if (xmin != _xmin) {
     if (_xmin != 0L) {
@@ -377,6 +379,7 @@
   }
 }
 
+
 void KstVectorView::setXmaxScalar(KstScalarPtr xmax) {
   if (xmax != _xmax) {
     if (_xmax != 0L) {
@@ -389,6 +392,7 @@
   }
 }
 
+
 void KstVectorView::setYminScalar(KstScalarPtr ymin) {
   if (ymin != _ymin) {
     if (_ymin != 0L) {
@@ -401,6 +405,7 @@
   }
 }
 
+
 void KstVectorView::setYmaxScalar(KstScalarPtr ymax) {
   if (ymax != _ymax) {
     if (_ymax != 0L) {
@@ -413,6 +418,7 @@
   }
 }
 
+
 void KstVectorView::setUseXmin(bool useXmin) {
   _useXmin = useXmin;
 
@@ -426,6 +432,7 @@
   }
 }
 
+
 void KstVectorView::setUseXmax(bool useXmax) {
   _useXmax = useXmax;
 
@@ -439,6 +446,7 @@
   }
 }
 
+
 void KstVectorView::setUseYmin(bool useYmin) {
   _useYmin = useYmin;
 
@@ -452,6 +460,7 @@
   }
 }
 
+
 void KstVectorView::setUseYmax(bool useYmax) {
   _useYmax = useYmax;
 
@@ -465,14 +474,17 @@
   }
 }
 
+
 void KstVectorView::setXVector(KstVectorPtr new_v) {
   _inputVectors[IN_XVECTOR] = new_v;
 }
 
+
 void KstVectorView::setYVector(KstVectorPtr new_v) {
   _inputVectors[IN_YVECTOR] = new_v;
 }
 
+
 void KstVectorView::setFlagVector(KstVectorPtr Flag) {
   if (Flag) {
     _inputVectors[IN_FLAGVECTOR] = Flag;
@@ -482,30 +494,37 @@
   setDirty();
 }
 
+
 bool KstVectorView::hasFlag() {
   return _inputVectors.contains(IN_FLAGVECTOR);
 }
 
+
 QString KstVectorView::xLabel() const {
   return _inputVectors[IN_XVECTOR]->label();
 }
 
+
 QString KstVectorView::yLabel() const {
   return _inputVectors[IN_YVECTOR]->label();
 }
 
+
 QString KstVectorView::in_xVTag() const {
   return _inputVectors[IN_XVECTOR]->tag().displayString();
 }
 
+
 QString KstVectorView::in_yVTag() const {
   return _inputVectors[IN_YVECTOR]->tag().displayString();
 }
 
+
 QString KstVectorView::FlagTag() const {
   return _inputVectors[IN_FLAGVECTOR]->tag().displayString();
 }
 
+
 void KstVectorView::save(QTextStream &ts, const QString& indent) {
   // FIXME: clean this up - all lower case nodes, maybe save points in the
   // point class itself, etc
@@ -544,10 +563,12 @@
   KstDialogs::self()->showVectorViewDialog(tagName(), true);
 }
 
+
 bool KstVectorView::slaveVectorsUsed() const {
   return true;
 }
 
+
 KstDataObjectPtr KstVectorView::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
   QString name(tagName() + '\'');
   while (KstData::self()->dataTagNameNotUnique(name, false)) {
@@ -558,17 +579,33 @@
   return KstDataObjectPtr(vectorview);
 }
 
+
 void KstVectorView::scalarChanged() {
     setDirty();
 }
 
+
 KstVectorView::InterpType KstVectorView::interp() const {
   return (_interp);
 }
 
+
 void KstVectorView::setInterp(KstVectorView::InterpType itype) {
   _interp = itype;
   setDirty();
 }
 
+
+void KstVectorView::setTagName(const QString &in_tag) {
+  KstObjectTag newTag(in_tag, tag().context());
+
+  if (newTag == tag()) {
+    return;
+  }
+
+  KstObject::setTagName(newTag);
+  (*_cxVector)->setTagName(KstObjectTag("X", tag()));
+  (*_cyVector)->setTagName(KstObjectTag("Y", tag()));
+}
+
 #include "kstvectorview.moc"
--- branches/work/kst/1.6/kst/src/libkstmath/kstvectorview.h #745351:745352
@@ -79,6 +79,8 @@
     virtual QString xLabel() const;
     virtual QString yLabel() const;
 
+    virtual void setTagName(const QString& tag);
+
     virtual void showNewDialog();
     virtual void showEditDialog();
 


More information about the Kst mailing list