[Kst] branches/work/kst/viewupdates/kst/src/libkstapp

George Staikos staikos at kde.org
Mon May 29 08:16:31 CEST 2006


SVN commit 546097 by staikos:

update all objects, use the update counter, and adjust 2dplot for the thread
separation of update of view objects vs data objects


 M  +0 -6      kst2dplot.cpp  
 M  +5 -1      kstdoc.cpp  
 M  +2 -1      threadevents.h  
 M  +1 -0      updatethread.cpp  


--- branches/work/kst/viewupdates/kst/src/libkstapp/kst2dplot.cpp #546096:546097
@@ -2633,12 +2633,6 @@
   // TODO: check labels too
 
   bool updated = false;
-  for (KstBaseCurveList::Iterator i = Curves.begin(); i != Curves.end(); ++i) {
-    (*i)->writeLock();
-    updated = (UPDATE == (*i)->update(update_counter)) || updated;
-    (*i)->writeUnlock();
-  }
-
   update_state = updateChildren(update_counter);
 
   updated = (UPDATE == KstPlotBase::update(update_counter)) || updated;
--- branches/work/kst/viewupdates/kst/src/libkstapp/kstdoc.cpp #546096:546097
@@ -1070,7 +1070,7 @@
               Kst2DPlotList pl = view->view()->findChildrenType<Kst2DPlot>(true);
               for (Kst2DPlotList::Iterator i = pl.begin(); i != pl.end(); ++i) {
                 for (QValueList<KstBaseCurve*>::ConstIterator j = te->_curves.begin(); j != te->_curves.end(); ++j) {
-                  // race: if ((*i)->Curves.contains(*j)) {
+                  // race: if ((*i)->Curves.contains(*j)) 
                   const KstBaseCurveList& cl = (*i)->Curves;
                   bool doBreak = false;
                   for (KstBaseCurveList::ConstIterator k = cl.begin(); k != cl.end(); ++k) {
@@ -1085,10 +1085,14 @@
                   }
                 }
 
+#if 0
                 KstViewLabelList vl = view->view()->findChildrenType<KstViewLabel>(true);
                 for (KstViewLabelList::Iterator i = vl.begin(); i != vl.end(); ++i) {
                   (*i)->update(-1);
                 }
+#else
+                view->view()->recursively<int, KstViewObject>((void (KstViewObject::*)(int))&KstViewObject::update, te->_counter);
+#endif
               }
               it->next();
             }
--- branches/work/kst/viewupdates/kst/src/libkstapp/threadevents.h #546096:546097
@@ -24,11 +24,12 @@
   public:
     enum ThreadEventType { Unknown = 0, UpdateDataDialogs, UpdateAllDialogs, Repaint, Done, NoUpdate };
 
-    ThreadEvent(ThreadEventType et) : QEvent(QEvent::Type(KstEventTypeThread)), _eventType(et) {}
+    ThreadEvent(ThreadEventType et) : QEvent(QEvent::Type(KstEventTypeThread)), _eventType(et), _counter(-1) {}
     virtual ~ThreadEvent() {}
 
     ThreadEventType _eventType;
     QValueList<KstBaseCurve*> _curves; // HACK: for temporary use in update reworking
+    int _counter;
 };
 
 
--- branches/work/kst/viewupdates/kst/src/libkstapp/updatethread.cpp #546096:546097
@@ -89,6 +89,7 @@
         kstdDebug() << "Posting UpdateDataDialogs" << endl;
         ThreadEvent *e = new ThreadEvent(ThreadEvent::UpdateDataDialogs);
         e->_curves = _updatedCurves;
+        e->_counter = _updateCounter;
         QApplication::postEvent(_doc, e);
         // this event also triggers an implicit repaint
       } else {


More information about the Kst mailing list