[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Sat Jan 17 15:20:30 CET 2004
CVS commit by staikos:
after a marathon session of tuning and tweaking the coordinates, I finally have
the datamode cursor working. It isn't pretty and it flickers a little bit, but
it works.
CCMAIL: 72206-done at bugs.kde.org
M +2 -0 kstbasecurve.cpp 1.7
M +120 -90 kstplot.cpp 1.34
M +1 -0 kstplot.h 1.19
M +6 -1 kstview.cpp 1.74
--- kdeextragear-2/kst/kst/kstbasecurve.cpp #1.6:1.7
@@ -46,2 +46,4 @@ KstBaseCurve::~KstBaseCurve() {
}
+
+// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstplot.cpp #1.33:1.34
@@ -19,4 +19,6 @@
#include <limits.h>
+#include <kdebug.h>
+
#include <qpainter.h>
#include <qrect.h>
@@ -876,4 +878,28 @@ void KstPlot::setBorders(double &xleft_b
}
+
+void KstPlot::drawDotAt(QPainter& p, double x, double y) {
+ if (XLog) {
+ x = x > 0 ? log10(x) : -350;
+ }
+ if (YLog) {
+ y = y > 0 ? log10(y) : -350;
+ }
+
+ double x_min, x_max, y_min, y_max;
+ double X1, Y1;
+ getLScale(x_min, y_min, x_max, y_max);
+
+ X1 = PlotRegion.width() * (x - x_min) / (x_max - x_min) + PlotRegion.left();
+ Y1 = PlotRegion.height() * (y_max - y) / (y_max - y_min) + PlotRegion.top();
+
+ p.setPen(QPen(QColor(0,0,0), 0));
+ p.drawArc(X1 - 3, Y1 - 3, 6, 6, 0, 5760);
+ p.setPen(QPen(QColor(255,0,0), 0));
+ p.drawArc(X1 - 2, Y1 - 2, 4, 4, 0, 5760);
+ p.drawArc(X1 - 1, Y1 - 1, 2, 2, 0, 5760);
+}
+
+
void KstPlot::paint(QPainter &p, double in_xleft_bdr_px, bool printMode) {
double XTick, YTick, Xorg, Yorg; // Tick interval and position
@@ -1661,2 +1690,3 @@ void KstPlot::setTied(bool in_tied) {
}
+// vim: ts=2 sw=2 et
--- kdeextragear-2/kst/kst/kstplot.h #1.18:1.19
@@ -62,4 +62,5 @@ public:
void paint(QPainter &pd, double X_LeftBorder=0, bool printMode = false);
+ void drawDotAt(QPainter& p, double x, double y);
double getXBorder(QPainter &p);
void addCurve(KstBaseCurve *curve);
--- kdeextragear-2/kst/kst/kstview.cpp #1.73:1.74
@@ -419,5 +419,5 @@ void KstView::updateMouse() {
int pt = int((*i)->sampleCount() * xpos / ((*i)->maxX() - (*i)->minX()));
- pt -= (*i)->minX();
+ pt -= int((*i)->minX());
if (pt < 0) {
@@ -438,7 +438,12 @@ void KstView::updateMouse() {
_copy_x = newxpos;
_copy_y = newypos;
+
+ repaint(false);
+ QPainter p(this);
+ pPlot->drawDotAt(p, newxpos, newypos);
emit newDataMsg(msg);
return;
}
+ repaint(false);
emit newDataMsg(QString::null);
return;
More information about the Kst
mailing list