Index: trunk/BNC/qwt/qwt_dial_needle.cpp
===================================================================
--- trunk/BNC/qwt/qwt_dial_needle.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_dial_needle.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,31 +9,25 @@
 
 #include "qwt_dial_needle.h"
-#include "qwt_global.h"
 #include "qwt_math.h"
-#include "qwt_painter.h"
+
 #include <qapplication.h>
 #include <qpainter.h>
 #include <qpainterpath.h>
-
-#if QT_VERSION < 0x040601
-#define qFastSin(x) qSin(x)
-#define qFastCos(x) qCos(x)
-#endif
-
-static void qwtDrawStyle1Needle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length )
-{
-    const double r[] = { 0.4, 0.3, 1, 0.8, 1, 0.3, 0.4 };
-    const double a[] = { -45, -20, -15, 0, 15, 20, 45 };
+#include <qmath.h>
+
+static void qwtDrawStyle1Needle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal r[] = { 0.4, 0.3, 1, 0.8, 1, 0.3, 0.4 };
+    const qreal a[] = { -45, -20, -15, 0, 15, 20, 45 };
 
     QPainterPath path;
     for ( int i = 0; i < 7; i++ )
     {
-        const double angle = a[i] / 180.0 * M_PI;
-        const double radius = r[i] * length;
-
-        const double x = radius * qFastCos( angle );
-        const double y = radius * qFastSin( angle );
+        const qreal angle = a[i] / 180.0 * M_PI;
+        const qreal radius = r[i] * length;
+
+        const qreal x = radius * qFastCos( angle );
+        const qreal y = radius * qFastSin( angle );
 
         path.lineTo( x, -y );
@@ -45,9 +39,9 @@
 }
 
-static void qwtDrawStyle2Needle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup, double length )
-{
-    const double ratioX = 0.7;
-    const double ratioY = 0.3;
+static void qwtDrawStyle2Needle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal ratioX = 0.7;
+    const qreal ratioY = 0.3;
 
     QPainterPath path1;
@@ -68,11 +62,11 @@
 }
 
-static void qwtDrawShadedPointer( QPainter *painter,
-    const QColor &lightColor, const QColor &darkColor,
-    double length, double width )
-{
-    const double peak = qMax( length / 10.0, 5.0 );
-
-    const double knobWidth = width + 8;
+static void qwtDrawShadedPointer( QPainter* painter,
+    const QColor& lightColor, const QColor& darkColor,
+    qreal length, qreal width )
+{
+    const qreal peak = qwtMaxF( length / 10.0, 5.0 );
+
+    const qreal knobWidth = width + 8;
     QRectF knobRect( 0, 0, knobWidth, knobWidth );
     knobRect.moveCenter( QPointF(0, 0) );
@@ -109,12 +103,12 @@
 }
 
-static void qwtDrawArrowNeedle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length, double width )
+static void qwtDrawArrowNeedle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup,
+    qreal length, qreal width )
 {
     if ( width <= 0 )
-        width = qMax( length * 0.06, 9.0 );
-
-    const double peak = qMax( 2.0, 0.4 * width );
+        width = qwtMaxF( length * 0.06, 9.0 );
+
+    const qreal peak = qwtMaxF( 2.0, 0.4 * width );
 
     QPainterPath path;
@@ -146,9 +140,8 @@
 }
 
-static void qwtDrawTriangleNeedle( QPainter *painter,
-    const QPalette &palette, QPalette::ColorGroup colorGroup,
-    double length )
-{
-    const double width = qRound( length / 3.0 );
+static void qwtDrawTriangleNeedle( QPainter* painter,
+    const QPalette& palette, QPalette::ColorGroup colorGroup, qreal length )
+{
+    const qreal width = qRound( length / 3.0 );
 
     QPainterPath path[4];
@@ -167,5 +160,5 @@
 
 
-    const int colorOffset =  10;
+    const int colorOffset = 10;
     const QColor darkColor = palette.color( colorGroup, QPalette::Dark );
     const QColor lightColor = palette.color( colorGroup, QPalette::Light );
@@ -187,6 +180,6 @@
 
 //! Constructor
-QwtDialNeedle::QwtDialNeedle():
-    d_palette( QApplication::palette() )
+QwtDialNeedle::QwtDialNeedle()
+    : m_palette( QApplication::palette() )
 {
 }
@@ -201,29 +194,29 @@
 
     \param palette New Palette
-*/
-void QwtDialNeedle::setPalette( const QPalette &palette )
-{
-    d_palette = palette;
-}
-
-/*!
-  \return the palette of the needle.
-*/
-const QPalette &QwtDialNeedle::palette() const
-{
-    return d_palette;
-}
-
-/*!
-  Draw the needle
-
-  \param painter Painter
-  \param center Center of the dial, start position for the needle
-  \param length Length of the needle
-  \param direction Direction of the needle, in degrees counter clockwise
-  \param colorGroup Color group, used for painting
-*/
-void QwtDialNeedle::draw( QPainter *painter,
-    const QPointF &center, double length, double direction,
+ */
+void QwtDialNeedle::setPalette( const QPalette& palette )
+{
+    m_palette = palette;
+}
+
+/*!
+   \return the palette of the needle.
+ */
+const QPalette& QwtDialNeedle::palette() const
+{
+    return m_palette;
+}
+
+/*!
+   Draw the needle
+
+   \param painter Painter
+   \param center Center of the dial, start position for the needle
+   \param length Length of the needle
+   \param direction Direction of the needle, in degrees counter clockwise
+   \param colorGroup Color group, used for painting
+ */
+void QwtDialNeedle::draw( QPainter* painter,
+    const QPointF& center, double length, double direction,
     QPalette::ColorGroup colorGroup ) const
 {
@@ -239,6 +232,6 @@
 
 //!  Draw the knob
-void QwtDialNeedle::drawKnob( QPainter *painter,
-    double width, const QBrush &brush, bool sunken ) const
+void QwtDialNeedle::drawKnob( QPainter* painter,
+    double width, const QBrush& brush, bool sunken ) const
 {
     QPalette palette( brush.color() );
@@ -251,5 +244,5 @@
 
     QRectF rect( 0.0, 0.0, width, width );
-    rect.moveCenter( painter->combinedTransform().map( QPointF() ) );
+    rect.moveCenter( painter->transform().map( QPointF() ) );
 
     QLinearGradient gradient( rect.topLeft(), rect.bottomRight() );
@@ -271,16 +264,16 @@
 
 /*!
-  Constructor
-
-  \param style Style
-  \param hasKnob With/Without knob
-  \param mid Middle color
-  \param base Base color
-*/
+   Constructor
+
+   \param style Style
+   \param hasKnob With/Without knob
+   \param mid Middle color
+   \param base Base color
+ */
 QwtDialSimpleNeedle::QwtDialSimpleNeedle( Style style, bool hasKnob,
-        const QColor &mid, const QColor &base ):
-    d_style( style ),
-    d_hasKnob( hasKnob ),
-    d_width( -1 )
+    const QColor& mid, const QColor& base ):
+    m_style( style ),
+    m_hasKnob( hasKnob ),
+    m_width( -1 )
 {
     QPalette palette;
@@ -292,44 +285,44 @@
 
 /*!
-  Set the width of the needle
-  \param width Width
-  \sa width()
-*/
+   Set the width of the needle
+   \param width Width
+   \sa width()
+ */
 void QwtDialSimpleNeedle::setWidth( double width )
 {
-    d_width = width;
-}
-
-/*!
-  \return the width of the needle
-  \sa setWidth()
-*/
+    m_width = width;
+}
+
+/*!
+   \return the width of the needle
+   \sa setWidth()
+ */
 double QwtDialSimpleNeedle::width() const
 {
-    return d_width;
-}
-
-/*!
- Draw the needle
-
- \param painter Painter
- \param length Length of the needle
- \param colorGroup Color group, used for painting
-*/
-void QwtDialSimpleNeedle::drawNeedle( QPainter *painter,
+    return m_width;
+}
+
+/*!
+   Draw the needle
+
+   \param painter Painter
+   \param length Length of the needle
+   \param colorGroup Color group, used for painting
+ */
+void QwtDialSimpleNeedle::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    double knobWidth = 0.0;
-    double width = d_width;
-
-    if ( d_style == Arrow )
+    qreal knobWidth = 0.0;
+    qreal width = m_width;
+
+    if ( m_style == Arrow )
     {
         if ( width <= 0.0 )
-            width = qMax(length * 0.06, 6.0);
+            width = qwtMaxF( length * 0.06, 6.0 );
 
         qwtDrawArrowNeedle( painter,
             palette(), colorGroup, length, width );
 
-        knobWidth = qMin( width * 2.0, 0.2 * length );
+        knobWidth = qwtMinF( width * 2.0, 0.2 * length );
     }
     else
@@ -344,8 +337,8 @@
         painter->drawLine( QPointF( 0.0, 0.0 ), QPointF( length, 0.0 ) );
 
-        knobWidth = qMax( width * 3.0, 5.0 );
-    }
-
-    if ( d_hasKnob && knobWidth > 0.0 )
+        knobWidth = qwtMaxF( width * 3.0, 5.0 );
+    }
+
+    if ( m_hasKnob && knobWidth > 0.0 )
     {
         drawKnob( painter, knobWidth,
@@ -356,6 +349,6 @@
 //! Constructor
 QwtCompassMagnetNeedle::QwtCompassMagnetNeedle( Style style,
-        const QColor &light, const QColor &dark ):
-    d_style( style )
+    const QColor& light, const QColor& dark ):
+    m_style( style )
 {
     QPalette palette;
@@ -373,11 +366,11 @@
     \param length Length of the needle
     \param colorGroup Color group, used for painting
-*/
-void QwtCompassMagnetNeedle::drawNeedle( QPainter *painter,
+ */
+void QwtCompassMagnetNeedle::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_style == ThinStyle )
-    {
-        const double width = qMax( length / 6.0, 3.0 );
+    if ( m_style == ThinStyle )
+    {
+        const qreal width = qwtMaxF( length / 6.0, 3.0 );
 
         const int colorOffset = 10;
@@ -413,8 +406,8 @@
    \param light Light color
    \param dark Dark color
-*/
+ */
 QwtCompassWindArrow::QwtCompassWindArrow( Style style,
-        const QColor &light, const QColor &dark ):
-    d_style( style )
+    const QColor& light, const QColor& dark ):
+    m_style( style )
 {
     QPalette palette;
@@ -426,14 +419,14 @@
 
 /*!
- Draw the needle
-
- \param painter Painter
- \param length Length of the needle
- \param colorGroup Color group, used for painting
-*/
-void QwtCompassWindArrow::drawNeedle( QPainter *painter,
+   Draw the needle
+
+   \param painter Painter
+   \param length Length of the needle
+   \param colorGroup Color group, used for painting
+ */
+void QwtCompassWindArrow::drawNeedle( QPainter* painter,
     double length, QPalette::ColorGroup colorGroup ) const
 {
-    if ( d_style == Style1 )
+    if ( m_style == Style1 )
         qwtDrawStyle1Needle( painter, palette(), colorGroup, length );
     else
