[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Tue Jul 22 22:37:13 CEST 2003


CVS commit by staikos: 

add ability to create vector curves, and fix plot creation slightly (it's still
a bit broken in that the newly created plots seem to take over the screen until
the plotlist is manipulated again.  will track this down later.)


  M +3 -0      kstiface.h   1.6
  M +32 -4     kstiface_impl.cpp   1.6
  M +3 -0      kstiface_impl.h   1.6


--- kdeextragear-2/kst/kst/kstiface.h  #1.5:1.6
@@ -72,4 +72,7 @@ k_dcop:
   virtual bool addCurveToPlot(const QString& plot, const QString& curve) = 0;
   virtual bool removeCurveFromPlot(const QString& plot, const QString& curve) = 0;
+
+  virtual const QString& createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector, const QColor& color) = 0; 
+  virtual const QString& createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector) = 0; 
 };
 

--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.5:1.6
@@ -25,4 +25,5 @@
 #include "kstdatacollection.h"
 #include "kstcolorsequence.h"
+#include "kstvcurve.h"
 #include <assert.h>
 
@@ -329,11 +330,12 @@ return false;
 
 const QString& KstIfaceImpl::createPlot(const QString& name) {
-QString _n = name;
+QString n = name;
 
-  if (KST::plotList.FindKstPlot(_n)) {
-    _n = KST::plotList.generatePlotName();
+  if (KST::plotList.FindKstPlot(n)) {
+    n = KST::plotList.generatePlotName();
   }
 
-  KstPlot *p = new KstPlot(_n);
+  KstPlot *p = new KstPlot(n);
+  KST::plotList.append(p);
   _doc->update();
   _doc->setModified();
@@ -404,4 +406,30 @@ KstBaseCurveList::Iterator ci = bcl.find
 
 return false;
+}
+
+
+const QString& KstIfaceImpl::createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector) {
+  return createCurve(name, xVector, yVector, xErrorVector, yErrorVector, KstColorSequence::next());
+}
+
+
+const QString& KstIfaceImpl::createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector, const QColor& color) {
+QString n = name;
+KstVectorList::Iterator vx = KST::vectorList.findTag(xVector);
+KstVectorList::Iterator vy = KST::vectorList.findTag(yVector);
+KstVectorList::Iterator ex = KST::vectorList.findTag(xErrorVector);
+KstVectorList::Iterator ey = KST::vectorList.findTag(yErrorVector);
+
+  while (KST::dataObjectList.findTag(n) != KST::dataObjectList.end()) {
+    n += "'";
+  }
+
+  KstVCurvePtr c = new KstVCurve(n, *vx, *vy, *ex, *ey, color);
+  KST::dataObjectList.append(KstDataObjectPtr(c));
+  _doc->update();
+  _doc->setModified();
+  _doc->updateDialogs();
+
+return c->tagName();
 }
 

--- kdeextragear-2/kst/kst/kstiface_impl.h  #1.5:1.6
@@ -68,4 +68,7 @@ public:
   virtual bool removeCurveFromPlot(const QString& plot, const QString& curve);
 
+  virtual const QString& createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector);
+  virtual const QString& createCurve(const QString& name, const QString& xVector, const QString& yVector, const QString& xErrorVector, const QString& yErrorVector, const QColor& color);
+
 private:
   KstDoc *_doc;




More information about the Kst mailing list