[Kst] extragear/graphics/kst/kst

George Staikos staikos at kde.org
Thu Oct 6 15:50:41 CEST 2005


SVN commit 467809 by staikos:

fix up header file mess: kstdatasource was dependent on almost everything in
Kst!


 M  +7 -1      kst.cpp  
 M  +7 -5      kst.h  
 M  +1 -0      kstdatacollection-gui.cpp  
 M  +5 -5      kstdoc.cpp  
 M  +1 -0      ksteventmonitorentry.h  
 M  +5 -3      kstviewobject.cpp  


--- trunk/extragear/graphics/kst/kst/kst.cpp #467808:467809
@@ -46,6 +46,7 @@
 #include "extensiondlg.h"
 #include "extensionmgr.h"
 #include "kst.h"
+#include "kst2dplot.h"
 #include "kstchangefiledialog_i.h"
 #include "kstchangenptsdialog_i.h"
 #include "kstchoosecolordialog_i.h"
@@ -59,6 +60,7 @@
 #include "ksteqdialog_i.h"
 #include "kstevents.h"
 #include "ksteventmonitor_i.h"
+#include "ksteventmonitorentry.h"
 #include "kstfitdialog_i.h"
 #include "kstfilterdialog_i.h"
 #include "kstgraphfiledialog_i.h"
@@ -117,6 +119,7 @@
   assert(!::inst);
   ::inst = this;
 
+  _plotHolderWhileOpeningDocument = new Kst2DPlotMap;
   KGlobal::dirs()->addResourceType("kst", KStandardDirs::kde_default("data") + "kst");
 
   _dataSourceConfig = kConfigObject;
@@ -251,6 +254,9 @@
 
 
 KstApp::~KstApp() {
+  delete _plotHolderWhileOpeningDocument;
+  _plotHolderWhileOpeningDocument = 0L;
+
   if (_updateThread) {
     _updateThread->setFinished(true);
     if (!_updateThread->wait(3000)) { // 3s
@@ -2367,7 +2373,7 @@
 }
 
 
-Kst2DPlotMap& KstApp::plotHolderWhileOpeningDocument() {
+Kst2DPlotMap* KstApp::plotHolderWhileOpeningDocument() {
   return _plotHolderWhileOpeningDocument;
 }
 
--- trunk/extragear/graphics/kst/kst/kst.h #467808:467809
@@ -23,15 +23,14 @@
 
 // include files for Qt
 #include <qguardedptr.h>
+#include <qtimer.h>
 
 // include files for KDE
 #include <kmdimainfrm.h>
 
 // application specific includes
-#include "kst2dplot.h"
-#include "ksteventmonitorentry.h"
 #include "kst_export.h"
-//#include "statuslabel.h"
+#include "ksttoplevelview.h"
 
 enum LegendType { LegendOn, LegendOff, LegendAuto };
 enum DataType { DataOnly, DataPSD, PSDOnly };
@@ -40,6 +39,8 @@
 
 // forward declaration of the Kst classes
 class GraphicEditorI;
+class Kst2DPlot;
+typedef KstObjectMap<KstSharedPtr<Kst2DPlot> > Kst2DPlotMap;
 class KstChangeFileDialogI;
 class KstChangeNptsDialogI;
 class KstChooseColorDialogI;
@@ -49,6 +50,7 @@
 class KstDebugNotifier;
 class KstDoc;
 class KstEventMonitorI;
+class KstEventMonitorEntry;
 class KstGraphFileDialogI;
 class KstIfaceImpl;
 class KstMonochromeDialogI;
@@ -131,7 +133,7 @@
     KstTopLevelView::ViewMode currentViewMode();
     
     KstTopLevelViewPtr activeView();
-    Kst2DPlotMap& plotHolderWhileOpeningDocument();
+    Kst2DPlotMap* plotHolderWhileOpeningDocument();
 
     QString windowName(bool prompt, const QString& nameOriginal, bool rename = false, QWidget *parent = 0L);
     QString newWindow(const QString& name);
@@ -541,7 +543,7 @@
     bool _stopping;
     KstIfaceImpl *_dcopIface;
     UpdateThread *_updateThread;
-    Kst2DPlotMap _plotHolderWhileOpeningDocument;
+    Kst2DPlotMap *_plotHolderWhileOpeningDocument;
     QTimer _memTimer;
     QString _defaultFont;
     KConfig *_dataSourceConfig;
--- trunk/extragear/graphics/kst/kst/kstdatacollection-gui.cpp #467808:467809
@@ -27,6 +27,7 @@
 
 // application specific includes
 #include "kst.h"
+#include "kst2dplot.h"
 #include "kstdatacollection.h"
 
 bool KST::dataTagNameNotUnique(const QString &tag, bool warn, void *p) {
--- trunk/extragear/graphics/kst/kst/kstdoc.cpp #467808:467809
@@ -374,7 +374,7 @@
       } else if (e.tagName() == "plot") {
         KstBaseCurveList l = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
         Kst2DPlotPtr plot = new Kst2DPlot(e);
-        app->plotHolderWhileOpeningDocument().insert(plot->tagName(), plot);
+        app->plotHolderWhileOpeningDocument()->insert(plot->tagName(), plot);
       } else if (e.tagName() == "amatrix") {
         KstAMatrixPtr p = new KstAMatrix(e);
         KST::addMatrixToList(KstMatrixPtr(p));
@@ -426,7 +426,7 @@
   // if we have anything left in plotHolderWhileOpeningDocument then
   //  we are most likely reading an old style document, so we create
   //  a default view and fill it with whatever is left...
-  if (!app->plotHolderWhileOpeningDocument().isEmpty() && !app->activeWindow()) {
+  if (!app->plotHolderWhileOpeningDocument()->isEmpty() && !app->activeWindow()) {
 
     QString winName = app->newWindow(QString::null);
     KstViewWindow *win = dynamic_cast<KstViewWindow*>(app->findWindow(winName));
@@ -437,8 +437,8 @@
         win->view()->setColumns(columns);
       }
 
-      for (Kst2DPlotMap::Iterator it = app->plotHolderWhileOpeningDocument().begin();
-          it != app->plotHolderWhileOpeningDocument().end(); ++it ) {
+      for (Kst2DPlotMap::Iterator it = app->plotHolderWhileOpeningDocument()->begin();
+          it != app->plotHolderWhileOpeningDocument()->end(); ++it ) {
         Kst2DPlotPtr plot = *it;
 
         if (plot->_width > 0.0 && plot->_height > 0.0 ) {
@@ -457,7 +457,7 @@
     }
   }
 
-  app->plotHolderWhileOpeningDocument().clear();
+  app->plotHolderWhileOpeningDocument()->clear();
 
   app->slotUpdateProgress(0, 0, i18n("Loading data"));
 
--- trunk/extragear/graphics/kst/kst/ksteventmonitorentry.h #467808:467809
@@ -20,6 +20,7 @@
 
 #include <qtimer.h>
 
+#include "kstdataobject.h"
 #include "kstdebug.h"
 
 namespace Equation {
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #467808:467809
@@ -164,12 +164,14 @@
           }
           plotNode = plotNode.nextSibling();      
         }
-        if (KstApp::inst()->plotHolderWhileOpeningDocument().count(in_tag) > 0) {
-          Kst2DPlotPtr plot = KstApp::inst()->plotHolderWhileOpeningDocument()[in_tag];
+        // FIXME: View Object should not know about this!!!!
+        Kst2DPlotMap *pmap = KstApp::inst()->plotHolderWhileOpeningDocument();
+        if (pmap->count(in_tag) > 0) {
+          Kst2DPlotPtr plot = pmap->at(in_tag);
           if (plot) {
             appendChild(plot.data(), true);
             plot->loadChildren(el);
-            KstApp::inst()->plotHolderWhileOpeningDocument().erase(in_tag);
+            pmap->erase(in_tag);
           }
         }
       } else if (el.tagName() == "plotgroup") {


More information about the Kst mailing list