[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Jun 15 21:07:54 CEST 2004


CVS commit by arwalker: 

More DCOP interface functionality.


  M +1 -0      kst.h   1.73
  M +1 -0      kstiface.h   1.16
  M +40 -12    kstiface_impl.cpp   1.29
  M +1 -0      kstiface_impl.h   1.16


--- kdeextragear-2/kst/kst/kst.h  #1.72:1.73
@@ -30,4 +30,5 @@
 #include <kaccel.h>
 #include <kaction.h>
+#include <kmdimainfrm.h>
 
 // application specific includes

--- kdeextragear-2/kst/kst/kstiface.h  #1.15:1.16
@@ -79,4 +79,5 @@ k_dcop:
 
   virtual const QString& createWindow(const QString& name) = 0;
+  virtual const QString& createPlot(const QString& window, const QString& name) = 0;
   virtual const QString& createPlot(const QString& name) = 0;
   virtual bool deletePlot(const QString& name) = 0;

--- kdeextragear-2/kst/kst/kstiface_impl.cpp  #1.28:1.29
@@ -532,20 +532,48 @@ const QString& KstIfaceImpl::createWindo
 
 const QString& KstIfaceImpl::createPlot(const QString& name) {
-#if 0
-FIXMEPLOTLIST
-  QString n = name;
+  QString window;
+  QString newName;
 
-  if (KST::plotList.FindKstPlot(n)) {
-    n = KST::plotList.generatePlotName();
+  window = activeWindow();
+  if (!window.isEmpty()) {
+     newName = createPlot( window, name );
   }
 
-  KstPlot *p = new KstPlot(n);
-  KST::plotList.append(p);
+  return newName;
+}
+
+
+const QString& KstIfaceImpl::createPlot(const QString& window, const QString& name) {
+  KMdiChildView*    pWindow;
+  KstViewWindow*    pView;
+  KstTopLevelView*  pTLV;
+  KstApp*           pApp = KstApp::inst();
+  Kst2DPlotPtr      p;
+  QString           plotName;
+  
+  pWindow = pApp->findWindow( window );
+  if (pWindow) {
+    pView = dynamic_cast<KstViewWindow*>(pWindow);
+    if (pView) {
+      pTLV = pView->view();
+      if (pTLV) {
+        Kst2DPlotList plots = pTLV->findChildrenType<Kst2DPlot>(true);
+
+        if (plots.findTag(name) != plots.end()) {
+          plotName = KST::suggestPlotName();
+        } else {
+          plotName = name;
+        }
+
+        p = pTLV->createPlot<Kst2DPlot>(plotName);
+        plotName = p->tagName();
+        
   _doc->forceUpdate();
   _doc->setModified();
-  KST::plotList.arrangePlots(KST::plotList.getPlotCols());
+      }
+    }
+  }
 
-  return p->tagName();
-#endif
+  return plotName;
 }
 

--- kdeextragear-2/kst/kst/kstiface_impl.h  #1.15:1.16
@@ -72,4 +72,5 @@ public:
 
   virtual const QString& createWindow(const QString& name);
+  virtual const QString& createPlot(const QString& window, const QString& name);
   virtual const QString& createPlot(const QString& name);
   virtual bool deletePlot(const QString& name);





More information about the Kst mailing list