Index: trunk/BNC/qwt/qwt_scale_engine.cpp
===================================================================
--- trunk/BNC/qwt/qwt_scale_engine.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_scale_engine.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,39 +10,26 @@
 #include "qwt_scale_engine.h"
 #include "qwt_math.h"
-#include "qwt_scale_map.h"
-#include <qalgorithms.h>
-#include <qmath.h>
-#include <float.h>
+#include "qwt_interval.h"
+#include "qwt_transform.h"
+
+#include <qdebug.h>
+
 #include <limits>
 
-#if QT_VERSION < 0x040601
-#define qFabs(x) ::fabs(x)
-#define qExp(x) ::exp(x)
-#endif
-
 static inline double qwtLog( double base, double value )
 {
-    return log( value ) / log( base );
-}
-
-static inline QwtInterval qwtLogInterval( double base, const QwtInterval &interval )
+    return std::log( value ) / std::log( base );
+}
+
+static inline QwtInterval qwtLogInterval( double base, const QwtInterval& interval )
 {
     return QwtInterval( qwtLog( base, interval.minValue() ),
-            qwtLog( base, interval.maxValue() ) );
-}
-
-static inline QwtInterval qwtPowInterval( double base, const QwtInterval &interval )
-{
-    return QwtInterval( qPow( base, interval.minValue() ),
-            qPow( base, interval.maxValue() ) );
-}
-
-static inline long double qwtIntervalWidthL( const QwtInterval &interval )
-{
-    if ( !interval.isValid() )
-        return 0.0;
-
-    return static_cast<long double>( interval.maxValue() )
-        - static_cast<long double>( interval.minValue() );
+        qwtLog( base, interval.maxValue() ) );
+}
+
+static inline QwtInterval qwtPowInterval( double base, const QwtInterval& interval )
+{
+    return QwtInterval( std::pow( base, interval.minValue() ),
+        std::pow( base, interval.maxValue() ) );
 }
 
@@ -58,8 +45,8 @@
     {
         // # ticks per interval
-        const int numTicks = qCeil( qAbs( intervalSize / minStep ) ) - 1;
+        const int numTicks = qwtCeil( qAbs( intervalSize / minStep ) ) - 1;
 
         // Do the minor steps fit into the interval?
-        if ( qwtFuzzyCompare( ( numTicks +  1 ) * qAbs( minStep ),
+        if ( qwtFuzzyCompare( ( numTicks + 1 ) * qAbs( minStep ),
             qAbs( intervalSize ), intervalSize ) > 0 )
         {
@@ -85,6 +72,6 @@
             const double stepSize = intervalSize / numSteps;
 
-            const double p = ::floor( ::log( stepSize ) / ::log( base ) );
-            const double fraction = qPow( base, p );
+            const double p = std::floor( std::log( stepSize ) / std::log( base ) );
+            const double fraction = std::pow( base, p );
 
             for ( uint n = base; n > 1; n /= 2 )
@@ -110,13 +97,13 @@
 
 /*!
-  Ceil a value, relative to an interval
-
-  \param value Value to be ceiled
-  \param intervalSize Interval size
-
-  \return Rounded value
-
-  \sa floorEps()
-*/
+   Ceil a value, relative to an interval
+
+   \param value Value to be ceiled
+   \param intervalSize Interval size
+
+   \return Rounded value
+
+   \sa floorEps()
+ */
 double QwtScaleArithmetic::ceilEps( double value,
     double intervalSize )
@@ -125,16 +112,16 @@
 
     value = ( value - eps ) / intervalSize;
-    return ::ceil( value ) * intervalSize;
-}
-
-/*!
-  Floor a value, relative to an interval
-
-  \param value Value to be floored
-  \param intervalSize Interval size
-
-  \return Rounded value
-  \sa floorEps()
-*/
+    return std::ceil( value ) * intervalSize;
+}
+
+/*!
+   Floor a value, relative to an interval
+
+   \param value Value to be floored
+   \param intervalSize Interval size
+
+   \return Rounded value
+   \sa floorEps()
+ */
 double QwtScaleArithmetic::floorEps( double value, double intervalSize )
 {
@@ -142,16 +129,16 @@
 
     value = ( value + eps ) / intervalSize;
-    return ::floor( value ) * intervalSize;
-}
-
-/*!
-  \brief Divide an interval into steps
-
-  \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-  \return Step size
-*/
+    return std::floor( value ) * intervalSize;
+}
+
+/*!
+   \brief Divide an interval into steps
+
+   \f$stepSize = (intervalSize - intervalSize * 10e^{-6}) / numSteps\f$
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+   \return Step size
+ */
 double QwtScaleArithmetic::divideEps( double intervalSize, double numSteps )
 {
@@ -163,11 +150,11 @@
 
 /*!
-  Calculate a step size for a given interval
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-  \param base Base for the division ( usually 10 )
-
-  \return Calculated step size
+   Calculate a step size for a given interval
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+   \param base Base for the division ( usually 10 )
+
+   \return Calculated step size
  */
 double QwtScaleArithmetic::divideInterval(
@@ -181,8 +168,8 @@
         return 0.0;
 
-    const double lx = qwtLog( base, qFabs( v ) );
-    const double p = ::floor( lx );
-
-    const double fraction = qPow( base, lx - p );
+    const double lx = qwtLog( base, std::fabs( v ) );
+    const double p = std::floor( lx );
+
+    const double fraction = std::pow( base, lx - p );
 
     uint n = base;
@@ -190,5 +177,5 @@
         n /= 2;
 
-    double stepSize = n * qPow( base, p );
+    double stepSize = n * std::pow( base, p );
     if ( v < 0 )
         stepSize = -stepSize;
@@ -199,5 +186,5 @@
 class QwtScaleEngine::PrivateData
 {
-public:
+  public:
     PrivateData():
         attributes( QwtScaleEngine::NoAttribute ),
@@ -228,12 +215,12 @@
 
 /*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtScaleEngine::QwtScaleEngine( uint base )
 {
-    d_data = new PrivateData;
+    m_data = new PrivateData;
     setBase( base );
 }
@@ -243,5 +230,5 @@
 QwtScaleEngine::~QwtScaleEngine ()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -259,10 +246,10 @@
 
  */
-void QwtScaleEngine::setTransformation( QwtTransform *transform )
-{
-    if ( transform != d_data->transform )
-    {
-        delete d_data->transform;
-        d_data->transform = transform;
+void QwtScaleEngine::setTransformation( QwtTransform* transform )
+{
+    if ( transform != m_data->transform )
+    {
+        delete m_data->transform;
+        m_data->transform = transform;
     }
 }
@@ -273,12 +260,12 @@
    NULL is returned, indicating no transformation.
 
-   \return A clone of the transfomation
+   \return A clone of the transformation
    \sa setTransformation()
  */
-QwtTransform *QwtScaleEngine::transformation() const
-{
-    QwtTransform *transform = NULL;
-    if ( d_data->transform )
-        transform = d_data->transform->copy();
+QwtTransform* QwtScaleEngine::transformation() const
+{
+    QwtTransform* transform = NULL;
+    if ( m_data->transform )
+        transform = m_data->transform->copy();
 
     return transform;
@@ -290,8 +277,8 @@
 
     \sa setMargins()
-*/
+ */
 double QwtScaleEngine::lowerMargin() const
 {
-    return d_data->lowerMargin;
+    return m_data->lowerMargin;
 }
 
@@ -301,57 +288,57 @@
 
     \sa setMargins()
-*/
+ */
 double QwtScaleEngine::upperMargin() const
 {
-    return d_data->upperMargin;
-}
-
-/*!
-  \brief Specify margins at the scale's endpoints
-  \param lower minimum distance between the scale's lower boundary and the
+    return m_data->upperMargin;
+}
+
+/*!
+   \brief Specify margins at the scale's endpoints
+   \param lower minimum distance between the scale's lower boundary and the
              smallest enclosed value
-  \param upper minimum distance between the scale's upper boundary and the
+   \param upper minimum distance between the scale's upper boundary and the
              greatest enclosed value
 
-  Margins can be used to leave a minimum amount of space between
-  the enclosed intervals and the boundaries of the scale.
-
-  \warning
-  \li QwtLogScaleEngine measures the margins in decades.
-
-  \sa upperMargin(), lowerMargin()
-*/
+   Margins can be used to leave a minimum amount of space between
+   the enclosed intervals and the boundaries of the scale.
+
+   \warning
+   \li QwtLogScaleEngine measures the margins in decades.
+
+   \sa upperMargin(), lowerMargin()
+ */
 
 void QwtScaleEngine::setMargins( double lower, double upper )
 {
-    d_data->lowerMargin = qMax( lower, 0.0 );
-    d_data->upperMargin = qMax( upper, 0.0 );
-}
-
-/*!
-  Calculate a step size for an interval size
-
-  \param intervalSize Interval size
-  \param numSteps Number of steps
-
-  \return Step size
-*/
+    m_data->lowerMargin = qwtMaxF( lower, 0.0 );
+    m_data->upperMargin = qwtMaxF( upper, 0.0 );
+}
+
+/*!
+   Calculate a step size for an interval size
+
+   \param intervalSize Interval size
+   \param numSteps Number of steps
+
+   \return Step size
+ */
 double QwtScaleEngine::divideInterval(
     double intervalSize, int numSteps ) const
 {
     return QwtScaleArithmetic::divideInterval(
-        intervalSize, numSteps, d_data->base );
-}
-
-/*!
-  Check if an interval "contains" a value
-
-  \param interval Interval
-  \param value Value
-
-  \return True, when the value is inside the interval
-*/
+        intervalSize, numSteps, m_data->base );
+}
+
+/*!
+   Check if an interval "contains" a value
+
+   \param interval Interval
+   \param value Value
+
+   \return True, when the value is inside the interval
+ */
 bool QwtScaleEngine::contains(
-    const QwtInterval &interval, double value ) const
+    const QwtInterval& interval, double value ) const
 {
     if ( !interval.isValid() )
@@ -368,16 +355,16 @@
 
 /*!
-  Remove ticks from a list, that are not inside an interval
-
-  \param ticks Tick list
-  \param interval Interval
-
-  \return Stripped tick list
-*/
-QList<double> QwtScaleEngine::strip( const QList<double>& ticks,
-    const QwtInterval &interval ) const
+   Remove ticks from a list, that are not inside an interval
+
+   \param ticks Tick list
+   \param interval Interval
+
+   \return Stripped tick list
+ */
+QList< double > QwtScaleEngine::strip( const QList< double >& ticks,
+    const QwtInterval& interval ) const
 {
     if ( !interval.isValid() || ticks.count() == 0 )
-        return QList<double>();
+        return QList< double >();
 
     if ( contains( interval, ticks.first() )
@@ -387,5 +374,5 @@
     }
 
-    QList<double> strippedTicks;
+    QList< double > strippedTicks;
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -397,22 +384,23 @@
 
 /*!
-  \brief Build an interval around a value
-
-  In case of v == 0.0 the interval is [-0.5, 0.5],
-  otherwide it is [0.5 * v, 1.5 * v]
-
-  \param value Initial value
-  \return Calculated interval
-*/
+   \brief Build an interval around a value
+
+   In case of v == 0.0 the interval is [-0.5, 0.5],
+   otherwise it is [0.5 * v, 1.5 * v]
+
+   \param value Initial value
+   \return Calculated interval
+ */
 
 QwtInterval QwtScaleEngine::buildInterval( double value ) const
 {
     const double delta = ( value == 0.0 ) ? 0.5 : qAbs( 0.5 * value );
-
-    if ( DBL_MAX - delta < value )
-        return QwtInterval( DBL_MAX - delta, DBL_MAX );
-
-    if ( -DBL_MAX + delta > value )
-        return QwtInterval( -DBL_MAX, -DBL_MAX + delta );
+    const double max = std::numeric_limits< double >::max();
+
+    if ( max - delta < value )
+        return QwtInterval( max - delta, max );
+
+    if ( -max + delta > value )
+        return QwtInterval( -max, -max + delta );
 
     return QwtInterval( value - delta, value + delta );
@@ -420,104 +408,104 @@
 
 /*!
-  Change a scale attribute
-
-  \param attribute Attribute to change
-  \param on On/Off
-
-  \sa Attribute, testAttribute()
-*/
+   Change a scale attribute
+
+   \param attribute Attribute to change
+   \param on On/Off
+
+   \sa Attribute, testAttribute()
+ */
 void QwtScaleEngine::setAttribute( Attribute attribute, bool on )
 {
     if ( on )
-        d_data->attributes |= attribute;
+        m_data->attributes |= attribute;
     else
-        d_data->attributes &= ~attribute;
-}
-
-/*!
-  \return True, if attribute is enabled.
-
-  \param attribute Attribute to be tested
-  \sa Attribute, setAttribute()
-*/
+        m_data->attributes &= ~attribute;
+}
+
+/*!
+   \return True, if attribute is enabled.
+
+   \param attribute Attribute to be tested
+   \sa Attribute, setAttribute()
+ */
 bool QwtScaleEngine::testAttribute( Attribute attribute ) const
 {
-    return ( d_data->attributes & attribute );
-}
-
-/*!
-  Change the scale attribute
-
-  \param attributes Set scale attributes
-  \sa Attribute, attributes()
-*/
+    return ( m_data->attributes & attribute );
+}
+
+/*!
+   Change the scale attribute
+
+   \param attributes Set scale attributes
+   \sa Attribute, attributes()
+ */
 void QwtScaleEngine::setAttributes( Attributes attributes )
 {
-    d_data->attributes = attributes;
-}
-
-/*!
-  \return Scale attributes
-  \sa Attribute, setAttributes(), testAttribute()
-*/
+    m_data->attributes = attributes;
+}
+
+/*!
+   \return Scale attributes
+   \sa Attribute, setAttributes(), testAttribute()
+ */
 QwtScaleEngine::Attributes QwtScaleEngine::attributes() const
 {
-    return d_data->attributes;
-}
-
-/*!
-  \brief Specify a reference point
-  \param reference New reference value
-
-  The reference point is needed if options IncludeReference or
-  Symmetric are active. Its default value is 0.0.
-
-  \sa Attribute
-*/
+    return m_data->attributes;
+}
+
+/*!
+   \brief Specify a reference point
+   \param reference New reference value
+
+   The reference point is needed if options IncludeReference or
+   Symmetric are active. Its default value is 0.0.
+
+   \sa Attribute
+ */
 void QwtScaleEngine::setReference( double reference )
 {
-    d_data->referenceValue = reference;
-}
-
-/*!
-  \return the reference value
-  \sa setReference(), setAttribute()
-*/
+    m_data->referenceValue = reference;
+}
+
+/*!
+   \return the reference value
+   \sa setReference(), setAttribute()
+ */
 double QwtScaleEngine::reference() const
 {
-    return d_data->referenceValue;
-}
-
-/*!
-  Set the base of the scale engine
-
-  While a base of 10 is what 99.9% of all applications need
-  certain scales might need a different base: f.e 2
-
-  The default setting is 10
-
-  \param base Base of the engine
-
-  \sa base()
+    return m_data->referenceValue;
+}
+
+/*!
+   Set the base of the scale engine
+
+   While a base of 10 is what 99.9% of all applications need
+   certain scales might need a different base: f.e 2
+
+   The default setting is 10
+
+   \param base Base of the engine
+
+   \sa base()
  */
 void QwtScaleEngine::setBase( uint base )
 {
-    d_data->base = qMax( base, 2U );
-}
-
-/*!
-  \return base Base of the scale engine
-  \sa setBase()
+    m_data->base = qMax( base, 2U );
+}
+
+/*!
+   \return base Base of the scale engine
+   \sa setBase()
  */
 uint QwtScaleEngine::base() const
 {
-    return d_data->base;
-}
-
-/*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+    return m_data->base;
+}
+
+/*!
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtLinearScaleEngine::QwtLinearScaleEngine( uint base ):
@@ -532,15 +520,15 @@
 
 /*!
-  Align and divide an interval
-
-  \param maxNumSteps Max. number of steps
-  \param x1 First limit of the interval (In/Out)
-  \param x2 Second limit of the interval (In/Out)
-  \param stepSize Step size (Out)
-
-  \sa setAttribute()
-*/
+   Align and divide an interval
+
+   \param maxNumSteps Max. number of steps
+   \param x1 First limit of the interval (In/Out)
+   \param x2 Second limit of the interval (In/Out)
+   \param stepSize Step size (Out)
+
+   \sa setAttribute()
+ */
 void QwtLinearScaleEngine::autoScale( int maxNumSteps,
-    double &x1, double &x2, double &stepSize ) const
+    double& x1, double& x2, double& stepSize ) const
 {
     QwtInterval interval( x1, x2 );
@@ -586,5 +574,5 @@
 
    \return Calculated scale division
-*/
+ */
 QwtScaleDiv QwtLinearScaleEngine::divideScale( double x1, double x2,
     int maxMajorSteps, int maxMinorSteps, double stepSize ) const
@@ -592,5 +580,5 @@
     QwtInterval interval = QwtInterval( x1, x2 ).normalized();
 
-    if ( qwtIntervalWidthL( interval ) > std::numeric_limits<double>::max() )
+    if ( interval.widthL() > std::numeric_limits< double >::max() )
     {
         qWarning() << "QwtLinearScaleEngine::divideScale: overflow";
@@ -615,5 +603,5 @@
     if ( stepSize != 0.0 )
     {
-        QList<double> ticks[QwtScaleDiv::NTickTypes];
+        QList< double > ticks[QwtScaleDiv::NTickTypes];
         buildTicks( interval, stepSize, maxMinorSteps, ticks );
 
@@ -636,8 +624,8 @@
 
    \sa buildMajorTicks(), buildMinorTicks
-*/
+ */
 void QwtLinearScaleEngine::buildTicks(
     const QwtInterval& interval, double stepSize, int maxMinorSteps,
-    QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
+    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
 {
     const QwtInterval boundingInterval = align( interval, stepSize );
@@ -656,6 +644,5 @@
         ticks[i] = strip( ticks[i], interval );
 
-        // ticks very close to 0.0 are
-        // explicitely set to 0.0
+        // ticks very close to 0.0 are explicitly set to 0.0
 
         for ( int j = 0; j < ticks[i].count(); j++ )
@@ -674,7 +661,7 @@
 
    \return Calculated ticks
-*/
-QList<double> QwtLinearScaleEngine::buildMajorTicks(
-    const QwtInterval &interval, double stepSize ) const
+ */
+QList< double > QwtLinearScaleEngine::buildMajorTicks(
+    const QwtInterval& interval, double stepSize ) const
 {
     int numTicks = qRound( interval.width() / stepSize ) + 1;
@@ -682,5 +669,6 @@
         numTicks = 10000;
 
-    QList<double> ticks;
+    QList< double > ticks;
+    ticks.reserve( numTicks );
 
     ticks += interval.minValue();
@@ -701,10 +689,10 @@
    \param mediumTicks Array to be filled with the calculated medium ticks
 
-*/
+ */
 void QwtLinearScaleEngine::buildMinorTicks(
-    const QList<double>& majorTicks,
+    const QList< double >& majorTicks,
     int maxMinorSteps, double stepSize,
-    QList<double> &minorTicks,
-    QList<double> &mediumTicks ) const
+    QList< double >& minorTicks,
+    QList< double >& mediumTicks ) const
 {
     double minStep = qwtStepSize( stepSize, maxMinorSteps, base() );
@@ -713,5 +701,5 @@
 
     // # ticks per interval
-    const int numTicks = qCeil( qAbs( stepSize / minStep ) ) - 1;
+    const int numTicks = qwtCeil( qAbs( stepSize / minStep ) ) - 1;
 
     int medIndex = -1;
@@ -741,16 +729,16 @@
 
 /*!
-  \brief Align an interval to a step size
-
-  The limits of an interval are aligned that both are integer
-  multiples of the step size.
-
-  \param interval Interval
-  \param stepSize Step size
-
-  \return Aligned interval
-*/
+   \brief Align an interval to a step size
+
+   The limits of an interval are aligned that both are integer
+   multiples of the step size.
+
+   \param interval Interval
+   \param stepSize Step size
+
+   \return Aligned interval
+ */
 QwtInterval QwtLinearScaleEngine::align(
-    const QwtInterval &interval, double stepSize ) const
+    const QwtInterval& interval, double stepSize ) const
 {
     double x1 = interval.minValue();
@@ -761,5 +749,7 @@
 
     const double eps = 0.000000000001; // since Qt 4.8: qFuzzyIsNull
-    if ( -DBL_MAX + stepSize <= x1 )
+    const double max = std::numeric_limits< double >::max();
+
+    if ( -max + stepSize <= x1 )
     {
         const double x = QwtScaleArithmetic::floorEps( x1, stepSize );
@@ -768,5 +758,5 @@
     }
 
-    if ( DBL_MAX - stepSize >= x2 )
+    if ( max - stepSize >= x2 )
     {
         const double x = QwtScaleArithmetic::ceilEps( x2, stepSize );
@@ -779,8 +769,8 @@
 
 /*!
-  Constructor
-
-  \param base Base of the scale engine
-  \sa setBase()
+   Constructor
+
+   \param base Base of the scale engine
+   \sa setBase()
  */
 QwtLogScaleEngine::QwtLogScaleEngine( uint base ):
@@ -804,7 +794,7 @@
 
    \sa QwtScaleEngine::setAttribute()
-*/
+ */
 void QwtLogScaleEngine::autoScale( int maxNumSteps,
-    double &x1, double &x2, double &stepSize ) const
+    double& x1, double& x2, double& stepSize ) const
 {
     if ( x1 > x2 )
@@ -813,6 +803,6 @@
     const double logBase = base();
 
-    QwtInterval interval( x1 / qPow( logBase, lowerMargin() ),
-        x2 * qPow( logBase, upperMargin() ) );
+    QwtInterval interval( x1 / std::pow( logBase, lowerMargin() ),
+        x2 * std::pow( logBase, upperMargin() ) );
 
     if ( interval.maxValue() / interval.minValue() < logBase )
@@ -828,21 +818,10 @@
 
         QwtInterval linearInterval = QwtInterval( x1, x2 ).normalized();
-        linearInterval = linearInterval.limited( LOG_MIN, LOG_MAX );
+        linearInterval = linearInterval.limited(
+            QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
         if ( linearInterval.maxValue() / linearInterval.minValue() < logBase )
         {
-            // the aligned scale is still less than one step
-
-#if 1
-            // this code doesn't make any sense, but for compatibility
-            // reasons we keep it until 6.2. But it will be ignored
-            // in divideScale
-
-            if ( stepSize < 0.0 )
-                stepSize = -qwtLog( logBase, qAbs( stepSize ) );
-            else
-                stepSize = qwtLog( logBase, stepSize );
-#endif
-
+            stepSize = 0.0;
             return;
         }
@@ -850,10 +829,10 @@
 
     double logRef = 1.0;
-    if ( reference() > LOG_MIN / 2 )
-        logRef = qMin( reference(), LOG_MAX / 2 );
+    if ( reference() > QwtLogTransform::LogMin / 2 )
+        logRef = qwtMinF( reference(), QwtLogTransform::LogMax / 2 );
 
     if ( testAttribute( QwtScaleEngine::Symmetric ) )
     {
-        const double delta = qMax( interval.maxValue() / logRef,
+        const double delta = qwtMaxF( interval.maxValue() / logRef,
             logRef / interval.minValue() );
         interval.setInterval( logRef / delta, logRef * delta );
@@ -863,5 +842,5 @@
         interval = interval.extend( logRef );
 
-    interval = interval.limited( LOG_MIN, LOG_MAX );
+    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
     if ( interval.width() == 0.0 )
@@ -897,10 +876,10 @@
 
    \return Calculated scale division
-*/
+ */
 QwtScaleDiv QwtLogScaleEngine::divideScale( double x1, double x2,
     int maxMajorSteps, int maxMinorSteps, double stepSize ) const
 {
     QwtInterval interval = QwtInterval( x1, x2 ).normalized();
-    interval = interval.limited( LOG_MIN, LOG_MAX );
+    interval = interval.limited( QwtLogTransform::LogMin, QwtLogTransform::LogMax );
 
     if ( interval.width() <= 0 )
@@ -937,5 +916,5 @@
     if ( stepSize != 0.0 )
     {
-        QList<double> ticks[QwtScaleDiv::NTickTypes];
+        QList< double > ticks[QwtScaleDiv::NTickTypes];
         buildTicks( interval, stepSize, maxMinorSteps, ticks );
 
@@ -958,8 +937,8 @@
 
    \sa buildMajorTicks(), buildMinorTicks
-*/
+ */
 void QwtLogScaleEngine::buildTicks(
     const QwtInterval& interval, double stepSize, int maxMinorSteps,
-    QList<double> ticks[QwtScaleDiv::NTickTypes] ) const
+    QList< double > ticks[QwtScaleDiv::NTickTypes] ) const
 {
     const QwtInterval boundingInterval = align( interval, stepSize );
@@ -985,7 +964,7 @@
 
    \return Calculated ticks
-*/
-QList<double> QwtLogScaleEngine::buildMajorTicks(
-    const QwtInterval &interval, double stepSize ) const
+ */
+QList< double > QwtLogScaleEngine::buildMajorTicks(
+    const QwtInterval& interval, double stepSize ) const
 {
     double width = qwtLogInterval( base(), interval ).width();
@@ -995,14 +974,15 @@
         numTicks = 10000;
 
-    const double lxmin = ::log( interval.minValue() );
-    const double lxmax = ::log( interval.maxValue() );
+    const double lxmin = std::log( interval.minValue() );
+    const double lxmax = std::log( interval.maxValue() );
     const double lstep = ( lxmax - lxmin ) / double( numTicks - 1 );
 
-    QList<double> ticks;
+    QList< double > ticks;
+    ticks.reserve( numTicks );
 
     ticks += interval.minValue();
 
     for ( int i = 1; i < numTicks - 1; i++ )
-        ticks += qExp( lxmin + double( i ) * lstep );
+        ticks += std::exp( lxmin + double( i ) * lstep );
 
     ticks += interval.maxValue();
@@ -1019,10 +999,10 @@
    \param minorTicks Array to be filled with the calculated minor ticks
    \param mediumTicks Array to be filled with the calculated medium ticks
-*/
+ */
 void QwtLogScaleEngine::buildMinorTicks(
-    const QList<double> &majorTicks,
+    const QList< double >& majorTicks,
     int maxMinorSteps, double stepSize,
-    QList<double> &minorTicks,
-    QList<double> &mediumTicks ) const
+    QList< double >& minorTicks,
+    QList< double >& mediumTicks ) const
 {
     const double logBase = base();
@@ -1081,5 +1061,5 @@
 
         // Do the minor steps fit into the interval?
-        if ( qwtFuzzyCompare( ( numTicks +  1 ) * minStep,
+        if ( qwtFuzzyCompare( ( numTicks + 1 ) * minStep,
             stepSize, stepSize ) > 0 )
         {
@@ -1095,5 +1075,5 @@
 
         // substep factor = base^substeps
-        const qreal minFactor = qMax( qPow( logBase, minStep ), qreal( logBase ) );
+        const qreal minFactor = qwtMaxF( std::pow( logBase, minStep ), logBase );
 
         for ( int i = 0; i < majorTicks.count(); i++ )
@@ -1114,16 +1094,16 @@
 
 /*!
-  \brief Align an interval to a step size
-
-  The limits of an interval are aligned that both are integer
-  multiples of the step size.
-
-  \param interval Interval
-  \param stepSize Step size
-
-  \return Aligned interval
-*/
+   \brief Align an interval to a step size
+
+   The limits of an interval are aligned that both are integer
+   multiples of the step size.
+
+   \param interval Interval
+   \param stepSize Step size
+
+   \return Aligned interval
+ */
 QwtInterval QwtLogScaleEngine::align(
-    const QwtInterval &interval, double stepSize ) const
+    const QwtInterval& interval, double stepSize ) const
 {
     const QwtInterval intv = qwtLogInterval( base(), interval );
