Index: trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp
===================================================================
--- trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp	(revision 9383)
+++ trunk/BNC/qwt/qwt_plot_abstract_barchart.cpp	(revision 11158)
@@ -1,3 +1,3 @@
-/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
+/******************************************************************************
  * Qwt Widget Library
  * Copyright (C) 1997   Josef Wilgen
@@ -10,7 +10,8 @@
 #include "qwt_plot_abstract_barchart.h"
 #include "qwt_scale_map.h"
+#include "qwt_math.h"
 
 static inline double qwtTransformWidth(
-    const QwtScaleMap &map, double value, double width )
+    const QwtScaleMap& map, double value, double width )
 {
     const double w2 = 0.5 * width;
@@ -24,11 +25,11 @@
 class QwtPlotAbstractBarChart::PrivateData
 {
-public:
-    PrivateData():
-        layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples ),
-        layoutHint( 0.5 ),
-        spacing( 10 ),
-        margin( 5 ),
-        baseline( 0.0 )
+  public:
+    PrivateData()
+        : layoutPolicy( QwtPlotAbstractBarChart::AutoAdjustSamples )
+        , layoutHint( 0.5 )
+        , spacing( 10 )
+        , margin( 5 )
+        , baseline( 0.0 )
     {
     }
@@ -42,11 +43,11 @@
 
 /*!
-  Constructor
-  \param title Title of the chart
-*/
-QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText &title ):
-    QwtPlotSeriesItem( title )
-{
-    d_data = new PrivateData;
+   Constructor
+   \param title Title of the chart
+ */
+QwtPlotAbstractBarChart::QwtPlotAbstractBarChart( const QwtText& title )
+    : QwtPlotSeriesItem( title )
+{
+    m_data = new PrivateData;
 
     setItemAttribute( QwtPlotItem::Legend, true );
@@ -59,121 +60,121 @@
 QwtPlotAbstractBarChart::~QwtPlotAbstractBarChart()
 {
-    delete d_data;
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \param policy Layout policy
-
-  \sa layoutPolicy(), layoutHint()
+    delete m_data;
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \param policy Layout policy
+
+   \sa layoutPolicy(), layoutHint()
  */
 void QwtPlotAbstractBarChart::setLayoutPolicy( LayoutPolicy policy )
 {
-    if ( policy != d_data->layoutPolicy )
-    {
-        d_data->layoutPolicy = policy;
-        itemChanged();
-    }
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \return Layout policy of the chart item
-  \sa setLayoutPolicy(), layoutHint()
+    if ( policy != m_data->layoutPolicy )
+    {
+        m_data->layoutPolicy = policy;
+        itemChanged();
+    }
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \return Layout policy of the chart item
+   \sa setLayoutPolicy(), layoutHint()
  */
 QwtPlotAbstractBarChart::LayoutPolicy QwtPlotAbstractBarChart::layoutPolicy() const
 {
-    return d_data->layoutPolicy;
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \param hint Layout hint
-
-  \sa LayoutPolicy, layoutPolicy(), layoutHint()
+    return m_data->layoutPolicy;
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \param hint Layout hint
+
+   \sa LayoutPolicy, layoutPolicy(), layoutHint()
  */
 void QwtPlotAbstractBarChart::setLayoutHint( double hint )
 {
-    hint = qMax( 0.0, hint );
-    if ( hint != d_data->layoutHint )
-    {
-        d_data->layoutHint = hint;
-        itemChanged();
-    }
-}
-
-/*!
-  The combination of layoutPolicy() and layoutHint() define how the width
-  of the bars is calculated
-
-  \return Layout policy of the chart item
-  \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
-*/
+    hint = qwtMaxF( 0.0, hint );
+    if ( hint != m_data->layoutHint )
+    {
+        m_data->layoutHint = hint;
+        itemChanged();
+    }
+}
+
+/*!
+   The combination of layoutPolicy() and layoutHint() define how the width
+   of the bars is calculated
+
+   \return Layout policy of the chart item
+   \sa LayoutPolicy, setLayoutHint(), layoutPolicy()
+ */
 double QwtPlotAbstractBarChart::layoutHint() const
 {
-    return d_data->layoutHint;
-}
-
-/*!
-  \brief Set the spacing
-
-  The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
-  a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
-
-  \sa spacing()
+    return m_data->layoutHint;
+}
+
+/*!
+   \brief Set the spacing
+
+   The spacing is the distance between 2 samples ( bars for QwtPlotBarChart or
+   a group of bars for QwtPlotMultiBarChart ) in paint device coordinates.
+
+   \sa spacing()
  */
 void QwtPlotAbstractBarChart::setSpacing( int spacing )
 {
     spacing = qMax( spacing, 0 );
-    if ( spacing != d_data->spacing )
-    {
-        d_data->spacing = spacing;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Spacing between 2 samples ( bars or groups of bars )
-  \sa setSpacing(), margin()
+    if ( spacing != m_data->spacing )
+    {
+        m_data->spacing = spacing;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Spacing between 2 samples ( bars or groups of bars )
+   \sa setSpacing(), margin()
  */
 int QwtPlotAbstractBarChart::spacing() const
 {
-    return d_data->spacing;
-}
-/*!
-  \brief Set the margin
-
-  The margin is the distance between the outmost bars and the contentsRect()
-  of the canvas. The default setting is 5 pixels.
-
-  \param margin Margin
-
-  \sa spacing(), margin()
+    return m_data->spacing;
+}
+/*!
+   \brief Set the margin
+
+   The margin is the distance between the outmost bars and the contentsRect()
+   of the canvas. The default setting is 5 pixels.
+
+   \param margin Margin
+
+   \sa spacing(), margin()
  */
 void QwtPlotAbstractBarChart::setMargin( int margin )
 {
     margin = qMax( margin, 0 );
-    if ( margin != d_data->margin )
-    {
-        d_data->margin = margin;
-        itemChanged();
-    }
-}
-
-/*!
-  \return Margin between the outmost bars and the contentsRect()
-  of the canvas.
-
-  \sa setMargin(), spacing()
+    if ( margin != m_data->margin )
+    {
+        m_data->margin = margin;
+        itemChanged();
+    }
+}
+
+/*!
+   \return Margin between the outmost bars and the contentsRect()
+   of the canvas.
+
+   \sa setMargin(), spacing()
  */
 int QwtPlotAbstractBarChart::margin() const
 {
-    return d_data->margin;
+    return m_data->margin;
 }
 
@@ -191,10 +192,10 @@
 
    \sa baseline(), QwtPlotSeriesItem::orientation()
-*/
+ */
 void QwtPlotAbstractBarChart::setBaseline( double value )
 {
-    if ( value != d_data->baseline )
-    {
-        d_data->baseline = value;
+    if ( value != m_data->baseline )
+    {
+        m_data->baseline = value;
         itemChanged();
     }
@@ -207,5 +208,5 @@
 double QwtPlotAbstractBarChart::baseline() const
 {
-    return d_data->baseline;
+    return m_data->baseline;
 }
 
@@ -221,25 +222,25 @@
    \return Sample width
    \sa layoutPolicy(), layoutHint()
-*/
-double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap &map,
+ */
+double QwtPlotAbstractBarChart::sampleWidth( const QwtScaleMap& map,
     double canvasSize, double boundingSize, double value ) const
 {
     double width;
 
-    switch( d_data->layoutPolicy )
+    switch( m_data->layoutPolicy )
     {
         case ScaleSamplesToAxes:
         {
-            width = qwtTransformWidth( map, value, d_data->layoutHint );
+            width = qwtTransformWidth( map, value, m_data->layoutHint );
             break;
         }
         case ScaleSampleToCanvas:
         {
-            width = canvasSize * d_data->layoutHint;
+            width = canvasSize * m_data->layoutHint;
             break;
         }
         case FixedSampleSize:
         {
-            width = d_data->layoutHint;
+            width = m_data->layoutHint;
             break;
         }
@@ -256,6 +257,6 @@
 
             width = qwtTransformWidth( map, value, w );
-            width -= d_data->spacing;
-            width = qMax( width, d_data->layoutHint );
+            width -= m_data->spacing;
+            width = qwtMaxF( width, m_data->layoutHint );
         }
     }
@@ -281,12 +282,10 @@
    \param bottom Returns the bottom margin
 
-   \return Margin
-
    \sa layoutPolicy(), layoutHint(), QwtPlotItem::Margins
        QwtPlot::getCanvasMarginsHint(), QwtPlot::updateCanvasMargins()
  */
-void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap &xMap,
-    const QwtScaleMap &yMap, const QRectF &canvasRect,
-    double &left, double &top, double &right, double &bottom ) const
+void QwtPlotAbstractBarChart::getCanvasMarginHint( const QwtScaleMap& xMap,
+    const QwtScaleMap& yMap, const QRectF& canvasRect,
+    double& left, double& top, double& right, double& bottom ) const
 {
     double hint = -1.0;
@@ -297,7 +296,7 @@
         {
             if ( orientation() == Qt::Vertical )
-                hint = 0.5 * canvasRect.width() * d_data->layoutHint;
+                hint = 0.5 * canvasRect.width() * m_data->layoutHint;
             else
-                hint = 0.5 * canvasRect.height() * d_data->layoutHint;
+                hint = 0.5 * canvasRect.height() * m_data->layoutHint;
 
             break;
@@ -305,5 +304,5 @@
         case FixedSampleSize:
         {
-            hint = 0.5 * d_data->layoutHint;
+            hint = 0.5 * m_data->layoutHint;
             break;
         }
@@ -324,9 +323,9 @@
             if ( layoutPolicy() == ScaleSamplesToAxes )
             {
-                sampleWidthS = qMax( d_data->layoutHint, 0.0 );
+                sampleWidthS = qwtMaxF( m_data->layoutHint, 0.0 );
             }
             else
             {
-                spacing = d_data->spacing;
+                spacing = m_data->spacing;
 
                 if ( numSamples > 1 )
@@ -352,5 +351,5 @@
 
             hint = 0.5 * sampleWidthP;
-            hint += qMax( d_data->margin, 0 );
+            hint += qMax( m_data->margin, 0 );
         }
     }
