[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Thu Jun 10 23:14:59 CEST 2004
CVS commit by staikos:
first half of x-left alignment. It requires "user intervention" to activate at
the moment because it doesn't trigger updates in all the other plots. I'm
trying to avoid an O(n^2) paint problem which is why the obvious algorithm
isn't implemented yet.
M +40 -1 kst2dplot.cpp 1.80
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.79:1.80
@@ -50,4 +50,32 @@
#include "kst.h"
+#include <kstaticdeleter.h>
+
+class PlotDisplayManager;
+KStaticDeleter<PlotDisplayManager> pdManager;
+
+class PlotDisplayManager {
+ friend class KStaticDeleter<PlotDisplayManager>;
+ public:
+ static PlotDisplayManager *self() {
+ if (!_self) {
+ _self = pdManager.setObject(_self, new PlotDisplayManager);
+ }
+
+ return _self;
+ }
+
+ double xOffset;
+
+ protected:
+ PlotDisplayManager() : xOffset(0) {}
+ ~PlotDisplayManager() {}
+
+ static PlotDisplayManager *_self;
+};
+
+PlotDisplayManager *PlotDisplayManager::_self = 0L;
+
+
Kst2DPlot::Kst2DPlot(const QString& in_tag,
KstScaleModeType yscale_in,
@@ -864,4 +892,10 @@ void Kst2DPlot::updateTieBox(QPainter& p
void Kst2DPlot::paint(QPainter& p) {
setpixrect(_geom.x(), _geom.y());
+ double x = getXBorder(p);
+ PlotDisplayManager *dm = PlotDisplayManager::self();
+ if (x > dm->xOffset) {
+ dm->xOffset = x;
+ paint(p, dm->xOffset);
+ }
_buffer.paintInto(p, geometry());
updateTieBox(p);
@@ -874,5 +908,10 @@ void Kst2DPlot::draw() {
_buffer.buffer().fill(backgroundColor());
QPainter p(&_buffer.buffer());
- paint(p, 0); // FIXME: must set a proper value for xleft
+ double x = getXBorder(p);
+ PlotDisplayManager *dm = PlotDisplayManager::self();
+ if (x > dm->xOffset) {
+ dm->xOffset = x;
+ }
+ paint(p, dm->xOffset);
}
More information about the Kst
mailing list