[Kst] extragear/graphics/kst/kst
Rick Chern
rchern at interchange.ubc.ca
Tue Jul 19 22:29:17 CEST 2005
SVN commit 436470 by rchern:
Hacks within hacks to get plots with only images to update for now
CCMAIL: 109148 at bugs.kde.org
M +17 -0 kstdoc.cpp
M +1 -0 threadevents.h
M +48 -1 updatethread.cpp
M +2 -0 updatethread.h
--- trunk/extragear/graphics/kst/kst/kstdoc.cpp #436469:436470
@@ -932,6 +932,23 @@
break;
}
}
+ // HACK: hack within hack to update plots with only images
+ if (!(*i)->dirty()) {
+ for (QValueList<KstImage*>::ConstIterator j = te->_images.begin(); j != te->_images.end(); ++j) {
+ const KstImageList& il = (*i)->_images;
+ bool doBreak = false;
+ for (KstImageList::ConstIterator k = il.begin(); k != il.end(); ++k) {
+ if (*j == *k) {
+ (*i)->setDirty();
+ doBreak = true;
+ break;
+ }
+ }
+ if (doBreak) {
+ break;
+ }
+ }
+ }
}
it->next();
}
--- trunk/extragear/graphics/kst/kst/threadevents.h #436469:436470
@@ -29,6 +29,7 @@
ThreadEventType _eventType;
QValueList<KstBaseCurve*> _curves; // HACK: for temporary use in update reworking
+ QValueList<KstImage*> _images; //HACK: hack too
};
--- trunk/extragear/graphics/kst/kst/updatethread.cpp #436469:436470
@@ -23,6 +23,7 @@
#include "kstdatacollection.h"
#include "kstdoc.h"
+#include "kstimage.h"
#include "kstrvector.h"
#include "kstvcurve.h"
#include "threadevents.h"
@@ -88,6 +89,7 @@
kdDebug() << "Posting UpdateDataDialogs" << endl;
ThreadEvent *e = new ThreadEvent(ThreadEvent::UpdateDataDialogs);
e->_curves = _updatedCurves;
+ e->_images = _updatedImages;
QApplication::postEvent(_doc, e);
// this event also triggers an implicit repaint
} else {
@@ -129,6 +131,7 @@
KstObject::UpdateType U = KstObject::NO_CHANGE;
_updatedCurves.clear(); // HACK
+ _updatedImages.clear(); // HACK
if (gotData) {
*gotData = false;
@@ -153,8 +156,19 @@
// Must make a copy to avoid deadlock
KstBaseCurveList cl;
KstDataObjectList dol;
+ KstImageList il;
kstObjectSplitList<KstDataObject, KstBaseCurve>(KST::dataObjectList, cl, dol);
-
+ il = kstObjectSubList<KstDataObject,KstImage>(dol);
+ // testing
+// printf("dol has: \n");
+// for (KstDataObjectList::ConstIterator i = dol.begin(); i != dol.end(); ++i) {
+// printf("%s\n", (*i)->tagName().latin1());
+// }
+// printf("il has: \n");
+// for (KstImageList::ConstIterator i = il.begin(); i != il.end(); ++i) {
+// printf("%s\n", (*i)->tagName().latin1());
+// }
+
// Update all curves
for (uint i = 0; i < cl.count(); ++i) {
KstBaseCurvePtr bcp = cl[i];
@@ -186,7 +200,40 @@
return U == KstObject::UPDATE;
}
}
+
+ // update all images too
+ for (uint i = 0; i < il.count(); ++i) {
+ KstImagePtr ip = il[i];
+ assert(ip.data());
+#if UPDATEDEBUG > 1
+ kdDebug() << "updating image: " << (void*)ip << " - " << ip->tagName() << endl;
+#endif
+ ip->writeLock();
+ KstObject::UpdateType ut = ip->update(_updateCounter);
+ ip->writeUnlock();
+ if (ut == KstObject::UPDATE) { // HACK
+ _updatedImages.append(ip);
+ }
+
+ if (U != KstObject::UPDATE) {
+ U = ut;
+ if (U == KstObject::UPDATE) {
+#if UPDATEDEBUG > 0
+ kdDebug() << "Image " << ip->tagName() << " said UPDATE" << endl;
+#endif
+ }
+ }
+
+ if (_done || (_paused && !force)) {
+#if UPDATEDEBUG > 1
+ kdDebug() << "5 Returning from scan with U=" << (int)U << endl;
+#endif
+ return U == KstObject::UPDATE;
+ }
+ }
+
+
// Update all data objects
for (uint i = 0; i < dol.count(); ++i) {
KstDataObjectPtr dp = dol[i];
--- trunk/extragear/graphics/kst/kst/updatethread.h #436469:436470
@@ -25,6 +25,7 @@
#include "kstwaitcondition.h"
class KstBaseCurve;
+class KstImage;
class KstDoc;
class UpdateThread : public QThread {
@@ -52,6 +53,7 @@
int _updateCounter;
int _updateTime;
QValueList<KstBaseCurve*> _updatedCurves; // HACK: temporary use in update reworking
+ QValueList<KstImage*> _updatedImages; // HACK: hack too
};
More information about the Kst
mailing list