Index: trunk/BNC/qwt/qwt_round_scale_draw.cpp
===================================================================
--- trunk/BNC/qwt/qwt_round_scale_draw.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_round_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -12,18 +12,17 @@
 #include "qwt_scale_div.h"
 #include "qwt_scale_map.h"
+#include "qwt_text.h"
 #include "qwt_math.h"
-#include <qpen.h>
+
 #include <qpainter.h>
-#include <qfontmetrics.h>
-#include <qmath.h>
 
 class QwtRoundScaleDraw::PrivateData
 {
-public:
-    PrivateData():
-        center( 50.0, 50.0 ),
-        radius( 50.0 ),
-        startAngle( -135.0 ),
-        endAngle( 135.0 )
+  public:
+    PrivateData()
+        : center( 50.0, 50.0 )
+        , radius( 50.0 )
+        , startAngle( -135.0 )
+        , endAngle( 135.0 )
     {
     }
@@ -37,16 +36,16 @@
 
 /*!
-  \brief Constructor
-
-  The range of the scale is initialized to [0, 100],
-  The center is set to (50, 50) with a radius of 50.
-  The angle range is set to [-135, 135].
-*/
+   \brief Constructor
+
+   The range of the scale is initialized to [0, 100],
+   The center is set to (50, 50) with a radius of 50.
+   The angle range is set to [-135, 135].
+ */
 QwtRoundScaleDraw::QwtRoundScaleDraw()
 {
-    d_data = new QwtRoundScaleDraw::PrivateData;
+    m_data = new QwtRoundScaleDraw::PrivateData;
 
     setRadius( 50 );
-    scaleMap().setPaintInterval( d_data->startAngle, d_data->endAngle );
+    scaleMap().setPaintInterval( m_data->startAngle, m_data->endAngle );
 }
 
@@ -54,31 +53,31 @@
 QwtRoundScaleDraw::~QwtRoundScaleDraw()
 {
-    delete d_data;
-}
-
-/*!
-  Change of radius the scale
-
-  Radius is the radius of the backbone without ticks and labels.
-
-  \param radius New Radius
-  \sa moveCenter()
-*/
+    delete m_data;
+}
+
+/*!
+   Change of radius the scale
+
+   Radius is the radius of the backbone without ticks and labels.
+
+   \param radius New Radius
+   \sa moveCenter()
+ */
 void QwtRoundScaleDraw::setRadius( double radius )
 {
-    d_data->radius = radius;
-}
-
-/*!
-  Get the radius
-
-  Radius is the radius of the backbone without ticks and labels.
-
-  \return Radius of the scale
-  \sa setRadius(), extent()
-*/
+    m_data->radius = radius;
+}
+
+/*!
+   Get the radius
+
+   Radius is the radius of the backbone without ticks and labels.
+
+   \return Radius of the scale
+   \sa setRadius(), extent()
+ */
 double QwtRoundScaleDraw::radius() const
 {
-    return d_data->radius;
+    return m_data->radius;
 }
 
@@ -88,8 +87,8 @@
    \param center New center
    \sa setRadius()
-*/
-void QwtRoundScaleDraw::moveCenter( const QPointF &center )
-{
-    d_data->center = center;
+ */
+void QwtRoundScaleDraw::moveCenter( const QPointF& center )
+{
+    m_data->center = center;
 }
 
@@ -97,24 +96,24 @@
 QPointF QwtRoundScaleDraw::center() const
 {
-    return d_data->center;
-}
-
-/*!
-  \brief Adjust the baseline circle segment for round scales.
-
-  The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2).
-  The default setting is [ -135, 135 ].
-  An angle of 0 degrees corresponds to the 12 o'clock position,
-  and positive angles count in a clockwise direction.
-  \param angle1
-  \param angle2 boundaries of the angle interval in degrees.
-  \warning <ul>
-  <li>The angle range is limited to [-360, 360] degrees. Angles exceeding
+    return m_data->center;
+}
+
+/*!
+   \brief Adjust the baseline circle segment for round scales.
+
+   The baseline will be drawn from min(angle1,angle2) to max(angle1, angle2).
+   The default setting is [ -135, 135 ].
+   An angle of 0 degrees corresponds to the 12 o'clock position,
+   and positive angles count in a clockwise direction.
+   \param angle1
+   \param angle2 boundaries of the angle interval in degrees.
+   \warning <ul>
+   <li>The angle range is limited to [-360, 360] degrees. Angles exceeding
       this range will be clipped.
-  <li>For angles more or equal than 360 degrees above or below min(angle1, angle2),
+   <li>For angles more or equal than 360 degrees above or below min(angle1, angle2),
       scale marks will not be drawn.
-  <li>If you need a counterclockwise scale, use QwtScaleDiv::setInterval()
-  </ul>
-*/
+   <li>If you need a counterclockwise scale, use QwtScaleDiv::setInterval()
+   </ul>
+ */
 void QwtRoundScaleDraw::setAngleRange( double angle1, double angle2 )
 {
@@ -124,14 +123,14 @@
 #endif
 
-    d_data->startAngle = angle1;
-    d_data->endAngle = angle2;
-
-    if ( d_data->startAngle == d_data->endAngle )
-    {
-        d_data->startAngle -= 1;
-        d_data->endAngle += 1;
-    }
-
-    scaleMap().setPaintInterval( d_data->startAngle, d_data->endAngle );
+    m_data->startAngle = angle1;
+    m_data->endAngle = angle2;
+
+    if ( m_data->startAngle == m_data->endAngle )
+    {
+        m_data->startAngle -= 1;
+        m_data->endAngle += 1;
+    }
+
+    scaleMap().setPaintInterval( m_data->startAngle, m_data->endAngle );
 }
 
@@ -143,10 +142,10 @@
 
    \sa drawTick(), drawBackbone()
-*/
-void QwtRoundScaleDraw::drawLabel( QPainter *painter, double value ) const
+ */
+void QwtRoundScaleDraw::drawLabel( QPainter* painter, double value ) const
 {
     const double tval = scaleMap().transform( value );
-    if ( ( tval >= d_data->startAngle + 360.0 )
-        || ( tval <= d_data->startAngle - 360.0 ) )
+    if ( ( tval >= m_data->startAngle + 360.0 )
+        || ( tval <= m_data->startAngle - 360.0 ) )
     {
         return;
@@ -157,5 +156,5 @@
         return;
 
-    double radius = d_data->radius;
+    double radius = m_data->radius;
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) ||
         hasComponent( QwtAbstractScaleDraw::Backbone ) )
@@ -170,8 +169,8 @@
     const double arc = qwtRadians( tval );
 
-    const double x = d_data->center.x() +
-        ( radius + sz.width() / 2.0 ) * qSin( arc );
-    const double y = d_data->center.y() -
-        ( radius + sz.height() / 2.0 ) * qCos( arc );
+    const double x = m_data->center.x() +
+        ( radius + sz.width() / 2.0 ) * std::sin( arc );
+    const double y = m_data->center.y() -
+        ( radius + sz.height() / 2.0 ) * std::cos( arc );
 
     const QRectF r( x - sz.width() / 2, y - sz.height() / 2,
@@ -188,6 +187,6 @@
 
    \sa drawBackbone(), drawLabel()
-*/
-void QwtRoundScaleDraw::drawTick( QPainter *painter, double value, double len ) const
+ */
+void QwtRoundScaleDraw::drawTick( QPainter* painter, double value, double len ) const
 {
     if ( len <= 0 )
@@ -196,15 +195,15 @@
     const double tval = scaleMap().transform( value );
 
-    const double cx = d_data->center.x();
-    const double cy = d_data->center.y();
-    const double radius = d_data->radius;
-
-    if ( ( tval < d_data->startAngle + 360.0 )
-        && ( tval > d_data->startAngle - 360.0 ) )
+    const double cx = m_data->center.x();
+    const double cy = m_data->center.y();
+    const double radius = m_data->radius;
+
+    if ( ( tval < m_data->startAngle + 360.0 )
+        && ( tval > m_data->startAngle - 360.0 ) )
     {
         const double arc = qwtRadians( tval );
 
-        const double sinArc = qSin( arc );
-        const double cosArc = qCos( arc );
+        const double sinArc = std::sin( arc );
+        const double cosArc = std::cos( arc );
 
         const double x1 = cx + radius * sinArc;
@@ -222,16 +221,16 @@
 
    \sa drawTick(), drawLabel()
-*/
-void QwtRoundScaleDraw::drawBackbone( QPainter *painter ) const
+ */
+void QwtRoundScaleDraw::drawBackbone( QPainter* painter ) const
 {
     const double deg1 = scaleMap().p1();
     const double deg2 = scaleMap().p2();
 
-    const int a1 = qRound( qMin( deg1, deg2 ) - 90 );
-    const int a2 = qRound( qMax( deg1, deg2 ) - 90 );
-
-    const double radius = d_data->radius;
-    const double x = d_data->center.x() - radius;
-    const double y = d_data->center.y() - radius;
+    const int a1 = qRound( qwtMinF( deg1, deg2 ) - 90 );
+    const int a2 = qRound( qwtMaxF( deg1, deg2 ) - 90 );
+
+    const double radius = m_data->radius;
+    const double x = m_data->center.x() - radius;
+    const double y = m_data->center.y() - radius;
 
     painter->drawArc( QRectF( x, y, 2 * radius, 2 * radius ),
@@ -253,6 +252,6 @@
             calculates only an upper limit, that might be a
             few pixels too large
-*/
-double QwtRoundScaleDraw::extent( const QFont &font ) const
+ */
+double QwtRoundScaleDraw::extent( const QFont& font ) const
 {
     double d = 0.0;
@@ -260,6 +259,6 @@
     if ( hasComponent( QwtAbstractScaleDraw::Labels ) )
     {
-        const QwtScaleDiv &sd = scaleDiv();
-        const QList<double> &ticks = sd.ticks( QwtScaleDiv::MajorTick );
+        const QwtScaleDiv& sd = scaleDiv();
+        const QList< double >& ticks = sd.ticks( QwtScaleDiv::MajorTick );
         for ( int i = 0; i < ticks.count(); i++ )
         {
@@ -269,6 +268,6 @@
 
             const double tval = scaleMap().transform( value );
-            if ( ( tval < d_data->startAngle + 360 )
-                && ( tval > d_data->startAngle - 360 ) )
+            if ( ( tval < m_data->startAngle + 360 )
+                && ( tval > m_data->startAngle - 360 ) )
             {
                 const QwtText label = tickLabel( font, value );
@@ -281,8 +280,8 @@
                 const double off = qMax( sz.width(), sz.height() );
 
-                double x = off * qSin( arc );
-                double y = off * qCos( arc );
-
-                const double dist = qSqrt( x * x + y * y );
+                double x = off * std::sin( arc );
+                double y = off * std::cos( arc );
+
+                const double dist = std::sqrt( x * x + y * y );
                 if ( dist > d )
                     d = dist;
@@ -298,16 +297,15 @@
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
     {
-        const double pw = qMax( 1, penWidth() );  // pen width can be zero
-        d += pw;
+        d += qwtMaxF( penWidthF(), 1.0 );
     }
 
     if ( hasComponent( QwtAbstractScaleDraw::Labels ) &&
         ( hasComponent( QwtAbstractScaleDraw::Ticks ) ||
-            hasComponent( QwtAbstractScaleDraw::Backbone ) ) )
+        hasComponent( QwtAbstractScaleDraw::Backbone ) ) )
     {
         d += spacing();
     }
 
-    d = qMax( d, minimumExtent() );
+    d = qwtMaxF( d, minimumExtent() );
 
     return d;
