Index: trunk/BNC/qwt/qwt_plot_textlabel.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_textlabel.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_textlabel.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,11 +10,13 @@
 #include "qwt_plot_textlabel.h"
 #include "qwt_painter.h"
-#include "qwt_scale_map.h"
+#include "qwt_text.h"
+#include "qwt_math.h"
+
 #include <qpainter.h>
+#include <qpaintengine.h>
 #include <qpixmap.h>
-#include <qmath.h>
 
 static QRect qwtItemRect( int renderFlags,
-    const QRectF &rect, const QSizeF &itemSize )
+    const QRectF& rect, const QSizeF& itemSize )
 {
     int x;
@@ -51,7 +53,7 @@
 class QwtPlotTextLabel::PrivateData
 {
-public:
-    PrivateData():
-        margin( 5 )
+  public:
+    PrivateData()
+        : margin( 5 )
     {
     }
@@ -76,10 +78,10 @@
 
    \sa QwtPlotItem::setItemAttribute(), QwtPlotItem::setZ()
-*/
-
-QwtPlotTextLabel::QwtPlotTextLabel():
-    QwtPlotItem( QwtText( "Label" ) )
-{
-    d_data = new PrivateData;
+ */
+
+QwtPlotTextLabel::QwtPlotTextLabel()
+    : QwtPlotItem( QwtText( "Label" ) )
+{
+    m_data = new PrivateData;
 
     setItemAttribute( QwtPlotItem::AutoScale, false );
@@ -92,5 +94,5 @@
 QwtPlotTextLabel::~QwtPlotTextLabel()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -102,18 +104,18 @@
 
 /*!
-  Set the text
-
-  The label will be aligned to the plot canvas according to
-  the alignment flags of text.
-
-  \param text Text to be displayed
-
-  \sa text(), QwtText::renderFlags()
-*/
-void QwtPlotTextLabel::setText( const QwtText &text )
-{
-    if ( d_data->text != text )
-    {
-        d_data->text = text;
+   Set the text
+
+   The label will be aligned to the plot canvas according to
+   the alignment flags of text.
+
+   \param text Text to be displayed
+
+   \sa text(), QwtText::renderFlags()
+ */
+void QwtPlotTextLabel::setText( const QwtText& text )
+{
+    if ( m_data->text != text )
+    {
+        m_data->text = text;
 
         invalidateCache();
@@ -123,29 +125,29 @@
 
 /*!
-  \return Text to be displayed
-  \sa setText()
-*/
+   \return Text to be displayed
+   \sa setText()
+ */
 QwtText QwtPlotTextLabel::text() const
 {
-    return d_data->text;
-}
-
-/*!
-  Set the margin
-
-  The margin is the distance between the contentsRect()
-  of the plot canvas and the rectangle where the label can
-  be displayed.
-
-  \param margin Margin
-
-  \sa margin(), textRect()
+    return m_data->text;
+}
+
+/*!
+   Set the margin
+
+   The margin is the distance between the contentsRect()
+   of the plot canvas and the rectangle where the label can
+   be displayed.
+
+   \param margin Margin
+
+   \sa margin(), textRect()
  */
 void QwtPlotTextLabel::setMargin( int margin )
 {
     margin = qMax( margin, 0 );
-    if ( d_data->margin != margin )
-    {
-        d_data->margin = margin;
+    if ( m_data->margin != margin )
+    {
+        m_data->margin = margin;
         itemChanged();
     }
@@ -153,34 +155,34 @@
 
 /*!
-  \return Margin added to the contentsMargins() of the canvas
-  \sa setMargin()
-*/
+   \return Margin added to the contentsMargins() of the canvas
+   \sa setMargin()
+ */
 int QwtPlotTextLabel::margin() const
 {
-    return d_data->margin;
-}
-
-/*!
-  Draw the text label
-
-  \param painter Painter
-  \param xMap x Scale Map
-  \param yMap y Scale Map
-  \param canvasRect Contents rectangle of the canvas in painter coordinates
-
-  \sa textRect()
-*/
-
-void QwtPlotTextLabel::draw( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect ) const
+    return m_data->margin;
+}
+
+/*!
+   Draw the text label
+
+   \param painter Painter
+   \param xMap x Scale Map
+   \param yMap y Scale Map
+   \param canvasRect Contents rectangle of the canvas in painter coordinates
+
+   \sa textRect()
+ */
+
+void QwtPlotTextLabel::draw( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect ) const
 {
     Q_UNUSED( xMap );
     Q_UNUSED( yMap );
 
-    const int m = d_data->margin;
+    const int m = m_data->margin;
 
     const QRectF rect = textRect( canvasRect.adjusted( m, m, -m, -m ),
-        d_data->text.textSize( painter->font() ) );
+        m_data->text.textSize( painter->font() ) );
 
     bool doCache = QwtPainter::roundingAlignment( painter );
@@ -208,42 +210,41 @@
 
         int pw = 0;
-        if ( d_data->text.borderPen().style() != Qt::NoPen )
-            pw = qMax( d_data->text.borderPen().width(), 1 );
+        if ( m_data->text.borderPen().style() != Qt::NoPen )
+            pw = qMax( m_data->text.borderPen().width(), 1 );
 
         QRect pixmapRect;
-        pixmapRect.setLeft( qFloor( rect.left() ) - pw );
-        pixmapRect.setTop( qFloor( rect.top() ) - pw );
-        pixmapRect.setRight( qCeil( rect.right() ) + pw );
-        pixmapRect.setBottom( qCeil( rect.bottom() ) + pw );
-
-#define QWT_HIGH_DPI 1
-
-#if QT_VERSION >= 0x050100 && QWT_HIGH_DPI
-        const qreal pixelRatio = painter->device()->devicePixelRatio();
+        pixmapRect.setLeft( qwtFloor( rect.left() ) - pw );
+        pixmapRect.setTop( qwtFloor( rect.top() ) - pw );
+        pixmapRect.setRight( qwtCeil( rect.right() ) + pw );
+        pixmapRect.setBottom( qwtCeil( rect.bottom() ) + pw );
+
+#if QT_VERSION >= 0x050000
+        const qreal pixelRatio = QwtPainter::devicePixelRatio( painter->device() );
         const QSize scaledSize = pixmapRect.size() * pixelRatio;
 #else
         const QSize scaledSize = pixmapRect.size();
 #endif
-        if ( d_data->pixmap.isNull() ||
-            ( scaledSize != d_data->pixmap.size() )  )
+
+        if ( m_data->pixmap.isNull() ||
+            ( scaledSize != m_data->pixmap.size() ) )
         {
-            d_data->pixmap = QPixmap( scaledSize );
-#if QT_VERSION >= 0x050100 && QWT_HIGH_DPI
-            d_data->pixmap.setDevicePixelRatio( pixelRatio );
+            m_data->pixmap = QPixmap( scaledSize );
+#if QT_VERSION >= 0x050000
+            m_data->pixmap.setDevicePixelRatio( pixelRatio );
 #endif
-            d_data->pixmap.fill( Qt::transparent );
+            m_data->pixmap.fill( Qt::transparent );
 
             const QRect r( pw, pw,
                 pixmapRect.width() - 2 * pw, pixmapRect.height() - 2 * pw );
 
-            QPainter pmPainter( &d_data->pixmap );
-            d_data->text.draw( &pmPainter, r );
+            QPainter pmPainter( &m_data->pixmap );
+            m_data->text.draw( &pmPainter, r );
         }
 
-        painter->drawPixmap( pixmapRect, d_data->pixmap );
+        painter->drawPixmap( pixmapRect, m_data->pixmap );
     }
     else
     {
-        d_data->text.draw( painter, rect );
+        m_data->text.draw( painter, rect );
     }
 }
@@ -261,7 +262,7 @@
  */
 QRectF QwtPlotTextLabel::textRect(
-    const QRectF &rect, const QSizeF &textSize ) const
-{
-    return qwtItemRect( d_data->text.renderFlags(), rect, textSize );
+    const QRectF& rect, const QSizeF& textSize ) const
+{
+    return qwtItemRect( m_data->text.renderFlags(), rect, textSize );
 }
 
@@ -269,4 +270,4 @@
 void QwtPlotTextLabel::invalidateCache()
 {
-    d_data->pixmap = QPixmap();
-}
+    m_data->pixmap = QPixmap();
+}
