Index: trunk/BNC/qwt/qwt_plot_histogram.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_histogram.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_histogram.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -9,13 +9,14 @@
 
 #include "qwt_plot_histogram.h"
-#include "qwt_plot.h"
 #include "qwt_painter.h"
 #include "qwt_column_symbol.h"
 #include "qwt_scale_map.h"
+#include "qwt_graphic.h"
+
 #include <qstring.h>
 #include <qpainter.h>
 
-static inline bool qwtIsCombinable( const QwtInterval &d1,
-    const QwtInterval &d2 )
+static inline bool qwtIsCombinable( const QwtInterval& d1,
+    const QwtInterval& d2 )
 {
     if ( d1.isValid() && d2.isValid() )
@@ -36,9 +37,9 @@
 class QwtPlotHistogram::PrivateData
 {
-public:
-    PrivateData():
-        baseline( 0.0 ),
-        style( Columns ),
-        symbol( NULL )
+  public:
+    PrivateData()
+        : baseline( 0.0 )
+        , style( Columns )
+        , symbol( NULL )
     {
     }
@@ -54,13 +55,13 @@
     QBrush brush;
     QwtPlotHistogram::HistogramStyle style;
-    const QwtColumnSymbol *symbol;
+    const QwtColumnSymbol* symbol;
 };
 
 /*!
-  Constructor
-  \param title Title of the histogram.
-*/
-QwtPlotHistogram::QwtPlotHistogram( const QwtText &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the histogram.
+ */
+QwtPlotHistogram::QwtPlotHistogram( const QwtText& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -68,9 +69,9 @@
 
 /*!
-  Constructor
-  \param title Title of the histogram.
-*/
-QwtPlotHistogram::QwtPlotHistogram( const QString &title ):
-    QwtPlotSeriesItem( title )
+   Constructor
+   \param title Title of the histogram.
+ */
+QwtPlotHistogram::QwtPlotHistogram( const QString& title )
+    : QwtPlotSeriesItem( title )
 {
     init();
@@ -80,5 +81,5 @@
 QwtPlotHistogram::~QwtPlotHistogram()
 {
-    delete d_data;
+    delete m_data;
 }
 
@@ -86,5 +87,5 @@
 void QwtPlotHistogram::init()
 {
-    d_data = new PrivateData();
+    m_data = new PrivateData();
     setData( new QwtIntervalSeriesData() );
 
@@ -96,14 +97,14 @@
 
 /*!
-  Set the histogram's drawing style
-
-  \param style Histogram style
-  \sa HistogramStyle, style()
-*/
+   Set the histogram's drawing style
+
+   \param style Histogram style
+   \sa HistogramStyle, style()
+ */
 void QwtPlotHistogram::setStyle( HistogramStyle style )
 {
-    if ( style != d_data->style )
-    {
-        d_data->style = style;
+    if ( style != m_data->style )
+    {
+        m_data->style = style;
 
         legendChanged();
@@ -115,24 +116,24 @@
     \return Style of the histogram
     \sa HistogramStyle, setStyle()
-*/
+ */
 QwtPlotHistogram::HistogramStyle QwtPlotHistogram::style() const
 {
-    return d_data->style;
-}
-
-/*!
-  Build and assign a pen
-
-  In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
-  non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
-  to hide this incompatibility.
-
-  \param color Pen color
-  \param width Pen width
-  \param style Pen style
-
-  \sa pen(), brush()
- */
-void QwtPlotHistogram::setPen( const QColor &color, qreal width, Qt::PenStyle style )
+    return m_data->style;
+}
+
+/*!
+   Build and assign a pen
+
+   In Qt5 the default pen width is 1.0 ( 0.0 in Qt4 ) what makes it
+   non cosmetic ( see QPen::isCosmetic() ). This method has been introduced
+   to hide this incompatibility.
+
+   \param color Pen color
+   \param width Pen width
+   \param style Pen style
+
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setPen( const QColor& color, qreal width, Qt::PenStyle style )
 {
     setPen( QPen( color, width, style ) );
@@ -140,14 +141,14 @@
 
 /*!
-  Assign a pen, that is used in a style() depending way.
-
-  \param pen New pen
-  \sa pen(), brush()
-*/
-void QwtPlotHistogram::setPen( const QPen &pen )
-{
-    if ( pen != d_data->pen )
-    {
-        d_data->pen = pen;
+   Assign a pen, that is used in a style() depending way.
+
+   \param pen New pen
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setPen( const QPen& pen )
+{
+    if ( pen != m_data->pen )
+    {
+        m_data->pen = pen;
 
         legendChanged();
@@ -157,23 +158,23 @@
 
 /*!
-  \return Pen used in a style() depending way.
-  \sa setPen(), brush()
-*/
-const QPen &QwtPlotHistogram::pen() const
-{
-    return d_data->pen;
-}
-
-/*!
-  Assign a brush, that is used in a style() depending way.
-
-  \param brush New brush
-  \sa pen(), brush()
-*/
-void QwtPlotHistogram::setBrush( const QBrush &brush )
-{
-    if ( brush != d_data->brush )
-    {
-        d_data->brush = brush;
+   \return Pen used in a style() depending way.
+   \sa setPen(), brush()
+ */
+const QPen& QwtPlotHistogram::pen() const
+{
+    return m_data->pen;
+}
+
+/*!
+   Assign a brush, that is used in a style() depending way.
+
+   \param brush New brush
+   \sa pen(), brush()
+ */
+void QwtPlotHistogram::setBrush( const QBrush& brush )
+{
+    if ( brush != m_data->brush )
+    {
+        m_data->brush = brush;
 
         legendChanged();
@@ -183,32 +184,32 @@
 
 /*!
-  \return Brush used in a style() depending way.
-  \sa setPen(), brush()
-*/
-const QBrush &QwtPlotHistogram::brush() const
-{
-    return d_data->brush;
-}
-
-/*!
-  \brief Assign a symbol
-
-  In Column style an optional symbol can be assigned, that is responsible
-  for displaying the rectangle that is defined by the interval and
-  the distance between baseline() and value. When no symbol has been
-  defined the area is displayed as plain rectangle using pen() and brush().
-
-  \sa style(), symbol(), drawColumn(), pen(), brush()
-
-  \note In applications, where different intervals need to be displayed
+   \return Brush used in a style() depending way.
+   \sa setPen(), brush()
+ */
+const QBrush& QwtPlotHistogram::brush() const
+{
+    return m_data->brush;
+}
+
+/*!
+   \brief Assign a symbol
+
+   In Column style an optional symbol can be assigned, that is responsible
+   for displaying the rectangle that is defined by the interval and
+   the distance between baseline() and value. When no symbol has been
+   defined the area is displayed as plain rectangle using pen() and brush().
+
+   \sa style(), symbol(), drawColumn(), pen(), brush()
+
+   \note In applications, where different intervals need to be displayed
         in a different way ( f.e different colors or even using different symbols)
         it is recommended to overload drawColumn().
-*/
-void QwtPlotHistogram::setSymbol( const QwtColumnSymbol *symbol )
-{
-    if ( symbol != d_data->symbol )
-    {
-        delete d_data->symbol;
-        d_data->symbol = symbol;
+ */
+void QwtPlotHistogram::setSymbol( const QwtColumnSymbol* symbol )
+{
+    if ( symbol != m_data->symbol )
+    {
+        delete m_data->symbol;
+        m_data->symbol = symbol;
 
         legendChanged();
@@ -218,28 +219,28 @@
 
 /*!
-  \return Current symbol or NULL, when no symbol has been assigned
-  \sa setSymbol()
-*/
-const QwtColumnSymbol *QwtPlotHistogram::symbol() const
-{
-    return d_data->symbol;
-}
-
-/*!
-  \brief Set the value of the baseline
-
-  Each column representing an QwtIntervalSample is defined by its
-  interval and the interval between baseline and the value of the sample.
-
-  The default value of the baseline is 0.0.
-
-  \param value Value of the baseline
-  \sa baseline()
-*/
+   \return Current symbol or NULL, when no symbol has been assigned
+   \sa setSymbol()
+ */
+const QwtColumnSymbol* QwtPlotHistogram::symbol() const
+{
+    return m_data->symbol;
+}
+
+/*!
+   \brief Set the value of the baseline
+
+   Each column representing an QwtIntervalSample is defined by its
+   interval and the interval between baseline and the value of the sample.
+
+   The default value of the baseline is 0.0.
+
+   \param value Value of the baseline
+   \sa baseline()
+ */
 void QwtPlotHistogram::setBaseline( double value )
 {
-    if ( d_data->baseline != value )
-    {
-        d_data->baseline = value;
+    if ( m_data->baseline != value )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -247,16 +248,16 @@
 
 /*!
-  \return Value of the baseline
-  \sa setBaseline()
-*/
+   \return Value of the baseline
+   \sa setBaseline()
+ */
 double QwtPlotHistogram::baseline() const
 {
-    return d_data->baseline;
-}
-
-/*!
-  \return Bounding rectangle of all samples.
-  For an empty series the rectangle is invalid.
-*/
+    return m_data->baseline;
+}
+
+/*!
+   \return Bounding rectangle of all samples.
+   For an empty series the rectangle is invalid.
+ */
 QRectF QwtPlotHistogram::boundingRect() const
 {
@@ -270,15 +271,15 @@
             rect.height(), rect.width() );
 
-        if ( rect.left() > d_data->baseline )
-            rect.setLeft( d_data->baseline );
-        else if ( rect.right() < d_data->baseline )
-            rect.setRight( d_data->baseline );
+        if ( rect.left() > m_data->baseline )
+            rect.setLeft( m_data->baseline );
+        else if ( rect.right() < m_data->baseline )
+            rect.setRight( m_data->baseline );
     }
     else
     {
-        if ( rect.bottom() < d_data->baseline )
-            rect.setBottom( d_data->baseline );
-        else if ( rect.top() > d_data->baseline )
-            rect.setTop( d_data->baseline );
+        if ( rect.bottom() < m_data->baseline )
+            rect.setBottom( m_data->baseline );
+        else if ( rect.top() > m_data->baseline )
+            rect.setTop( m_data->baseline );
     }
 
@@ -293,9 +294,9 @@
 
 /*!
-  Initialize data with an array of samples.
-  \param samples Vector of points
-*/
+   Initialize data with an array of samples.
+   \param samples Vector of points
+ */
 void QwtPlotHistogram::setSamples(
-    const QVector<QwtIntervalSample> &samples )
+    const QVector< QwtIntervalSample >& samples )
 {
     setData( new QwtIntervalSeriesData( samples ) );
@@ -303,15 +304,15 @@
 
 /*!
-  Assign a series of samples
-
-  setSamples() is just a wrapper for setData() without any additional
-  value - beside that it is easier to find for the developer.
-
-  \param data Data
-  \warning The item takes ownership of the data object, deleting
+   Assign a series of samples
+
+   setSamples() is just a wrapper for setData() without any additional
+   value - beside that it is easier to find for the developer.
+
+   \param data Data
+   \warning The item takes ownership of the data object, deleting
            it when its not used anymore.
-*/
+ */
 void QwtPlotHistogram::setSamples(
-    QwtSeriesData<QwtIntervalSample> *data )
+    QwtSeriesData< QwtIntervalSample >* data )
 {
     setData( data );
@@ -319,19 +320,19 @@
 
 /*!
-  Draw a subset of the histogram samples
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param canvasRect Contents rectangle of the canvas
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a subset of the histogram samples
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param canvasRect Contents rectangle of the canvas
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          series will be painted to its last sample.
 
-  \sa drawOutline(), drawLines(), drawColumns
-*/
-void QwtPlotHistogram::drawSeries( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
-    const QRectF &canvasRect, int from, int to ) const
+   \sa drawOutline(), drawLines(), drawColumns
+ */
+void QwtPlotHistogram::drawSeries( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
+    const QRectF& canvasRect, int from, int to ) const
 {
     Q_UNUSED( canvasRect )
@@ -343,5 +344,5 @@
         to = dataSize() - 1;
 
-    switch ( d_data->style )
+    switch ( m_data->style )
     {
         case Outline:
@@ -360,19 +361,19 @@
 
 /*!
-  Draw a histogram in Outline style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Outline style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style()
-  \warning The outline style requires, that the intervals are in increasing
+   \sa setStyle(), style()
+   \warning The outline style requires, that the intervals are in increasing
            order and not overlapping.
-*/
-void QwtPlotHistogram::drawOutline( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+ */
+void QwtPlotHistogram::drawOutline( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
@@ -447,23 +448,23 @@
 
 /*!
-  Draw a histogram in Columns style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Columns style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style(), setSymbol(), drawColumn()
-*/
-void QwtPlotHistogram::drawColumns( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+   \sa setStyle(), style(), setSymbol(), drawColumn()
+ */
+void QwtPlotHistogram::drawColumns( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
-    painter->setPen( d_data->pen );
-    painter->setBrush( d_data->brush );
-
-    const QwtSeriesData<QwtIntervalSample> *series = data();
+    painter->setPen( m_data->pen );
+    painter->setBrush( m_data->brush );
+
+    const QwtSeriesData< QwtIntervalSample >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -479,25 +480,25 @@
 
 /*!
-  Draw a histogram in Lines style()
-
-  \param painter Painter
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-  \param from Index of the first sample to be painted
-  \param to Index of the last sample to be painted. If to < 0 the
+   Draw a histogram in Lines style()
+
+   \param painter Painter
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+   \param from Index of the first sample to be painted
+   \param to Index of the last sample to be painted. If to < 0 the
          histogram will be painted to its last point.
 
-  \sa setStyle(), style(), setPen()
-*/
-void QwtPlotHistogram::drawLines( QPainter *painter,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
+   \sa setStyle(), style(), setPen()
+ */
+void QwtPlotHistogram::drawLines( QPainter* painter,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap,
     int from, int to ) const
 {
     const bool doAlign = QwtPainter::roundingAlignment( painter );
 
-    painter->setPen( d_data->pen );
+    painter->setPen( m_data->pen );
     painter->setBrush( Qt::NoBrush );
 
-    const QwtSeriesData<QwtIntervalSample> *series = data();
+    const QwtSeriesData< QwtIntervalSample >* series = data();
 
     for ( int i = from; i <= to; i++ )
@@ -549,6 +550,6 @@
 
 //! Internal, used by the Outline style.
-void QwtPlotHistogram::flushPolygon( QPainter *painter,
-    double baseLine, QPolygonF &polygon ) const
+void QwtPlotHistogram::flushPolygon( QPainter* painter,
+    double baseLine, QPolygonF& polygon ) const
 {
     if ( polygon.size() == 0 )
@@ -560,8 +561,8 @@
         polygon += QPointF( polygon.last().x(), baseLine );
 
-    if ( d_data->brush.style() != Qt::NoBrush )
+    if ( m_data->brush.style() != Qt::NoBrush )
     {
         painter->setPen( Qt::NoPen );
-        painter->setBrush( d_data->brush );
+        painter->setBrush( m_data->brush );
 
         if ( orientation() == Qt::Horizontal )
@@ -581,8 +582,8 @@
         polygon.pop_back();
     }
-    if ( d_data->pen.style() != Qt::NoPen )
+    if ( m_data->pen.style() != Qt::NoPen )
     {
         painter->setBrush( Qt::NoBrush );
-        painter->setPen( d_data->pen );
+        painter->setPen( m_data->pen );
         QwtPainter::drawPolyline( painter, polygon );
     }
@@ -591,18 +592,18 @@
 
 /*!
-  Calculate the area that is covered by a sample
-
-  \param sample Sample
-  \param xMap Maps x-values into pixel coordinates.
-  \param yMap Maps y-values into pixel coordinates.
-
-  \return Rectangle, that is covered by a sample
-*/
-QwtColumnRect QwtPlotHistogram::columnRect( const QwtIntervalSample &sample,
-    const QwtScaleMap &xMap, const QwtScaleMap &yMap ) const
+   Calculate the area that is covered by a sample
+
+   \param sample Sample
+   \param xMap Maps x-values into pixel coordinates.
+   \param yMap Maps y-values into pixel coordinates.
+
+   \return Rectangle, that is covered by a sample
+ */
+QwtColumnRect QwtPlotHistogram::columnRect( const QwtIntervalSample& sample,
+    const QwtScaleMap& xMap, const QwtScaleMap& yMap ) const
 {
     QwtColumnRect rect;
 
-    const QwtInterval &iv = sample.interval;
+    const QwtInterval& iv = sample.interval;
     if ( !iv.isValid() )
         return rect;
@@ -611,5 +612,5 @@
     {
         const double x0 = xMap.transform( baseline() );
-        const double x  = xMap.transform( sample.value );
+        const double x = xMap.transform( sample.value );
         const double y1 = yMap.transform( iv.minValue() );
         const double y2 = yMap.transform( iv.maxValue() );
@@ -618,5 +619,5 @@
         rect.vInterval.setInterval( y1, y2, iv.borderFlags() );
         rect.direction = ( x < x0 ) ? QwtColumnRect::RightToLeft :
-                         QwtColumnRect::LeftToRight;
+            QwtColumnRect::LeftToRight;
     }
     else
@@ -637,26 +638,26 @@
 
 /*!
-  Draw a column for a sample in Columns style().
-
-  When a symbol() has been set the symbol is used otherwise the
-  column is displayed as plain rectangle using pen() and brush().
-
-  \param painter Painter
-  \param rect Rectangle where to paint the column in paint device coordinates
-  \param sample Sample to be displayed
-
-  \note In applications, where different intervals need to be displayed
+   Draw a column for a sample in Columns style().
+
+   When a symbol() has been set the symbol is used otherwise the
+   column is displayed as plain rectangle using pen() and brush().
+
+   \param painter Painter
+   \param rect Rectangle where to paint the column in paint device coordinates
+   \param sample Sample to be displayed
+
+   \note In applications, where different intervals need to be displayed
         in a different way ( f.e different colors or even using different symbols)
         it is recommended to overload drawColumn().
-*/
-void QwtPlotHistogram::drawColumn( QPainter *painter,
-    const QwtColumnRect &rect, const QwtIntervalSample &sample ) const
+ */
+void QwtPlotHistogram::drawColumn( QPainter* painter,
+    const QwtColumnRect& rect, const QwtIntervalSample& sample ) const
 {
     Q_UNUSED( sample );
 
-    if ( d_data->symbol &&
-        ( d_data->symbol->style() != QwtColumnSymbol::NoStyle ) )
-    {
-        d_data->symbol->draw( painter, rect );
+    if ( m_data->symbol &&
+        ( m_data->symbol->style() != QwtColumnSymbol::NoStyle ) )
+    {
+        m_data->symbol->draw( painter, rect );
     }
     else
@@ -676,17 +677,16 @@
 
 /*!
-  A plain rectangle without pen using the brush()
-
-  \param index Index of the legend entry
+   A plain rectangle without pen using the brush()
+
+   \param index Index of the legend entry
                 ( ignored as there is only one )
-  \param size Icon size
-  \return A graphic displaying the icon
-
-  \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
-*/
-QwtGraphic QwtPlotHistogram::legendIcon( int index,
-    const QSizeF &size ) const
+   \param size Icon size
+   \return A graphic displaying the icon
+
+   \sa QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()
+ */
+QwtGraphic QwtPlotHistogram::legendIcon( int index, const QSizeF& size ) const
 {
     Q_UNUSED( index );
-    return defaultIcon( d_data->brush, size );
-}
+    return defaultIcon( m_data->brush, size );
+}
