Index: trunk/BNC/qwt/qwt_scale_draw.cpp
===================================================================
--- trunk/BNC/qwt/qwt_scale_draw.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_scale_draw.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -13,21 +13,262 @@
 #include "qwt_math.h"
 #include "qwt_painter.h"
-#include <qpen.h>
+#include "qwt_text.h"
+
 #include <qpainter.h>
+#include <qpaintengine.h>
 #include <qmath.h>
 
-#if QT_VERSION < 0x040601
-#define qFastSin(x) qSin(x)
-#define qFastCos(x) qCos(x)
+static inline double qwtEffectivePenWidth( const QwtAbstractScaleDraw* scaleDraw )
+{
+    return qwtMaxF( scaleDraw->penWidthF(), 1.0 );
+}
+
+namespace QwtScaleRendererReal
+{
+    inline qreal penWidth( const QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        qreal width = scaleDraw->penWidthF();
+#if 1
+        if ( width <= 0.0 )
+            width = 1.0;
 #endif
 
+        if ( painter->pen().isCosmetic() )
+        {
+            const QTransform& transform = painter->transform();
+
+            switch ( scaleDraw->alignment() )
+            {
+                case QwtScaleDraw::LeftScale:
+                case QwtScaleDraw::RightScale:
+                {
+                    width /= transform.m11();
+                    break;
+                }
+                case QwtScaleDraw::TopScale:
+                case QwtScaleDraw::BottomScale:
+                {
+                    width /= transform.m22();
+                    break;
+                }
+            }
+        }
+
+        return width;
+    }
+
+    inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        const qreal pw2 = 0.5 * penWidth( painter, scaleDraw );
+
+        const QPointF pos = scaleDraw->pos();
+        const qreal length = scaleDraw->length();
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = pos.x() + 1.0 - pw2;
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = pos.x() - 1.0 + pw2;
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = pos.y() + 1.0 - pw2;
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = pos.y() - 1.0 + pw2;
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+        }
+    }
+
+    inline void drawTick( QPainter* painter,
+        const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
+    {
+        const QPointF pos = scaleDraw->pos();
+
+        qreal pw = 0.0;
+
+        if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
+            pw = penWidth( painter, scaleDraw );
+
+        const qreal length = tickLength + pw;
+
+        /*
+            Those correction offsets have been found by try and error.
+            They need to be understood and replaced by a calculation,
+            that makes sense. TODO ...
+         */
+        const qreal off1 = 1.0;
+        const qreal off2 = ( scaleDraw->penWidthF() <= 0.0 ) ? 0.5 : 0.0;
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = pos.x() + off1 - off2;
+                QwtPainter::drawLine( painter, x, tickPos, x - length, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = pos.x() - off1 + off2;
+                QwtPainter::drawLine( painter, x, tickPos, x + length, tickPos );
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = pos.y() + off1 - 2 * off2;
+                QwtPainter::drawLine( painter, tickPos, y, tickPos, y - length );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = pos.y() - off1 + off2;
+                QwtPainter::drawLine( painter, tickPos, y, tickPos, y + length );
+
+                break;
+            }
+        }
+    }
+}
+
+namespace QwtScaleRendererInt
+{
+    inline void drawBackbone( QPainter* painter, const QwtScaleDraw* scaleDraw )
+    {
+        const int pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
+
+        const qreal length = scaleDraw->length();
+        const QPointF pos = scaleDraw->pos();
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x = qRound( pos.x() - ( pw - 1 ) / 2 );
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x = qRound( pos.x() + pw / 2 );
+                QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + length );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y = qRound( pos.y() - ( pw - 1 ) / 2 );
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y = qRound( pos.y() + pw / 2 );
+                QwtPainter::drawLine( painter, pos.x(), y, pos.x() + length, y );
+
+                break;
+            }
+        }
+    }
+
+    inline void drawTick( QPainter* painter,
+        const QwtScaleDraw* scaleDraw, qreal tickPos, qreal tickLength )
+    {
+        const QPointF pos = scaleDraw->pos();
+        tickPos = qRound( tickPos );
+
+        int pw = 0;
+        if ( scaleDraw->hasComponent( QwtScaleDraw::Backbone ) )
+            pw = qMax( qRound( scaleDraw->penWidthF() ), 1 );
+
+        int len = qMax( qRound( tickLength ), 1 );
+
+        // the width of ticks at the borders might extent the backbone
+        len += pw;
+
+        if ( painter->pen().capStyle() == Qt::FlatCap )
+            len++; // the end point is not rendered
+
+        qreal off = 0.0;
+
+        if ( painter->paintEngine()->type() == QPaintEngine::X11 )
+        {
+            if ( pw == 1 )
+            {
+                // In opposite to raster, X11 paints the end point
+                off = 1.0;
+            }
+        }
+
+        switch ( scaleDraw->alignment() )
+        {
+            case QwtScaleDraw::LeftScale:
+            {
+                const qreal x1 = qRound( pos.x() ) + 1;
+                const qreal x2 = x1 - len + 1;
+
+                QwtPainter::drawLine( painter, x2, tickPos, x1 - off, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::RightScale:
+            {
+                const qreal x1 = qRound( pos.x() );
+                const qreal x2 = x1 + len - 1;
+
+                QwtPainter::drawLine( painter, x1, tickPos, x2 - off, tickPos );
+
+                break;
+            }
+            case QwtScaleDraw::BottomScale:
+            {
+                const qreal y1 = qRound( pos.y() );
+                const qreal y2 = y1 + len - 1;
+
+                QwtPainter::drawLine( painter, tickPos, y1, tickPos, y2 - off );
+
+                break;
+            }
+            case QwtScaleDraw::TopScale:
+            {
+                const qreal y1 = qRound( pos.y() );
+                const qreal y2 = y1 - len + 1;
+
+                QwtPainter::drawLine( painter, tickPos, y2 + 1, tickPos, y1 + 1 - off );
+
+                break;
+            }
+        }
+    }
+}
+
 class QwtScaleDraw::PrivateData
 {
-public:
-    PrivateData():
-        len( 0 ),
-        alignment( QwtScaleDraw::BottomScale ),
-        labelAlignment( 0 ),
-        labelRotation( 0.0 )
+  public:
+    PrivateData()
+        : len( 0 )
+        , alignment( QwtScaleDraw::BottomScale )
+        , labelRotation( 0.0 )
     {
     }
@@ -43,13 +284,13 @@
 
 /*!
-  \brief Constructor
-
-  The range of the scale is initialized to [0, 100],
-  The position is at (0, 0) with a length of 100.
-  The orientation is QwtAbstractScaleDraw::Bottom.
-*/
+   \brief Constructor
+
+   The range of the scale is initialized to [0, 100],
+   The position is at (0, 0) with a length of 100.
+   The orientation is QwtAbstractScaleDraw::Bottom.
+ */
 QwtScaleDraw::QwtScaleDraw()
 {
-    d_data = new QwtScaleDraw::PrivateData;
+    m_data = new QwtScaleDraw::PrivateData;
     setLength( 100 );
 }
@@ -58,5 +299,5 @@
 QwtScaleDraw::~QwtScaleDraw()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -65,8 +306,8 @@
    \sa setAlignment()
    \return Alignment of the scale
-*/
+ */
 QwtScaleDraw::Alignment QwtScaleDraw::alignment() const
 {
-    return d_data->alignment;
+    return m_data->alignment;
 }
 
@@ -78,23 +319,23 @@
    The default alignment is QwtScaleDraw::BottomScale
    \sa alignment()
-*/
+ */
 void QwtScaleDraw::setAlignment( Alignment align )
 {
-    d_data->alignment = align;
-}
-
-/*!
-  Return the orientation
-
-  TopScale, BottomScale are horizontal (Qt::Horizontal) scales,
-  LeftScale, RightScale are vertical (Qt::Vertical) scales.
-
-  \return Orientation of the scale
-
-  \sa alignment()
-*/
+    m_data->alignment = align;
+}
+
+/*!
+   Return the orientation
+
+   TopScale, BottomScale are horizontal (Qt::Horizontal) scales,
+   LeftScale, RightScale are vertical (Qt::Vertical) scales.
+
+   \return Orientation of the scale
+
+   \sa alignment()
+ */
 Qt::Orientation QwtScaleDraw::orientation() const
 {
-    switch ( d_data->alignment )
+    switch ( m_data->alignment )
     {
         case TopScale:
@@ -109,15 +350,15 @@
 
 /*!
-  \brief Determine the minimum border distance
-
-  This member function returns the minimum space
-  needed to draw the mark labels at the scale's endpoints.
-
-  \param font Font
-  \param start Start border distance
-  \param end End border distance
-*/
+   \brief Determine the minimum border distance
+
+   This member function returns the minimum space
+   needed to draw the mark labels at the scale's endpoints.
+
+   \param font Font
+   \param start Start border distance
+   \param end End border distance
+ */
 void QwtScaleDraw::getBorderDistHint(
-    const QFont &font, int &start, int &end ) const
+    const QFont& font, int& start, int& end ) const
 {
     start = 0;
@@ -127,5 +368,5 @@
         return;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     if ( ticks.count() == 0 )
         return;
@@ -179,24 +420,24 @@
         e = 0.0;
 
-    start = qCeil( s );
-    end = qCeil( e );
-}
-
-/*!
-  Determine the minimum distance between two labels, that is necessary
-  that the texts don't overlap.
-
-  \param font Font
-  \return The maximum width of a label
-
-  \sa getBorderDistHint()
-*/
-
-int QwtScaleDraw::minLabelDist( const QFont &font ) const
+    start = qwtCeil( s );
+    end = qwtCeil( e );
+}
+
+/*!
+   Determine the minimum distance between two labels, that is necessary
+   that the texts don't overlap.
+
+   \param font Font
+   \return The maximum width of a label
+
+   \sa getBorderDistHint()
+ */
+
+int QwtScaleDraw::minLabelDist( const QFont& font ) const
 {
     if ( !hasComponent( QwtAbstractScaleDraw::Labels ) )
         return 0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     if ( ticks.isEmpty() )
         return 0;
@@ -279,6 +520,6 @@
 
    \sa minLength()
-*/
-double QwtScaleDraw::extent( const QFont &font ) const
+ */
+double QwtScaleDraw::extent( const QFont& font ) const
 {
     double d = 0;
@@ -302,9 +543,8 @@
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
     {
-        const double pw = qMax( 1, penWidth() );  // pen width can be zero
-        d += pw;
-    }
-
-    d = qMax( d, minimumExtent() );
+        d += qwtEffectivePenWidth( this );
+    }
+
+    d = qwtMaxF( d, minimumExtent() );
     return d;
 }
@@ -317,11 +557,11 @@
 
    \sa extent()
-*/
-int QwtScaleDraw::minLength( const QFont &font ) const
+ */
+int QwtScaleDraw::minLength( const QFont& font ) const
 {
     int startDist, endDist;
     getBorderDistHint( font, startDist, endDist );
 
-    const QwtScaleDiv &sd = scaleDiv();
+    const QwtScaleDiv& sd = scaleDiv();
 
     const uint minorCount =
@@ -338,5 +578,5 @@
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
     {
-        const double pw = qMax( 1, penWidth() );  // penwidth can be zero
+        const double pw = qwtEffectivePenWidth( this );
         lengthForTicks = qCeil( ( majorCount + minorCount ) * ( pw + 1.0 ) );
     }
@@ -353,5 +593,5 @@
    \param value Value
    \return Position, where to paint a label
-*/
+ */
 QPointF QwtScaleDraw::labelPosition( double value ) const
 {
@@ -359,5 +599,5 @@
     double dist = spacing();
     if ( hasComponent( QwtAbstractScaleDraw::Backbone ) )
-        dist += qMax( 1, penWidth() );
+        dist += qwtEffectivePenWidth( this );
 
     if ( hasComponent( QwtAbstractScaleDraw::Ticks ) )
@@ -371,5 +611,5 @@
         case RightScale:
         {
-            px = d_data->pos.x() + dist;
+            px = m_data->pos.x() + dist;
             py = tval;
             break;
@@ -377,5 +617,5 @@
         case LeftScale:
         {
-            px = d_data->pos.x() - dist;
+            px = m_data->pos.x() - dist;
             py = tval;
             break;
@@ -384,5 +624,5 @@
         {
             px = tval;
-            py = d_data->pos.y() + dist;
+            py = m_data->pos.y() + dist;
             break;
         }
@@ -390,5 +630,5 @@
         {
             px = tval;
-            py = d_data->pos.y() - dist;
+            py = m_data->pos.y() - dist;
             break;
         }
@@ -406,81 +646,16 @@
 
    \sa drawBackbone(), drawLabel()
-*/
-void QwtScaleDraw::drawTick( QPainter *painter, double value, double len ) const
+ */
+void QwtScaleDraw::drawTick( QPainter* painter, double value, double len ) const
 {
     if ( len <= 0 )
         return;
 
-    const bool roundingAlignment = QwtPainter::roundingAlignment( painter );
-
-    QPointF pos = d_data->pos;
-
-    double tval = scaleMap().transform( value );
-    if ( roundingAlignment )
-        tval = qRound( tval );
-
-    const int pw = penWidth();
-    int a = 0;
-    if ( pw > 1 && roundingAlignment )
-        a = 1;
-
-    switch ( alignment() )
-    {
-        case LeftScale:
-        {
-            double x1 = pos.x() + a;
-            double x2 = pos.x() + a - pw - len;
-            if ( roundingAlignment )
-            {
-                x1 = qRound( x1 );
-                x2 = qRound( x2 );
-            }
-
-            QwtPainter::drawLine( painter, x1, tval, x2, tval );
-            break;
-        }
-
-        case RightScale:
-        {
-            double x1 = pos.x();
-            double x2 = pos.x() + pw + len;
-            if ( roundingAlignment )
-            {
-                x1 = qRound( x1 );
-                x2 = qRound( x2 );
-            }
-
-            QwtPainter::drawLine( painter, x1, tval, x2, tval );
-            break;
-        }
-
-        case BottomScale:
-        {
-            double y1 = pos.y();
-            double y2 = pos.y() + pw + len;
-            if ( roundingAlignment )
-            {
-                y1 = qRound( y1 );
-                y2 = qRound( y2 );
-            }
-
-            QwtPainter::drawLine( painter, tval, y1, tval, y2 );
-            break;
-        }
-
-        case TopScale:
-        {
-            double y1 = pos.y() + a;
-            double y2 = pos.y() - pw - len + a;
-            if ( roundingAlignment )
-            {
-                y1 = qRound( y1 );
-                y2 = qRound( y2 );
-            }
-
-            QwtPainter::drawLine( painter, tval, y1, tval, y2 );
-            break;
-        }
-    }
+    const double tval = scaleMap().transform( value );
+
+    if ( QwtPainter::roundingAlignment( painter ) )
+        QwtScaleRendererInt::drawTick( painter, this, tval, len );
+    else
+        QwtScaleRendererReal::drawTick( painter, this, tval, len );
 }
 
@@ -490,105 +665,47 @@
 
    \sa drawTick(), drawLabel()
-*/
-void QwtScaleDraw::drawBackbone( QPainter *painter ) const
-{
-    const bool doAlign = QwtPainter::roundingAlignment( painter );
-
-    const QPointF &pos = d_data->pos;
-    const double len = d_data->len;
-    const int pw = qMax( penWidth(), 1 );
-
-    // pos indicates a border not the center of the backbone line
-    // so we need to shift its position depending on the pen width
-    // and the alignment of the scale
-
-    double off;
-    if ( doAlign )
-    {
-        if ( alignment() == LeftScale || alignment() == TopScale )
-            off = ( pw - 1 ) / 2;
-        else
-            off = pw / 2;
-    }
+ */
+void QwtScaleDraw::drawBackbone( QPainter* painter ) const
+{
+    if ( QwtPainter::roundingAlignment( painter ) )
+        QwtScaleRendererInt::drawBackbone( painter, this );
     else
-    {
-        off = 0.5 * penWidth();
-    }
-
-    switch ( alignment() )
-    {
-        case LeftScale:
-        {
-            double x = pos.x() - off;
-            if ( doAlign )
-                x = qRound( x );
-
-            QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + len );
-            break;
-        }
-        case RightScale:
-        {
-            double x = pos.x() + off;
-            if ( doAlign )
-                x = qRound( x );
-
-            QwtPainter::drawLine( painter, x, pos.y(), x, pos.y() + len );
-            break;
-        }
-        case TopScale:
-        {
-            double y = pos.y() - off;
-            if ( doAlign )
-                y = qRound( y );
-
-            QwtPainter::drawLine( painter, pos.x(), y, pos.x() + len, y );
-            break;
-        }
-        case BottomScale:
-        {
-            double y = pos.y() + off;
-            if ( doAlign )
-                y = qRound( y );
-
-            QwtPainter::drawLine( painter, pos.x(), y, pos.x() + len, y );
-            break;
-        }
-    }
-}
-
-/*!
-  \brief Move the position of the scale
-
-  The meaning of the parameter pos depends on the alignment:
-  <dl>
-  <dt>QwtScaleDraw::LeftScale
-  <dd>The origin is the topmost point of the
+        QwtScaleRendererReal::drawBackbone( painter, this );
+}
+
+/*!
+   \brief Move the position of the scale
+
+   The meaning of the parameter pos depends on the alignment:
+   <dl>
+   <dt>QwtScaleDraw::LeftScale
+   <dd>The origin is the topmost point of the
       backbone. The backbone is a vertical line.
       Scale marks and labels are drawn
       at the left of the backbone.
-  <dt>QwtScaleDraw::RightScale
-  <dd>The origin is the topmost point of the
+   <dt>QwtScaleDraw::RightScale
+   <dd>The origin is the topmost point of the
       backbone. The backbone is a vertical line.
       Scale marks and labels are drawn
       at the right of the backbone.
-  <dt>QwtScaleDraw::TopScale
-  <dd>The origin is the leftmost point of the
+   <dt>QwtScaleDraw::TopScale
+   <dd>The origin is the leftmost point of the
       backbone. The backbone is a horizontal line.
       Scale marks and labels are drawn
       above the backbone.
-  <dt>QwtScaleDraw::BottomScale
-  <dd>The origin is the leftmost point of the
+   <dt>QwtScaleDraw::BottomScale
+   <dd>The origin is the leftmost point of the
       backbone. The backbone is a horizontal line
       Scale marks and labels are drawn
       below the backbone.
-  </dl>
-
-  \param pos Origin of the scale
-
-  \sa pos(), setLength()
-*/
-void QwtScaleDraw::move( const QPointF &pos )
-{
-    d_data->pos = pos;
+   </dl>
+
+   \param pos Origin of the scale
+
+   \sa pos(), setLength()
+ */
+void QwtScaleDraw::move( const QPointF& pos )
+{
+    m_data->pos = pos;
     updateMap();
 }
@@ -597,34 +714,30 @@
    \return Origin of the scale
    \sa move(), length()
-*/
+ */
 QPointF QwtScaleDraw::pos() const
 {
-    return d_data->pos;
-}
-
-/*!
-  Set the length of the backbone.
-
-  The length doesn't include the space needed for
-  overlapping labels.
-
-  \param length Length of the backbone
-
-  \sa move(), minLabelDist()
-*/
+    return m_data->pos;
+}
+
+/*!
+   Set the length of the backbone.
+
+   The length doesn't include the space needed for
+   overlapping labels.
+
+   \param length Length of the backbone
+
+   \sa move(), minLabelDist()
+ */
 void QwtScaleDraw::setLength( double length )
 {
-#if 1
     if ( length >= 0 && length < 10 )
         length = 10;
 
-    // why should we accept negative lengths ???
+    // f.e the left/bottom scales of a polar plot
     if ( length < 0 && length > -10 )
         length = -10;
-#else
-    length = qMax( length, 10 );
-#endif
-
-    d_data->len = length;
+
+    m_data->len = length;
     updateMap();
 }
@@ -633,8 +746,8 @@
    \return the length of the backbone
    \sa setLength(), pos()
-*/
+ */
 double QwtScaleDraw::length() const
 {
-    return d_data->len;
+    return m_data->len;
 }
 
@@ -646,6 +759,6 @@
 
    \sa drawTick(), drawBackbone(), boundingLabelRect()
-*/
-void QwtScaleDraw::drawLabel( QPainter *painter, double value ) const
+ */
+void QwtScaleDraw::drawLabel( QPainter* painter, double value ) const
 {
     QwtText lbl = tickLabel( painter->font(), value );
@@ -668,16 +781,16 @@
 
 /*!
-  \brief Find the bounding rectangle for the label.
-
-  The coordinates of the rectangle are absolute ( calculated from pos() ).
-  in direction of the tick.
-
-  \param font Font used for painting
-  \param value Value
-
-  \return Bounding rectangle
-  \sa labelRect()
-*/
-QRect QwtScaleDraw::boundingLabelRect( const QFont &font, double value ) const
+   \brief Find the bounding rectangle for the label.
+
+   The coordinates of the rectangle are absolute ( calculated from pos() ).
+   in direction of the tick.
+
+   \param font Font used for painting
+   \param value Value
+
+   \return Bounding rectangle
+   \sa labelRect()
+ */
+QRect QwtScaleDraw::boundingLabelRect( const QFont& font, double value ) const
 {
     QwtText lbl = tickLabel( font, value );
@@ -701,7 +814,7 @@
    \return Transformation matrix
    \sa setLabelAlignment(), setLabelRotation()
-*/
+ */
 QTransform QwtScaleDraw::labelTransformation(
-    const QPointF &pos, const QSizeF &size ) const
+    const QPointF& pos, const QSizeF& size ) const
 {
     QTransform transform;
@@ -763,14 +876,14 @@
 
 /*!
-  Find the bounding rectangle for the label. The coordinates of
-  the rectangle are relative to spacing + tick length from the backbone
-  in direction of the tick.
-
-  \param font Font used for painting
-  \param value Value
+   Find the bounding rectangle for the label. The coordinates of
+   the rectangle are relative to spacing + tick length from the backbone
+   in direction of the tick.
+
+   \param font Font used for painting
+   \param value Value
 
    \return Bounding rectangle that is needed to draw a label
-*/
-QRectF QwtScaleDraw::labelRect( const QFont &font, double value ) const
+ */
+QRectF QwtScaleDraw::labelRect( const QFont& font, double value ) const
 {
     QwtText lbl = tickLabel( font, value );
@@ -796,6 +909,6 @@
 
    \return Size that is needed to draw a label
-*/
-QSizeF QwtScaleDraw::labelSize( const QFont &font, double value ) const
+ */
+QSizeF QwtScaleDraw::labelSize( const QFont& font, double value ) const
 {
     return labelRect( font, value ).size();
@@ -803,38 +916,38 @@
 
 /*!
-  Rotate all labels.
-
-  When changing the rotation, it might be necessary to
-  adjust the label flags too. Finding a useful combination is
-  often the result of try and error.
-
-  \param rotation Angle in degrees. When changing the label rotation,
+   Rotate all labels.
+
+   When changing the rotation, it might be necessary to
+   adjust the label flags too. Finding a useful combination is
+   often the result of try and error.
+
+   \param rotation Angle in degrees. When changing the label rotation,
                   the label flags often needs to be adjusted too.
 
-  \sa setLabelAlignment(), labelRotation(), labelAlignment().
-
-*/
+   \sa setLabelAlignment(), labelRotation(), labelAlignment().
+
+ */
 void QwtScaleDraw::setLabelRotation( double rotation )
 {
-    d_data->labelRotation = rotation;
-}
-
-/*!
-  \return the label rotation
-  \sa setLabelRotation(), labelAlignment()
-*/
+    m_data->labelRotation = rotation;
+}
+
+/*!
+   \return the label rotation
+   \sa setLabelRotation(), labelAlignment()
+ */
 double QwtScaleDraw::labelRotation() const
 {
-    return d_data->labelRotation;
-}
-
-/*!
-  \brief Change the label flags
-
-  Labels are aligned to the point tick length + spacing away from the backbone.
-
-  The alignment is relative to the orientation of the label text.
-  In case of an flags of 0 the label will be aligned
-  depending on the orientation of the scale:
+    return m_data->labelRotation;
+}
+
+/*!
+   \brief Change the label flags
+
+   Labels are aligned to the point tick length + spacing away from the backbone.
+
+   The alignment is relative to the orientation of the label text.
+   In case of an flags of 0 the label will be aligned
+   depending on the orientation of the scale:
 
       QwtScaleDraw::TopScale: Qt::AlignHCenter | Qt::AlignTop\n
@@ -843,38 +956,38 @@
       QwtScaleDraw::RightScale: Qt::AlignRight | Qt::AlignVCenter\n
 
-  Changing the alignment is often necessary for rotated labels.
-
-  \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
-
-  \sa setLabelRotation(), labelRotation(), labelAlignment()
-  \warning The various alignments might be confusing.
+   Changing the alignment is often necessary for rotated labels.
+
+   \param alignment Or'd Qt::AlignmentFlags see <qnamespace.h>
+
+   \sa setLabelRotation(), labelRotation(), labelAlignment()
+   \warning The various alignments might be confusing.
            The alignment of the label is not the alignment
            of the scale and is not the alignment of the flags
            ( QwtText::flags() ) returned from QwtAbstractScaleDraw::label().
-*/
+ */
 
 void QwtScaleDraw::setLabelAlignment( Qt::Alignment alignment )
 {
-    d_data->labelAlignment = alignment;
-}
-
-/*!
-  \return the label flags
-  \sa setLabelAlignment(), labelRotation()
-*/
+    m_data->labelAlignment = alignment;
+}
+
+/*!
+   \return the label flags
+   \sa setLabelAlignment(), labelRotation()
+ */
 Qt::Alignment QwtScaleDraw::labelAlignment() const
 {
-    return d_data->labelAlignment;
-}
-
-/*!
-  \param font Font
-  \return the maximum width of a label
-*/
-int QwtScaleDraw::maxLabelWidth( const QFont &font ) const
+    return m_data->labelAlignment;
+}
+
+/*!
+   \param font Font
+   \return the maximum width of a label
+ */
+int QwtScaleDraw::maxLabelWidth( const QFont& font ) const
 {
     double maxWidth = 0.0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -892,12 +1005,12 @@
 
 /*!
-  \param font Font
-  \return the maximum height of a label
-*/
-int QwtScaleDraw::maxLabelHeight( const QFont &font ) const
+   \param font Font
+   \return the maximum height of a label
+ */
+int QwtScaleDraw::maxLabelHeight( const QFont& font ) const
 {
     double maxHeight = 0.0;
 
-    const QList<double> &ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
+    const QList< double >& ticks = scaleDiv().ticks( QwtScaleDiv::MajorTick );
     for ( int i = 0; i < ticks.count(); i++ )
     {
@@ -916,8 +1029,8 @@
 void QwtScaleDraw::updateMap()
 {
-    const QPointF pos = d_data->pos;
-    double len = d_data->len;
-
-    QwtScaleMap &sm = scaleMap();
+    const QPointF pos = m_data->pos;
+    double len = m_data->len;
+
+    QwtScaleMap& sm = scaleMap();
     if ( orientation() == Qt::Vertical )
         sm.setPaintInterval( pos.y() + len, pos.y() );
