[Kst] kdeextragear-2/kst/kst

Rick Chern rchern at interchange.ubc.ca
Thu Jul 8 20:43:05 CEST 2004


CVS commit by rchern: 

Alter some old DCOP functions so kst now passes test1.sh and test_equations.sh completely.


  M +3 -1      kstiface.h   1.21
  M +32 -17    kstiface_impl.cpp   1.37
  M +3 -1      kstiface_impl.h   1.21


--- kdeextragear-2/kst/kst/kstiface.h  #1.20:1.21
@@ -81,6 +81,8 @@ k_dcop:
   virtual QString createPlot(const QString& window, const QString& name) = 0;
   virtual QString createPlot(const QString& name) = 0;
-  virtual bool deletePlot(const QString& name) = 0;
+
   virtual bool deletePlot(const QString& window, const QString& name) = 0;
+  virtual bool deletePlot(const QString& name) = 0;
+
   virtual QStringList plotContents(const QString& name) = 0;
   virtual bool addCurveToPlot(const QString& window, const QString& plot, const QString& curve) = 0;

--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.36:1.37
@@ -588,9 +588,11 @@ QString KstIfaceImpl::createWindow(const
 QString KstIfaceImpl::createPlot(const QString& name) {
   QString window = activeWindow();
-  if (!window.isEmpty()) {
-     return createPlot(window, name);
+
+  //if no window exists, create one
+  if (window.isEmpty()) {
+    window = KstApp::inst()->newWindow(false);
   }
 
-  return QString::null;
+  return createPlot(window, name);
 }
 
@@ -612,5 +614,14 @@ QString KstIfaceImpl::createPlot(const Q
 
       if (plots.findTag(name) != plots.end()) {
-        plotName = KST::suggestPlotName();
+        //suggestPlotName does not check existing plot names
+        //plotName = KST::suggestPlotName();
+        int i = plots.count() + 1;
+        QString stringnum;
+        stringnum = stringnum.setNum(i);
+        plotName = "P" + stringnum;
+        while (plots.findTag(plotName) != plots.end()) {
+          stringnum = stringnum.setNum(++i);
+          plotName = "P" + stringnum;
+        }
       } else {
         plotName = name;
@@ -1165,8 +1176,9 @@ QString KstIfaceImpl::createHistogram(co
   stringnum = stringnum.setNum(i);
 
-  QString htag ="C" + stringnum + "-HS_" + htag_end;
+  QString htag = "C" + stringnum + "-HS_" + htag_end;
 
   while (KST::dataTagNameNotUnique(htag, false)) {
-    htag += '\'';
+    stringnum.setNum(++i);
+    htag = "C" + stringnum + "-HS_" + htag_end;
   }
 
@@ -1215,8 +1227,9 @@ QString KstIfaceImpl::createPowerSpectru
   stringnum = stringnum.setNum(i);
 
-  QString pstag ="C" + stringnum + "-PSD_" + pstag_end;
+  QString pstag = "C" + stringnum + "-PSD_" + pstag_end;
 
   while (KST::dataTagNameNotUnique(pstag, false)) {
-    pstag += '\'';
+    stringnum.setNum(++i);
+    pstag = "C" + stringnum + "-PSD_" + pstag_end;
   }
 
@@ -1254,8 +1267,9 @@ QString KstIfaceImpl::createEvent(const 
   stringnum = stringnum.setNum(i);
 
-  QString evtag ="E" + stringnum + "-" + evtag_end;
+  QString evtag = "E" + stringnum + "-" + evtag_end;
 
   while (KST::dataTagNameNotUnique(evtag, false)) {
-    evtag += '\'';
+    stringnum.setNum(++i);
+    evtag = "E" + stringnum + "-" + evtag_end;
   }
 
@@ -1386,8 +1400,9 @@ QStringList KstIfaceImpl::createPlugin(c
   stringnum = stringnum.setNum(i);
 
-  QString plugtag ="P" + stringnum + "-" + pluginName;
+  QString plugtag = "P" + stringnum + "-" + pluginName;
 
   while (KST::dataTagNameNotUnique(plugtag, false)) {
-    plugtag += '\'';
+    stringnum.setNum(++i);
+    plugtag = "P" + stringnum + "-" + pluginName;
   }
   kstplug_ptr->setTagName(plugtag);

--- kdeextragear-2/kst/kst/kstiface_impl.h  #1.20:1.21
@@ -74,6 +74,8 @@ public:
   virtual QString createPlot(const QString& window, const QString& name);
   virtual QString createPlot(const QString& name);
-  virtual bool deletePlot(const QString& name);
+
   virtual bool deletePlot(const QString& window, const QString& name);
+  virtual bool deletePlot(const QString& name);
+
   virtual QStringList plotContents(const QString& name);
   bool addCurveToPlot(KMdiChildView *win, const QString& plot, const QString& curve);





More information about the Kst mailing list