[Kst] branches/work/kst/portto4/kst/src
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Oct 9 18:43:10 UTC 2012
SVN commit 1319894 by netterfield:
BUG:
Fix purge so ancestors of ancestors of curves used in plots don't get
purged, and so that scalars used in labels (and their ancestors) don't
get purged.
M +1 -1 datasources/ascii/asciisource.cpp
M +1 -0 libkst/matrix.cpp
M +1 -1 libkst/matrix.h
M +1 -2 libkst/object.h
M +6 -0 libkst/primitive.cpp
M +1 -0 libkst/primitive.h
M +9 -16 libkstapp/datamanager.cpp
M +2 -1 libkstapp/labelitem.h
M +1 -0 libkstapp/labelrenderer.h
M +3 -3 libkstapp/viewitem.h
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1319893:1319894
@@ -190,10 +190,10 @@
//-------------------------------------------------------------------------------------------
AsciiSource::AsciiSource(Kst::ObjectStore *store, QSettings *cfg, const QString& filename, const QString& type, const QDomElement& e) :
Kst::DataSource(store, cfg, filename, type),
+ _rowIndex(),
_fileBuffer(new FileBuffer),
_bufferedS(-10),
_bufferedN(-10),
- _rowIndex(),
is(new DataInterfaceAsciiString(*this)),
iv(new DataInterfaceAsciiVector(*this))
{
--- branches/work/kst/portto4/kst/src/libkst/matrix.cpp #1319893:1319894
@@ -509,6 +509,7 @@
// Resize the matrix to xSize x ySize, maintaining the values in the current
// positions. If reinit is set, new entries will be initialized to 0.
+// Otherwise, they will not be set. The behavior in that case is undefined.
bool Matrix::resize(int xSize, int ySize, bool reinit) {
if (xSize <= 0 || ySize <= 0) {
return false;
--- branches/work/kst/portto4/kst/src/libkst/matrix.h #1319893:1319894
@@ -67,7 +67,7 @@
// set the value of the specified rectangle
// return false if the rectangle does not exist
- bool setValueRaw(int x, int y, double z);
+ virtual bool setValueRaw(int x, int y, double z);
// return some stats on the z values
double minValue() const;
--- branches/work/kst/portto4/kst/src/libkst/object.h #1319893:1319894
@@ -73,7 +73,7 @@
virtual void internalUpdate() = 0;
virtual bool used() const {return _used;}
- void setUsed(bool used_in) {_used = used_in;}
+ virtual void setUsed(bool used_in) {_used = used_in;}
virtual bool uses(ObjectPtr p) const;
@@ -89,7 +89,6 @@
qint64 _serial;
qint64 _serialOfLastChange;
- private:
bool _used;
signals:
void dirty();
--- branches/work/kst/portto4/kst/src/libkst/primitive.cpp #1319893:1319894
@@ -95,6 +95,12 @@
}
}
+void Primitive::setUsed(bool used_in) {
+ _used = used_in;
+ if (_used && provider()) {
+ provider()->setUsed(true);
+ }
+}
void Primitive::fatalError(const QString& msg)
{
--- branches/work/kst/portto4/kst/src/libkst/primitive.h #1319893:1319894
@@ -52,6 +52,7 @@
virtual QString sizeString() const;
virtual bool used() const;
+ virtual void setUsed(bool used_in);
virtual ObjectList<Primitive> outputPrimitives() const = 0;
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #1319893:1319894
@@ -20,6 +20,7 @@
#include "sessionmodel.h"
#include "datacollection.h"
#include "plotitem.h"
+#include "labelitem.h"
#include "objectstore.h"
#include "dataobject.h"
@@ -420,6 +421,13 @@
}
// TODO: for each primitive used in an unhidden label mark 'used' - O(N)
+ QList<LabelItem*> labels = ViewItem::getItems<LabelItem>();
+ foreach (LabelItem * label, labels) {
+ foreach (Primitive* primitive, label->_labelRc->_refObjects) {
+ primitive->setUsed(true);
+ }
+ //qDebug() << "label " << label->Name() << "dependencies: " << label->_labelRc->_refObjects.size();
+ }
// for each primitive used by a relation mark 'used' - O(N)
ObjectList<Relation> relationList = _doc->objectStore()->getObjects<Relation>();
@@ -428,43 +436,32 @@
//set used all input and output primitives
foreach (VectorPtr v, object->inputVectors()) {
v->setUsed(true);
- if (v->provider()) {
- v->provider()->setUsed(true);
}
- }
foreach (VectorPtr v, object->outputVectors()) {
v->setUsed(true);
}
foreach (ScalarPtr s, object->inputScalars()) {
s->setUsed(true);
- if (s->provider()) {
- s->provider()->setUsed(true);
}
- }
foreach (ScalarPtr s, object->outputScalars()) {
s->setUsed(true);
}
foreach (StringPtr s, object->inputStrings()) {
s->setUsed(true);
- if (s->provider()) {
- s->provider()->setUsed(true);
}
- }
foreach (StringPtr s, object->outputStrings()) {
s->setUsed(true);
}
foreach (MatrixPtr m, object->inputMatrices()) {
m->setUsed(true);
- if (m->provider()) {
- m->provider()->setUsed(true);
}
- }
foreach (MatrixPtr m, object->outputMatrices()) {
m->setUsed(true);
}
object->unlock();
}
+
ObjectList<DataObject> dataObjectList = _doc->objectStore()->getObjects<DataObject>();
foreach (DataObjectPtr object, dataObjectList) {
object->readLock();
@@ -472,10 +469,6 @@
foreach (PrimitivePtr p, object->inputPrimitives()) {
p->setUsed(true);
}
- foreach (PrimitivePtr p, object->outputPrimitives()) {
- p->setUsed(true);
- }
-
object->unlock();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/labelitem.h #1319893:1319894
@@ -67,6 +67,8 @@
virtual bool customDimensionsTab() {return true;}
+ Label::RenderContext *_labelRc;
+
public Q_SLOTS:
virtual void edit();
void setDirty() { _dirty = true; }
@@ -79,7 +81,6 @@
private:
void generateLabel(QPainter *p);
- Label::RenderContext *_labelRc;
QTransform _paintTransform;
bool _dirty;
QString _text;
--- branches/work/kst/portto4/kst/src/libkstapp/labelrenderer.h #1319893:1319894
@@ -134,6 +134,7 @@
}
}
+
int x, y; // Coordinates we're rendering at
int xMax, xStart;
QString fontName;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1319893:1319894
@@ -229,7 +229,7 @@
template<class T> static T* retrieveItem(const QString &name);
- template<class T> static QList<T *> getItems();
+ template<class T> static QList<T *> getItems(bool include_hidden=false);
// TODO: Remove, needed only for a Qt 4.3 bug workaround
bool doSceneEvent(QGraphicsSceneContextMenuEvent *event) {
@@ -579,7 +579,7 @@
template<class T>
-QList<T *> ViewItem::getItems() {
+QList<T *> ViewItem::getItems(bool include_hidden) {
QList<T *> tItems;
ViewItem *viewItem;
T* tItem;
@@ -591,7 +591,7 @@
for (int i_item = 0; i_item<items.count(); i_item++) {
viewItem = dynamic_cast<ViewItem *>(items[i_item]);
tItem = dynamic_cast<T*>(viewItem);
- if (tItem) {
+ if ((tItem) && (include_hidden || viewItem->isVisible())) {
tItems.append(tItem);
}
}
More information about the Kst
mailing list