Index: trunk/BNC/qwt/qwt_plot_zoomer.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_zoomer.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_zoomer.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -11,6 +11,9 @@
 #include "qwt_plot.h"
 #include "qwt_scale_div.h"
+#include "qwt_scale_map.h"
+#include "qwt_interval.h"
 #include "qwt_picker_machine.h"
-#include <qalgorithms.h>
+
+#include <qstack.h>
 
 static QwtInterval qwtExpandedZoomInterval( double v1, double v2,
@@ -50,5 +53,5 @@
 }
 
-static QRectF qwtExpandedZoomRect( const QRectF &zoomRect, const QSizeF &minSize,
+static QRectF qwtExpandedZoomRect( const QRectF& zoomRect, const QSizeF& minSize,
     const QwtTransform* transformX, const QwtTransform* transformY )
 {
@@ -78,7 +81,7 @@
 class QwtPlotZoomer::PrivateData
 {
-public:
+  public:
     uint zoomRectIndex;
-    QStack<QRectF> zoomStack;
+    QStack< QRectF > zoomStack;
 
     int maxStackDepth;
@@ -86,24 +89,24 @@
 
 /*!
-  \brief Create a zoomer for a plot canvas.
-
-  The zoomer is set to those x- and y-axis of the parent plot of the
-  canvas that are enabled. If both or no x-axis are enabled, the picker
-  is set to QwtPlot::xBottom. If both or no y-axis are
-  enabled, it is set to QwtPlot::yLeft.
-
-  The zoomer is initialized with a QwtPickerDragRectMachine,
-  the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
-  is set to QwtPicker::RectRubberBand
-
-  \param canvas Plot canvas to observe, also the parent object
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+   \brief Create a zoomer for a plot canvas.
+
+   The zoomer is set to those x- and y-axis of the parent plot of the
+   canvas that are enabled. If both or no x-axis are enabled, the picker
+   is set to QwtAxis::XBottom. If both or no y-axis are
+   enabled, it is set to QwtAxis::YLeft.
+
+   The zoomer is initialized with a QwtPickerDragRectMachine,
+   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
+   is set to QwtPicker::RectRubberBand
+
+   \param canvas Plot canvas to observe, also the parent object
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
-*/
-QwtPlotZoomer::QwtPlotZoomer( QWidget *canvas, bool doReplot ):
-    QwtPlotPicker( canvas )
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
+ */
+QwtPlotZoomer::QwtPlotZoomer( QWidget* canvas, bool doReplot )
+    : QwtPlotPicker( canvas )
 {
     if ( canvas )
@@ -112,23 +115,23 @@
 
 /*!
-  \brief Create a zoomer for a plot canvas.
-
-  The zoomer is initialized with a QwtPickerDragRectMachine,
-  the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
-  is set to QwtPicker;;RectRubberBand
-
-  \param xAxis X axis of the zoomer
-  \param yAxis Y axis of the zoomer
-  \param canvas Plot canvas to observe, also the parent object
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+   \brief Create a zoomer for a plot canvas.
+
+   The zoomer is initialized with a QwtPickerDragRectMachine,
+   the tracker mode is set to QwtPicker::ActiveOnly and the rubber band
+   is set to QwtPicker::RectRubberBand
+
+   \param xAxisId X axis of the zoomer
+   \param yAxisId Y axis of the zoomer
+   \param canvas Plot canvas to observe, also the parent object
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
-*/
-
-QwtPlotZoomer::QwtPlotZoomer( int xAxis, int yAxis,
-        QWidget *canvas, bool doReplot ):
-    QwtPlotPicker( xAxis, yAxis, canvas )
+   \sa QwtPlot::autoReplot(), QwtPlot::replot(), setZoomBase()
+ */
+
+QwtPlotZoomer::QwtPlotZoomer( QwtAxisId xAxisId, QwtAxisId yAxisId,
+        QWidget* canvas, bool doReplot )
+    : QwtPlotPicker( xAxisId, yAxisId, canvas )
 {
     if ( canvas )
@@ -139,7 +142,7 @@
 void QwtPlotZoomer::init( bool doReplot )
 {
-    d_data = new PrivateData;
-
-    d_data->maxStackDepth = -1;
+    m_data = new PrivateData;
+
+    m_data->maxStackDepth = -1;
 
     setTrackerMode( ActiveOnly );
@@ -155,36 +158,36 @@
 QwtPlotZoomer::~QwtPlotZoomer()
 {
-    delete d_data;
-}
-
-/*!
-  \brief Limit the number of recursive zoom operations to depth.
-
-  A value of -1 set the depth to unlimited, 0 disables zooming.
-  If the current zoom rectangle is below depth, the plot is unzoomed.
-
-  \param depth Maximum for the stack depth
-  \sa maxStackDepth()
-  \note depth doesn't include the zoom base, so zoomStack().count() might be
+    delete m_data;
+}
+
+/*!
+   \brief Limit the number of recursive zoom operations to depth.
+
+   A value of -1 set the depth to unlimited, 0 disables zooming.
+   If the current zoom rectangle is below depth, the plot is unzoomed.
+
+   \param depth Maximum for the stack depth
+   \sa maxStackDepth()
+   \note depth doesn't include the zoom base, so zoomStack().count() might be
               maxStackDepth() + 1.
-*/
+ */
 void QwtPlotZoomer::setMaxStackDepth( int depth )
 {
-    d_data->maxStackDepth = depth;
+    m_data->maxStackDepth = depth;
 
     if ( depth >= 0 )
     {
-        // unzoom if the current depth is below d_data->maxStackDepth
+        // unzoom if the current depth is below m_data->maxStackDepth
 
         const int zoomOut =
-            int( d_data->zoomStack.count() ) - 1 - depth; // -1 for the zoom base
+            m_data->zoomStack.count() - 1 - depth; // -1 for the zoom base
 
         if ( zoomOut > 0 )
         {
             zoom( -zoomOut );
-            for ( int i = int( d_data->zoomStack.count() ) - 1;
-                i > int( d_data->zoomRectIndex ); i-- )
+            for ( int i = m_data->zoomStack.count() - 1;
+                i > int( m_data->zoomRectIndex ); i-- )
             {
-                ( void )d_data->zoomStack.pop(); // remove trailing rects
+                ( void )m_data->zoomStack.pop(); // remove trailing rects
             }
         }
@@ -193,44 +196,44 @@
 
 /*!
-  \return Maximal depth of the zoom stack.
-  \sa setMaxStackDepth()
-*/
+   \return Maximal depth of the zoom stack.
+   \sa setMaxStackDepth()
+ */
 int QwtPlotZoomer::maxStackDepth() const
 {
-    return d_data->maxStackDepth;
-}
-
-/*!
-  \return The zoom stack. zoomStack()[0] is the zoom base,
+    return m_data->maxStackDepth;
+}
+
+/*!
+   \return The zoom stack. zoomStack()[0] is the zoom base,
           zoomStack()[1] the first zoomed rectangle.
 
-  \sa setZoomStack(), zoomRectIndex()
-*/
-const QStack<QRectF> &QwtPlotZoomer::zoomStack() const
-{
-    return d_data->zoomStack;
-}
-
-/*!
-  \return Initial rectangle of the zoomer
-  \sa setZoomBase(), zoomRect()
-*/
+   \sa setZoomStack(), zoomRectIndex()
+ */
+const QStack< QRectF >& QwtPlotZoomer::zoomStack() const
+{
+    return m_data->zoomStack;
+}
+
+/*!
+   \return Initial rectangle of the zoomer
+   \sa setZoomBase(), zoomRect()
+ */
 QRectF QwtPlotZoomer::zoomBase() const
 {
-    return d_data->zoomStack[0];
-}
-
-/*!
-  Reinitialized the zoom stack with scaleRect() as base.
-
-  \param doReplot Call QwtPlot::replot() for the attached plot before initializing
+    return m_data->zoomStack[0];
+}
+
+/*!
+   Reinitialized the zoom stack with scaleRect() as base.
+
+   \param doReplot Call QwtPlot::replot() for the attached plot before initializing
                   the zoomer with its scales. This might be necessary,
                   when the plot is in a state with pending scale changes.
 
-  \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
-*/
+   \sa zoomBase(), scaleRect() QwtPlot::autoReplot(), QwtPlot::replot().
+ */
 void QwtPlotZoomer::setZoomBase( bool doReplot )
 {
-    QwtPlot *plt = plot();
+    QwtPlot* plt = plot();
     if ( plt == NULL )
         return;
@@ -239,7 +242,7 @@
         plt->replot();
 
-    d_data->zoomStack.clear();
-    d_data->zoomStack.push( scaleRect() );
-    d_data->zoomRectIndex = 0;
+    m_data->zoomStack.clear();
+    m_data->zoomStack.push( scaleRect() );
+    m_data->zoomRectIndex = 0;
 
     rescale();
@@ -247,16 +250,16 @@
 
 /*!
-  \brief Set the initial size of the zoomer.
-
-  base is united with the current scaleRect() and the zoom stack is
-  reinitialized with it as zoom base. plot is zoomed to scaleRect().
-
-  \param base Zoom base
-
-  \sa zoomBase(), scaleRect()
-*/
-void QwtPlotZoomer::setZoomBase( const QRectF &base )
-{
-    const QwtPlot *plt = plot();
+   \brief Set the initial size of the zoomer.
+
+   base is united with the current scaleRect() and the zoom stack is
+   reinitialized with it as zoom base. plot is zoomed to scaleRect().
+
+   \param base Zoom base
+
+   \sa zoomBase(), scaleRect()
+ */
+void QwtPlotZoomer::setZoomBase( const QRectF& base )
+{
+    const QwtPlot* plt = plot();
     if ( !plt )
         return;
@@ -265,12 +268,12 @@
     const QRectF bRect = base | sRect;
 
-    d_data->zoomStack.clear();
-    d_data->zoomStack.push( bRect );
-    d_data->zoomRectIndex = 0;
+    m_data->zoomStack.clear();
+    m_data->zoomStack.push( bRect );
+    m_data->zoomRectIndex = 0;
 
     if ( base != sRect )
     {
-        d_data->zoomStack.push( sRect );
-        d_data->zoomRectIndex++;
+        m_data->zoomStack.push( sRect );
+        m_data->zoomRectIndex++;
     }
 
@@ -279,34 +282,34 @@
 
 /*!
-  \return Rectangle at the current position on the zoom stack.
-  \sa zoomRectIndex(), scaleRect().
-*/
+   \return Rectangle at the current position on the zoom stack.
+   \sa zoomRectIndex(), scaleRect().
+ */
 QRectF QwtPlotZoomer::zoomRect() const
 {
-    return d_data->zoomStack[d_data->zoomRectIndex];
-}
-
-/*!
-  \return Index of current position of zoom stack.
-*/
+    return m_data->zoomStack[m_data->zoomRectIndex];
+}
+
+/*!
+   \return Index of current position of zoom stack.
+ */
 uint QwtPlotZoomer::zoomRectIndex() const
 {
-    return d_data->zoomRectIndex;
-}
-
-/*!
-  \brief Zoom in
-
-  Clears all rectangles above the current position of the
-  zoom stack and pushes the normalized rectangle on it.
-
-  \note If the maximal stack depth is reached, zoom is ignored.
-  \note The zoomed signal is emitted.
-*/
-
-void QwtPlotZoomer::zoom( const QRectF &rect )
-{
-    if ( d_data->maxStackDepth >= 0 &&
-            int( d_data->zoomRectIndex ) >= d_data->maxStackDepth )
+    return m_data->zoomRectIndex;
+}
+
+/*!
+   \brief Zoom in
+
+   Clears all rectangles above the current position of the
+   zoom stack and pushes the normalized rectangle on it.
+
+   \note If the maximal stack depth is reached, zoom is ignored.
+   \note The zoomed signal is emitted.
+ */
+
+void QwtPlotZoomer::zoom( const QRectF& rect )
+{
+    if ( m_data->maxStackDepth >= 0 &&
+        int( m_data->zoomRectIndex ) >= m_data->maxStackDepth )
     {
         return;
@@ -314,14 +317,14 @@
 
     const QRectF zoomRect = rect.normalized();
-    if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] )
-    {
-        for ( uint i = int( d_data->zoomStack.count() ) - 1;
-           i > d_data->zoomRectIndex; i-- )
+    if ( zoomRect != m_data->zoomStack[m_data->zoomRectIndex] )
+    {
+        for ( uint i = m_data->zoomStack.count() - 1;
+            i > m_data->zoomRectIndex; i-- )
         {
-            ( void )d_data->zoomStack.pop();
+            ( void )m_data->zoomStack.pop();
         }
 
-        d_data->zoomStack.push( zoomRect );
-        d_data->zoomRectIndex++;
+        m_data->zoomStack.push( zoomRect );
+        m_data->zoomRectIndex++;
 
         rescale();
@@ -332,65 +335,69 @@
 
 /*!
-  \brief Zoom in or out
-
-  Activate a rectangle on the zoom stack with an offset relative
-  to the current position. Negative values of offset will zoom out,
-  positive zoom in. A value of 0 zooms out to the zoom base.
-
-  \param offset Offset relative to the current position of the zoom stack.
-  \note The zoomed signal is emitted.
-  \sa zoomRectIndex()
-*/
+   \brief Zoom in or out
+
+   Activate a rectangle on the zoom stack with an offset relative
+   to the current position. Negative values of offset will zoom out,
+   positive zoom in. A value of 0 zooms out to the zoom base.
+
+   \param offset Offset relative to the current position of the zoom stack.
+   \note The zoomed signal is emitted.
+   \sa zoomRectIndex()
+ */
 void QwtPlotZoomer::zoom( int offset )
 {
+    int newIndex;
+
     if ( offset == 0 )
-        d_data->zoomRectIndex = 0;
+    {
+        newIndex = 0;
+    }
     else
     {
-        int newIndex = d_data->zoomRectIndex + offset;
-        newIndex = qMax( 0, newIndex );
-        newIndex = qMin( int( d_data->zoomStack.count() ) - 1, newIndex );
-
-        d_data->zoomRectIndex = uint( newIndex );
-    }
-
-    rescale();
-
-    Q_EMIT zoomed( zoomRect() );
-}
-
-/*!
-  \brief Assign a zoom stack
-
-  In combination with other types of navigation it might be useful to
-  modify to manipulate the complete zoom stack.
-
-  \param zoomStack New zoom stack
-  \param zoomRectIndex Index of the current position of zoom stack.
+        newIndex = m_data->zoomRectIndex + offset;
+        newIndex = qBound( 0, newIndex, m_data->zoomStack.count() - 1 );
+    }
+
+    if ( newIndex != static_cast< int >( m_data->zoomRectIndex ) )
+    {
+        m_data->zoomRectIndex = newIndex;
+        rescale();
+        Q_EMIT zoomed( zoomRect() );
+    }
+}
+
+/*!
+   \brief Assign a zoom stack
+
+   In combination with other types of navigation it might be useful to
+   modify to manipulate the complete zoom stack.
+
+   \param zoomStack New zoom stack
+   \param zoomRectIndex Index of the current position of zoom stack.
                        In case of -1 the current position is at the top
                        of the stack.
 
-  \note The zoomed signal might be emitted.
-  \sa zoomStack(), zoomRectIndex()
-*/
+   \note The zoomed signal might be emitted.
+   \sa zoomStack(), zoomRectIndex()
+ */
 void QwtPlotZoomer::setZoomStack(
-    const QStack<QRectF> &zoomStack, int zoomRectIndex )
+    const QStack< QRectF >& zoomStack, int zoomRectIndex )
 {
     if ( zoomStack.isEmpty() )
         return;
 
-    if ( d_data->maxStackDepth >= 0 &&
-        int( zoomStack.count() ) > d_data->maxStackDepth )
+    if ( m_data->maxStackDepth >= 0 &&
+        zoomStack.count() > m_data->maxStackDepth )
     {
         return;
     }
 
-    if ( zoomRectIndex < 0 || zoomRectIndex > int( zoomStack.count() ) )
+    if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() )
         zoomRectIndex = zoomStack.count() - 1;
 
     const bool doRescale = zoomStack[zoomRectIndex] != zoomRect();
 
-    d_data->zoomStack = zoomStack;
-    d_data->zoomRectIndex = uint( zoomRectIndex );
+    m_data->zoomStack = zoomStack;
+    m_data->zoomRectIndex = uint( zoomRectIndex );
 
     if ( doRescale )
@@ -402,16 +409,16 @@
 
 /*!
-  Adjust the observed plot to zoomRect()
-
-  \note Initiates QwtPlot::replot()
-*/
+   Adjust the observed plot to zoomRect()
+
+   \note Initiates QwtPlot::replot()
+ */
 
 void QwtPlotZoomer::rescale()
 {
-    QwtPlot *plt = plot();
+    QwtPlot* plt = plot();
     if ( !plt )
         return;
 
-    const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
+    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
     if ( rect != scaleRect() )
     {
@@ -440,15 +447,15 @@
 
 /*!
-  Reinitialize the axes, and set the zoom base to their scales.
-
-  \param xAxis X axis
-  \param yAxis Y axis
-*/
-
-void QwtPlotZoomer::setAxis( int xAxis, int yAxis )
-{
-    if ( xAxis != QwtPlotPicker::xAxis() || yAxis != QwtPlotPicker::yAxis() )
-    {
-        QwtPlotPicker::setAxis( xAxis, yAxis );
+   Reinitialize the axes, and set the zoom base to their scales.
+
+   \param xAxisId X axis
+   \param yAxisId Y axis
+ */
+
+void QwtPlotZoomer::setAxes( QwtAxisId xAxisId, QwtAxisId yAxisId )
+{
+    if ( xAxisId != QwtPlotPicker::xAxis() || yAxisId != QwtPlotPicker::yAxis() )
+    {
+        QwtPlotPicker::setAxes( xAxisId, yAxisId );
         setZoomBase( scaleRect() );
     }
@@ -464,6 +471,6 @@
    \note The mouse events can be changed, using
          QwtEventPattern::setMousePattern: 2, 1
-*/
-void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent *me )
+ */
+void QwtPlotZoomer::widgetMouseReleaseEvent( QMouseEvent* me )
 {
     if ( mouseMatch( MouseSelect2, me ) )
@@ -486,7 +493,7 @@
    \note The keys codes can be changed, using
          QwtEventPattern::setKeyPattern: 3, 4, 5
-*/
-
-void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent *ke )
+ */
+
+void QwtPlotZoomer::widgetKeyPressEvent( QKeyEvent* ke )
 {
     if ( !isActive() )
@@ -504,26 +511,26 @@
 
 /*!
-  Move the current zoom rectangle.
-
-  \param dx X offset
-  \param dy Y offset
-
-  \note The changed rectangle is limited by the zoom base
-*/
+   Move the current zoom rectangle.
+
+   \param dx X offset
+   \param dy Y offset
+
+   \note The changed rectangle is limited by the zoom base
+ */
 void QwtPlotZoomer::moveBy( double dx, double dy )
 {
-    const QRectF &rect = d_data->zoomStack[d_data->zoomRectIndex];
+    const QRectF& rect = m_data->zoomStack[m_data->zoomRectIndex];
     moveTo( QPointF( rect.left() + dx, rect.top() + dy ) );
 }
 
 /*!
-  Move the the current zoom rectangle.
-
-  \param pos New position
-
-  \sa QRectF::moveTo()
-  \note The changed rectangle is limited by the zoom base
-*/
-void QwtPlotZoomer::moveTo( const QPointF &pos )
+   Move the the current zoom rectangle.
+
+   \param pos New position
+
+   \sa QRectF::moveTo()
+   \note The changed rectangle is limited by the zoom base
+ */
+void QwtPlotZoomer::moveTo( const QPointF& pos )
 {
     double x = pos.x();
@@ -542,5 +549,5 @@
     if ( x != zoomRect().left() || y != zoomRect().top() )
     {
-        d_data->zoomStack[d_data->zoomRectIndex].moveTo( x, y );
+        m_data->zoomStack[m_data->zoomRectIndex].moveTo( x, y );
         rescale();
     }
@@ -548,20 +555,20 @@
 
 /*!
-  \brief Check and correct a selected rectangle
-
-  Reject rectangles with a height or width < 2, otherwise
-  expand the selected rectangle to a minimum size of 11x11
-  and accept it.
-
-  \return true If the rectangle is accepted, or has been changed
+   \brief Check and correct a selected rectangle
+
+   Reject rectangles with a height or width < 2, otherwise
+   expand the selected rectangle to a minimum size of 11x11
+   and accept it.
+
+   \return true If the rectangle is accepted, or has been changed
           to an accepted one.
-*/
-
-bool QwtPlotZoomer::accept( QPolygon &pa ) const
+ */
+
+bool QwtPlotZoomer::accept( QPolygon& pa ) const
 {
     if ( pa.count() < 2 )
         return false;
 
-    QRect rect = QRect( pa[0], pa[int( pa.count() ) - 1] );
+    QRect rect = QRect( pa.first(), pa.last() );
     rect = rect.normalized();
 
@@ -584,25 +591,25 @@
 
 /*!
-  \brief Limit zooming by a minimum rectangle
-
-  \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
-*/
+   \brief Limit zooming by a minimum rectangle
+
+   \return zoomBase().width() / 10e4, zoomBase().height() / 10e4
+ */
 QSizeF QwtPlotZoomer::minZoomSize() const
 {
-    return QSizeF( d_data->zoomStack[0].width() / 10e4,
-        d_data->zoomStack[0].height() / 10e4 );
-}
-
-/*!
-  Rejects selections, when the stack depth is too deep, or
-  the zoomed rectangle is minZoomSize().
-
-  \sa minZoomSize(), maxStackDepth()
-*/
+    return QSizeF( m_data->zoomStack[0].width() / 10e4,
+        m_data->zoomStack[0].height() / 10e4 );
+}
+
+/*!
+   Rejects selections, when the stack depth is too deep, or
+   the zoomed rectangle is minZoomSize().
+
+   \sa minZoomSize(), maxStackDepth()
+ */
 void QwtPlotZoomer::begin()
 {
-    if ( d_data->maxStackDepth >= 0 )
-    {
-        if ( d_data->zoomRectIndex >= uint( d_data->maxStackDepth ) )
+    if ( m_data->maxStackDepth >= 0 )
+    {
+        if ( m_data->zoomRectIndex >= uint( m_data->maxStackDepth ) )
             return;
     }
@@ -612,5 +619,5 @@
     {
         const QSizeF sz =
-            d_data->zoomStack[d_data->zoomRectIndex].size() * 0.9999;
+            m_data->zoomStack[m_data->zoomRectIndex].size() * 0.9999;
 
         if ( minSize.width() >= sz.width() &&
@@ -625,13 +632,13 @@
 
 /*!
-  Expand the selected rectangle to minZoomSize() and zoom in
-  if accepted.
-
-  \param ok If true, complete the selection and emit selected signals
+   Expand the selected rectangle to minZoomSize() and zoom in
+   if accepted.
+
+   \param ok If true, complete the selection and emit selected signals
             otherwise discard the selection.
 
-  \sa accept(), minZoomSize()
-  \return True if the selection has been accepted, false otherwise
-*/
+   \sa accept(), minZoomSize()
+   \return True if the selection has been accepted, false otherwise
+ */
 bool QwtPlotZoomer::end( bool ok )
 {
@@ -640,13 +647,13 @@
         return false;
 
-    QwtPlot *plot = QwtPlotZoomer::plot();
+    QwtPlot* plot = QwtPlotZoomer::plot();
     if ( !plot )
         return false;
 
-    const QPolygon &pa = selection();
+    const QPolygon& pa = selection();
     if ( pa.count() < 2 )
         return false;
 
-    QRect rect = QRect( pa[0], pa[int( pa.count() - 1 )] );
+    QRect rect = QRect( pa.first(), pa.last() );
     rect = rect.normalized();
 
@@ -663,2 +670,4 @@
     return true;
 }
+
+#include "moc_qwt_plot_zoomer.cpp"
