[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Wed Aug 25 19:35:35 CEST 2004


CVS commit by arwalker: 

Differentiate between calls to setXRange and setLXRange, and check the arnge accordingly.

In the interim a workaround is to set the desired range in non-log mode, and then switch to log mode.

CCMAIL: 87915-done at bugs.kde.org


  M +24 -8     kst2dplot.cpp   1.251
  M +2 -1      kst2dplot.h   1.103
  M +3 -3      kstplotdialog_i.cpp   1.92


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.250:1.251
@@ -459,5 +459,22 @@ void Kst2DPlot::setYLabel(const QString&
 
 
-bool Kst2DPlot::checkRange(double &min_in, double &max_in, bool bIsLog) {
+bool Kst2DPlot::checkRange(double &min_in, double &max_in) {
+  double diff  = fabs(1000.0 * min_in) * DBL_EPSILON;
+  bool rc = true;
+
+  if (isnan(min_in) || isnan(max_in) ||
+             isinf(min_in) || isinf(max_in)) {
+    rc = false;
+  }
+
+  if (rc && max_in <= min_in + diff) {
+    max_in = min_in + diff;
+  }
+
+  return rc;
+}
+
+
+bool Kst2DPlot::checkLRange(double &min_in, double &max_in, bool bIsLog) {
   double diff  = fabs(1000.0 * min_in) * DBL_EPSILON;
   bool rc = true;
@@ -484,5 +501,5 @@ bool Kst2DPlot::setXScale(double xmin_in
   bool rc = false;
 
-  if (checkRange(xmin_in, xmax_in, _xLog)) {
+  if (checkRange(xmin_in, xmax_in)) {
     XMax = xmax_in;
     XMin = xmin_in;
@@ -497,5 +514,5 @@ bool Kst2DPlot::setYScale(double ymin_in
   bool rc = false;
 
-  if (checkRange(ymin_in, ymax_in, _yLog)) {
+  if (checkRange(ymin_in, ymax_in)) {
     YMax = ymax_in;
     YMin = ymin_in;
@@ -510,5 +527,5 @@ bool Kst2DPlot::setLXScale(double xmin_i
   bool rc = false;
 
-  if (checkRange(xmin_in, xmax_in, _xLog)) {
+  if (checkLRange(xmin_in, xmax_in, _xLog)) {
     if (_xLog) {
       XMax = pow(10.0, xmax_in);
@@ -528,5 +545,5 @@ bool Kst2DPlot::setLYScale(double ymin_i
   bool rc = false;
 
-  if (checkRange(ymin_in, ymax_in, _yLog)) {
+  if (checkLRange(ymin_in, ymax_in, _yLog)) {
     if (_yLog) {
       YMax = pow(10.0, ymax_in);
@@ -1125,5 +1142,4 @@ void Kst2DPlot::genAxisTickLabels(QPaint
   for (i = iIndexLo; i < iIndexHi; i++) {
     genAxisTickLabel(strTmp, (double)i * Tick + Org, bLog);
-    dMaxWidth = Label->rotation();
     Label->setText(strTmp);
     dWidth  = Label->rotatedWidth(p);
@@ -1956,6 +1972,6 @@ void Kst2DPlot::matchAxis(int id) {
     p->getScale(x0, y0, x1, y1);
     setLog(p->isXLog(), p->isYLog());
-    setXScaleMode(FIXED); //p->getXScaleMode());
-    setYScaleMode(FIXED); //p->getYScaleMode());
+    setXScaleMode(FIXED);
+    setYScaleMode(FIXED);
     setXScale(x0, x1);
     setYScale(y0, y1);

--- kdeextragear-2/kst/kst/kst2dplot.h  #1.102:1.103
@@ -70,5 +70,6 @@ public:
 
   static Kst2DPlotList globalPlotList();
-  static bool checkRange(double &min_in, double &max_in, bool bIsLog);
+  static bool checkRange(double &min_in, double &max_in);
+  static bool checkLRange(double &min_in, double &max_in, bool bIsLog);
   static void genAxisTickLabelFullPrecision(QString& label, double z, bool isLog);
   static void genAxisTickLabelDifference(QString& label, double zbase, double zvalue, bool isLog);

--- kdeextragear-2/kst/kst/kstplotdialog_i.cpp  #1.91:1.92
@@ -496,4 +496,6 @@ void KstPlotDialogI::applyLegends(Kst2DP
 
 void KstPlotDialogI::applyLimits(Kst2DPlotPtr plot) {
+  plot->setLog(XIsLog->isChecked(), YIsLog->isChecked());
+
   /* do X Scale */
   if (XAC->isChecked()) {
@@ -530,6 +532,4 @@ void KstPlotDialogI::applyLimits(Kst2DPl
   }
 
-  plot->setLog(XIsLog->isChecked(), YIsLog->isChecked());
-
   //minor tick settings
   if (_xMinorTicksAuto->isChecked()) {





More information about the Kst mailing list