[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Aug 6 19:34:53 CEST 2004
CVS commit by staikos:
restore 2-space indenting, add some comments and spacing, inline logX and logY,
and remove duplicate header
M +379 -339 kst2dplot.cpp 1.208
M +0 -2 kst2dplot.h 1.86
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.207:1.208
@@ -16,8 +16,8 @@
***************************************************************************/
-#include <stdio.h>
-#include <math.h>
#include <float.h>
#include <limits.h>
+#include <math.h>
+#include <stdio.h>
#include <limits>
@@ -56,5 +56,4 @@
#include "kstviewwidget.h"
#include "kstviewwindow.h"
-#include "kstlegend.h"
#define X_MINOR_TICKS 5.0
@@ -503,14 +511,14 @@ void Kst2DPlot::setScale(double xmin_in,
bool Kst2DPlot::setLScale(double xmin_in, double ymin_in,
double xmax_in, double ymax_in) {
- bool bRetVal = false;
+ bool rc = false;
if (setLXScale(xmin_in, xmax_in)) {
- bRetVal = true;
+ rc = true;
}
if (setLYScale(ymin_in, ymax_in)) {
- bRetVal = true;
+ rc = true;
}
- return bRetVal;
+ return rc;
}
@@ -523,10 +532,12 @@ void Kst2DPlot::getScale(double &xmin, d
}
-double Kst2DPlot::logX( double x ) const {
- return (x > 0.0 ? log10(x) : -350.0);
+
+inline double logX(double x) {
+ return x > 0.0 ? log10(x) : -350.0;
}
-double Kst2DPlot::logY( double y ) const {
- return (y > 0.0 ? log10(y) : -350.0);
+
+inline double logY(double y) {
+ return y > 0.0 ? log10(y) : -350.0;
}
@@ -793,5 +810,5 @@ void Kst2DPlot::updateScale() {
break;
default:
- fprintf(stderr, "Bug in Kst2DPlot::updateScale: bad scale mode\n");
+ kdWarning() << "Bug in Kst2DPlot::updateScale: bad scale mode" << endl;
break;
}
@@ -1021,5 +1038,6 @@ void Kst2DPlot::genAxisTickLabelDifferen
label = i18n("-[%1]").arg(-zdiff, 0, 'g', DIFFERENCE_PRECISION);
} else {
- label = i18n("[%1]").arg(0.0, 0, 'g', 0);
+ // Verify the output and then hardcode this - it's a wasted operation.
+ label = QString("[%1]").arg(0.0, 0, 'g', 0);
}
}
@@ -1378,4 +1399,9 @@ void Kst2DPlot::draw(QPainter &p, KstPai
}
+ /* Ugh this is a huge mess. How do we know when we aren't using these
+ * variables anymore? Let's push them down into the proper scope and use
+ * some better naming conventions, or at least document the meaning of each
+ * variable.
+ */
double in_xleft_bdr_px = resolutionEnhancement * KST::alignment.x(p.window().size());
double m_X, m_Y, b_X, b_Y;
@@ -4170,6 +4200,7 @@ void Kst2DPlot::removeAllImages(bool set
}
+
bool Kst2DPlot::hasImage(KstImagePtr inImage) const {
- return (_images.find(inImage) != _images.end());
+ return _images.find(inImage) != _images.end();
}
@@ -4180,6 +4212,7 @@ void Kst2DPlot::setCurveToMarkers(KstBas
}
+
bool Kst2DPlot::hasCurveToMarkers() const {
- return (_curveToMarkers != 0L);
+ return _curveToMarkers != 0L;
}
@@ -4192,8 +4227,8 @@ KstBaseCurvePtr Kst2DPlot::curveToMarker
}
+
void Kst2DPlot::updateMarkersFromCurve() {
- if (hasCurveToMarkers()) {
+ if (hasCurveToMarkers() && _curveToMarkers->sampleCount() > 0) {
//scan through the whole curve
- if (_curveToMarkers->sampleCount() > 0) {
double prevX, prevY;
_curveToMarkers->point(0, prevX, prevY);
@@ -4211,5 +4246,4 @@ void Kst2DPlot::updateMarkersFromCurve()
}
}
- }
}
--- kdeextragear-2/kst/kst/kst2dplot.h #1.85:1.86
@@ -121,6 +121,4 @@ public:
void getScale(double& xmin, double& ymin, double& xmax, double& ymax) const;
void getLScale(double& xmin, double& ymin, double& xmax, double& ymax) const;
- double logX(double x) const;
- double logY(double y) const;
KstScaleModeType getXScaleMode() const;
More information about the Kst
mailing list