[Kst] kdeextragear-2/kst/kst

Rick Chern rchern at interchange.ubc.ca
Fri Aug 27 22:42:46 CEST 2004


CVS commit by rchern: 

When right-click->remove from Plot or right-click->add To Plot in data manager, repaint the plot


  M +3 -0      kst.cpp   1.225
  M +29 -2     kstdatamanager_i.cpp   1.79
  M +3 -0      kstdatamanager_i.h   1.25


--- kdeextragear-2/kst/kst/kst.cpp  #1.224:1.225
@@ -147,4 +147,7 @@ KstApp::KstApp(QWidget *parent, const ch
   connect(_plotDialog, SIGNAL(docChanged()), this, SLOT(registerDocChange()));
 
+  //data manager signals
+  connect(dataManager, SIGNAL(docChanged()), this, SLOT(registerDocChange()));
+
   /*** ***/
   connect(doc, SIGNAL(updateDialogs()), this, SLOT(updateDialogs()));

--- kdeextragear-2/kst/kst/kstdatamanager_i.cpp  #1.78:1.79
@@ -233,4 +233,6 @@ void KstObjectItem::addToPlot(int id) {
   if (p && c) {
     p->addCurve(c);
+    p->setDirty();
+    paintPlot(p);
     emit updated();
   }
@@ -242,4 +244,6 @@ void KstObjectItem::removeFromPlot(int i
   if (p && c) {
     p->removeCurve(c);
+    p->setDirty();
+    paintPlot(p);
     emit updated();
   }
@@ -251,4 +255,6 @@ void KstObjectItem::addImageToPlot(int i
   if (p && img) {
     p->addImage(img);
+    p->setDirty();
+    paintPlot(p);
     emit updated();
   }
@@ -260,8 +266,28 @@ void KstObjectItem::removeImageFromPlot(
   if (p && img) {
     p->removeImage(img);
+    p->setDirty();
+    paintPlot(p);
     emit updated();
   }
 }
 
+void KstObjectItem::paintPlot(Kst2DPlotPtr p) {
+  //Kst only allows unique plot names
+  KstViewObjectPtr rc;
+  KstApp *app = KstApp::inst();
+  KMdiIterator<KMdiChildView*> *it = app->createIterator();
+  while (it->currentItem()) {
+    KstViewWindow *v = dynamic_cast<KstViewWindow*>(it->currentItem());
+    if (v) {
+      rc = v->view()->findChild(p->tagName());
+      if (rc) {
+        v->view()->paint(P_PLOT);
+        break;
+      }
+    }
+    it->next();
+  }
+  app->deleteIterator(it);
+}
 
 KstDataManagerI::KstDataManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl)
@@ -598,6 +624,7 @@ void KstDataManagerI::contextMenu(QListV
 
 void KstDataManagerI::doUpdates() {
-  doc->forceUpdate();
-  doc->setModified();
+//  doc->forceUpdate();
+//  doc->setModified();
+  emit docChanged();
 }
 

--- kdeextragear-2/kst/kst/kstdatamanager_i.h  #1.24:1.25
@@ -49,4 +50,5 @@ private:
 signals:
   void editDataVector(const QString &);
+  void docChanged();
 };
 
@@ -86,4 +88,5 @@ class KstObjectItem : public QObject, pu
     KstDataManagerI *_dm;
     bool             _removable;
+    void paintPlot(Kst2DPlotPtr p); //used by add to/remove from plot slots
 };
 





More information about the Kst mailing list