From 96b3000d3bc18a7fd7d15e1ad9bb9c86fa793e1f Mon Sep 17 00:00:00 2001
From: Freddie Akeroyd <freddie.akeroyd@stfc.ac.uk>
Date: Sun, 11 Apr 2010 21:36:52 +0000
Subject: [PATCH] Add in new qwt_compat.h file to handle changes in qwt 5.2.0
 refs #1197

---
 Code/qtiplot/qtiplot/qtiplot.pro               |  1 +
 Code/qtiplot/qtiplot/qwt_compat.h              | 18 ++++++++++++++++++
 Code/qtiplot/qtiplot/src/AxesDialog.cpp        |  1 +
 Code/qtiplot/qtiplot/src/Graph.cpp             |  1 +
 Code/qtiplot/qtiplot/src/Plot.cpp              |  1 +
 Code/qtiplot/qtiplot/src/Spectrogram.cpp       |  1 +
 .../qtiplot/qtiplot/src/plot2D/ScaleEngine.cpp |  1 +
 7 files changed, 24 insertions(+)
 create mode 100644 Code/qtiplot/qtiplot/qwt_compat.h

diff --git a/Code/qtiplot/qtiplot/qtiplot.pro b/Code/qtiplot/qtiplot/qtiplot.pro
index 928511209dd..fdf229a0991 100644
--- a/Code/qtiplot/qtiplot/qtiplot.pro
+++ b/Code/qtiplot/qtiplot/qtiplot.pro
@@ -66,6 +66,7 @@ win32 {
 
 unix {
   INCLUDEPATH       += /usr/include/
+  INCLUDEPATH       += /usr/include/muParser/
   INCLUDEPATH       += /usr/include/qwt-qt4/
   INCLUDEPATH       += /usr/include/qwtplot3d-qt4/
   INCLUDEPATH       += /usr/include/qwt/
diff --git a/Code/qtiplot/qtiplot/qwt_compat.h b/Code/qtiplot/qtiplot/qwt_compat.h
new file mode 100644
index 00000000000..cbbd07459b5
--- /dev/null
+++ b/Code/qtiplot/qtiplot/qwt_compat.h
@@ -0,0 +1,18 @@
+#ifndef MANTID_QWT_COMPAT
+#define MANTID_QWT_COMPAT
+
+#include <qwt_global.h>
+
+#if QWT_VERSION >= 0x050200
+// FAA 11/04/2010: QWT 5.2.0 changed some member functions
+// QwtScaleEngine 
+//   loMargin/hiMargin renamed to lowerMargin/upperMargin
+// QwtScaleDiv 
+//   lBound/hBound renamed to lowerBound/upperBound
+#   define lBound() lowerBound()
+#   define hBound() upperBound()
+#   define loMargin() lowerMargin()
+#   define hiMargin() upperMargin()
+#endif /* QWT_VERSION >= 0x050200 */
+
+#endif /* MANTID_QWT_COMPAT */
diff --git a/Code/qtiplot/qtiplot/src/AxesDialog.cpp b/Code/qtiplot/qtiplot/src/AxesDialog.cpp
index 1cc0e91009e..d4752fc6c7b 100644
--- a/Code/qtiplot/qtiplot/src/AxesDialog.cpp
+++ b/Code/qtiplot/qtiplot/src/AxesDialog.cpp
@@ -26,6 +26,7 @@
  *   Boston, MA  02110-1301  USA                                           *
  *                                                                         *
  ***************************************************************************/
+#include "qwt_compat.h"
 #include "AxesDialog.h"
 #include "ApplicationWindow.h"
 #include "TextDialog.h"
diff --git a/Code/qtiplot/qtiplot/src/Graph.cpp b/Code/qtiplot/qtiplot/src/Graph.cpp
index 64e3a004201..a8e3f8e0541 100644
--- a/Code/qtiplot/qtiplot/src/Graph.cpp
+++ b/Code/qtiplot/qtiplot/src/Graph.cpp
@@ -27,6 +27,7 @@
  *                                                                         *
  ***************************************************************************/
 
+#include "qwt_compat.h"
 #include <QVarLengthArray>
 
 static const char *cut_xpm[]={
diff --git a/Code/qtiplot/qtiplot/src/Plot.cpp b/Code/qtiplot/qtiplot/src/Plot.cpp
index 5e7699c1adb..1127a180959 100644
--- a/Code/qtiplot/qtiplot/src/Plot.cpp
+++ b/Code/qtiplot/qtiplot/src/Plot.cpp
@@ -26,6 +26,7 @@
  *   Boston, MA  02110-1301  USA                                           *
  *                                                                         *
  ***************************************************************************/
+#include "qwt_compat.h"
 #include "Plot.h"
 #include "Graph.h"
 #include "Grid.h"
diff --git a/Code/qtiplot/qtiplot/src/Spectrogram.cpp b/Code/qtiplot/qtiplot/src/Spectrogram.cpp
index 294fba36a43..7f4f8e58561 100644
--- a/Code/qtiplot/qtiplot/src/Spectrogram.cpp
+++ b/Code/qtiplot/qtiplot/src/Spectrogram.cpp
@@ -26,6 +26,7 @@
  *                                                                         *
  ***************************************************************************/
 
+#include "qwt_compat.h"
 #include "Spectrogram.h"
 #include <math.h>
 #include <QPen>
diff --git a/Code/qtiplot/qtiplot/src/plot2D/ScaleEngine.cpp b/Code/qtiplot/qtiplot/src/plot2D/ScaleEngine.cpp
index 181d991e68a..0fe44eb674c 100644
--- a/Code/qtiplot/qtiplot/src/plot2D/ScaleEngine.cpp
+++ b/Code/qtiplot/qtiplot/src/plot2D/ScaleEngine.cpp
@@ -26,6 +26,7 @@
  *   Boston, MA  02110-1301  USA                                           *
  *                                                                         *
  ***************************************************************************/
+#include "qwt_compat.h"
 #include "ScaleEngine.h"
 
 QwtScaleTransformation* ScaleEngine::transformation() const
-- 
GitLab