[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Wed Jun 9 22:05:07 CEST 2004
CVS commit by arwalker:
Made deletePlot( ) functional.
Sorry, I just noticed that George is down for DCOP so I'll hold off on any more changes here.
M +1 -0 kstiface.h 1.13
M +46 -11 kstiface_impl.cpp 1.25
M +1 -0 kstiface_impl.h 1.13
--- kdeextragear-2/kst/kst/kstiface.h #1.12:1.13
@@ -78,4 +78,5 @@ k_dcop:
virtual const QString& createPlot(const QString& name) = 0;
virtual bool deletePlot(const QString& name) = 0;
+ virtual bool deletePlot(const QString& window, const QString& name) = 0;
virtual QStringList plotContents(const QString& name) = 0;
virtual bool addCurveToPlot(const QString& plot, const QString& curve) = 0;
--- kdeextragear-2/kst/kst/kstiface_impl.cpp #1.24:1.25
@@ -247,4 +247,5 @@ FIXMEPLOTLIST
return true;
#endif
+ return false;
}
@@ -547,18 +548,52 @@ FIXMEPLOTLIST
bool KstIfaceImpl::deletePlot(const QString& name) {
-#if 0
-FIXMEPLOTLIST
- KstPlot *p = KST::plotList.FindKstPlot(name);
+ QString window;
+ bool bRetVal = false;
+
+ window = activeWindow();
+ if (!window.isEmpty()) {
+ bRetVal = deletePlot( window, name );
+ }
+
+ return bRetVal;
+}
+
+
+bool KstIfaceImpl::deletePlot(const QString& window, const QString& name) {
+ KMdiChildView* pWindow;
+ KstViewWindow* pView;
+ KstTopLevelView* pTLV;
+ KstApp* pApp = KstApp::inst();
+ bool bRetVal = false;
+
+ pWindow = pApp->findWindow( window );
+ if (pWindow) {
+ pView = dynamic_cast<KstViewWindow*>(pWindow);
+ if (pView) {
+ pTLV = pView->view();
+ if (pTLV) {
+ KstViewObjectList::Iterator it;
+ KstViewObjectList objects = pTLV->findChildrenType<KstViewObject>(true);
+
+ for (it = objects.begin(); it != objects.end(); ++it) {
+ KstViewObjectPtr object = dynamic_cast<KstViewObject*>((*it).data());
+ if (object) {
+ if (object->tagName() == name) {
+ pTLV->removeChild(object, true );
- if (p) {
- KST::plotList.remove(p);
- //delete p; autodeletes
_doc->forceUpdate();
_doc->setModified();
- return true;
+
+ bRetVal = true;
+
+ break;
+ }
+ }
+ }
+ }
+ }
}
- return false;
-#endif
+ return bRetVal;
}
--- kdeextragear-2/kst/kst/kstiface_impl.h #1.12:1.13
@@ -72,4 +72,5 @@ public:
virtual const QString& createPlot(const QString& name);
virtual bool deletePlot(const QString& name);
+ virtual bool deletePlot(const QString& window, const QString& name);
virtual QStringList plotContents(const QString& name);
virtual bool addCurveToPlot(const QString& plot, const QString& curve);
More information about the Kst
mailing list