Index: trunk/BNC/qwt/qwt_plot_panner.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_panner.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_panner.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,31 +11,18 @@
 #include "qwt_scale_div.h"
 #include "qwt_plot.h"
+#include "qwt_scale_map.h"
 #include "qwt_painter.h"
+
 #include <qbitmap.h>
 #include <qstyle.h>
 #include <qstyleoption.h>
+#include <qpainter.h>
 #include <qpainterpath.h>
 
+static QBitmap qwtBorderMask( const QWidget* canvas, const QSize& size )
+{
 #if QT_VERSION >= 0x050000
-#if QT_VERSION < 0x050100
-#define QWT_USE_WINDOW_HANDLE 1
+    const qreal pixelRatio = QwtPainter::devicePixelRatio( canvas );
 #endif
-#endif
-
-#ifdef QWT_USE_WINDOW_HANDLE
-#include <qwindow.h>
-#endif
-
-static QBitmap qwtBorderMask( const QWidget *canvas, const QSize &size )
-{
-#if QT_VERSION >= 0x050000
-    qreal pixelRatio = 1.0;
-
-#ifdef QWT_USE_WINDOW_HANDLE
-    pixelRatio = canvas->windowHandle()->devicePixelRatio();
-#else
-    pixelRatio = canvas->devicePixelRatio();
-#endif
-#endif
 
     const QRect r( 0, 0, size.width(), size.height() );
@@ -44,5 +31,5 @@
 
     ( void )QMetaObject::invokeMethod(
-        const_cast< QWidget *>( canvas ), "borderPath", Qt::DirectConnection,
+        const_cast< QWidget* >( canvas ), "borderPath", Qt::DirectConnection,
         Q_RETURN_ARG( QPainterPath, borderPath ), Q_ARG( QRect, r ) );
 
@@ -53,5 +40,5 @@
 
 #if QT_VERSION >= 0x050000
-        QBitmap mask( size * pixelRatio );
+        QBitmap mask( size* pixelRatio );
         mask.setDevicePixelRatio( pixelRatio );
 #else
@@ -67,5 +54,5 @@
 
 #if QT_VERSION >= 0x050000
-    QImage image( size * pixelRatio, QImage::Format_ARGB32_Premultiplied );
+    QImage image( size* pixelRatio, QImage::Format_ARGB32_Premultiplied );
     image.setDevicePixelRatio( pixelRatio );
 #else
@@ -94,9 +81,8 @@
         const QVariant frameWidth = canvas->property( "frameWidth" );
 
-        if ( borderRadius.type() == QVariant::Double
-            && frameWidth.type() == QVariant::Int )
+        if ( borderRadius.canConvert< double >() && frameWidth.canConvert< int >() )
         {
-            const double br = borderRadius.toDouble();
-            const int fw = frameWidth.toInt();
+            const double br = borderRadius.value< double >();
+            const int fw = frameWidth.value< int >();
 
             if ( br > 0.0 && fw > 0 )
@@ -121,27 +107,27 @@
 class QwtPlotPanner::PrivateData
 {
-public:
+  public:
     PrivateData()
     {
-        for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
+        for ( int axis = 0; axis < QwtAxis::AxisPositions; axis++ )
             isAxisEnabled[axis] = true;
     }
 
-    bool isAxisEnabled[QwtPlot::axisCnt];
+    bool isAxisEnabled[QwtAxis::AxisPositions];
 };
 
 /*!
-  \brief A panner for the canvas of a QwtPlot
-
-  The panner is enabled for all axes
-
-  \param canvas Plot canvas to pan, also the parent object
-
-  \sa setAxisEnabled()
-*/
-QwtPlotPanner::QwtPlotPanner( QWidget *canvas ):
-    QwtPanner( canvas )
-{
-    d_data = new PrivateData();
+   \brief A panner for the canvas of a QwtPlot
+
+   The panner is enabled for all axes
+
+   \param canvas Plot canvas to pan, also the parent object
+
+   \sa setAxisEnabled()
+ */
+QwtPlotPanner::QwtPlotPanner( QWidget* canvas )
+    : QwtPanner( canvas )
+{
+    m_data = new PrivateData();
 
     connect( this, SIGNAL(panned(int,int)),
@@ -152,5 +138,5 @@
 QwtPlotPanner::~QwtPlotPanner()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -161,13 +147,13 @@
    result of panning. All other axes will remain unchanged.
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis id
    \param on On/Off
 
    \sa isAxisEnabled(), moveCanvas()
-*/
-void QwtPlotPanner::setAxisEnabled( int axis, bool on )
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        d_data->isAxisEnabled[axis] = on;
+ */
+void QwtPlotPanner::setAxisEnabled( QwtAxisId axisId, bool on )
+{
+    if ( QwtAxis::isValid( axisId ) )
+        m_data->isAxisEnabled[axisId] = on;
 }
 
@@ -175,13 +161,13 @@
    Test if an axis is enabled
 
-   \param axis Axis, see QwtPlot::Axis
+   \param axisId Axis
    \return True, if the axis is enabled
 
    \sa setAxisEnabled(), moveCanvas()
-*/
-bool QwtPlotPanner::isAxisEnabled( int axis ) const
-{
-    if ( axis >= 0 && axis < QwtPlot::axisCnt )
-        return d_data->isAxisEnabled[axis];
+ */
+bool QwtPlotPanner::isAxisEnabled( QwtAxisId axisId ) const
+{
+    if ( QwtAxis::isValid( axisId ) )
+        return m_data->isAxisEnabled[axisId];
 
     return true;
@@ -189,5 +175,5 @@
 
 //! Return observed plot canvas
-QWidget *QwtPlotPanner::canvas()
+QWidget* QwtPlotPanner::canvas()
 {
     return parentWidget();
@@ -195,5 +181,5 @@
 
 //! Return Observed plot canvas
-const QWidget *QwtPlotPanner::canvas() const
+const QWidget* QwtPlotPanner::canvas() const
 {
     return parentWidget();
@@ -201,21 +187,21 @@
 
 //! Return plot widget, containing the observed plot canvas
-QwtPlot *QwtPlotPanner::plot()
-{
-    QWidget *w = canvas();
+QwtPlot* QwtPlotPanner::plot()
+{
+    QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<QwtPlot *>( w );
+    return qobject_cast< QwtPlot* >( w );
 }
 
 //! Return plot widget, containing the observed plot canvas
-const QwtPlot *QwtPlotPanner::plot() const
-{
-    const QWidget *w = canvas();
+const QwtPlot* QwtPlotPanner::plot() const
+{
+    const QWidget* w = canvas();
     if ( w )
         w = w->parentWidget();
 
-    return qobject_cast<const QwtPlot *>( w );
+    return qobject_cast< const QwtPlot* >( w );
 }
 
@@ -227,5 +213,5 @@
 
    \sa QwtPanner::panned()
-*/
+ */
 void QwtPlotPanner::moveCanvas( int dx, int dy )
 {
@@ -233,5 +219,5 @@
         return;
 
-    QwtPlot *plot = this->plot();
+    QwtPlot* plot = this->plot();
     if ( plot == NULL )
         return;
@@ -240,27 +226,31 @@
     plot->setAutoReplot( false );
 
-    for ( int axis = 0; axis < QwtPlot::axisCnt; axis++ )
-    {
-        if ( !d_data->isAxisEnabled[axis] )
-            continue;
-
-        const QwtScaleMap map = plot->canvasMap( axis );
-
-        const double p1 = map.transform( plot->axisScaleDiv( axis ).lowerBound() );
-        const double p2 = map.transform( plot->axisScaleDiv( axis ).upperBound() );
-
-        double d1, d2;
-        if ( axis == QwtPlot::xBottom || axis == QwtPlot::xTop )
+    for ( int axisPos = 0; axisPos < QwtAxis::AxisPositions; axisPos++ )
+    {
         {
-            d1 = map.invTransform( p1 - dx );
-            d2 = map.invTransform( p2 - dx );
+            const QwtAxisId axisId( axisPos );
+
+            if ( !m_data->isAxisEnabled[axisId] )
+                continue;
+
+            const QwtScaleMap map = plot->canvasMap( axisId );
+
+            const double p1 = map.transform( plot->axisScaleDiv( axisId ).lowerBound() );
+            const double p2 = map.transform( plot->axisScaleDiv( axisId ).upperBound() );
+
+            double d1, d2;
+            if ( QwtAxis::isXAxis( axisPos ) )
+            {
+                d1 = map.invTransform( p1 - dx );
+                d2 = map.invTransform( p2 - dx );
+            }
+            else
+            {
+                d1 = map.invTransform( p1 - dy );
+                d2 = map.invTransform( p2 - dy );
+            }
+
+            plot->setAxisScale( axisId, d1, d2 );
         }
-        else
-        {
-            d1 = map.invTransform( p1 - dy );
-            d2 = map.invTransform( p2 - dy );
-        }
-
-        plot->setAxisScale( axis, d1, d2 );
     }
 
@@ -274,5 +264,5 @@
    \return Mask as bitmap
    \sa QwtPlotCanvas::borderPath()
-*/
+ */
 QBitmap QwtPlotPanner::contentsMask() const
 {
@@ -288,5 +278,5 @@
 QPixmap QwtPlotPanner::grab() const
 {
-    const QWidget *cv = canvas();
+    const QWidget* cv = canvas();
     if ( cv && cv->inherits( "QGLWidget" ) )
     {
@@ -297,5 +287,5 @@
 
         QPainter painter( &pm );
-        const_cast<QwtPlot *>( plot() )->drawCanvas( &painter );
+        const_cast< QwtPlot* >( plot() )->drawCanvas( &painter );
 
         return pm;
@@ -305,2 +295,3 @@
 }
 
+#include "moc_qwt_plot_panner.cpp"
