diff widgets/AudioDial.cpp @ 908:4a578a360011 cxx11

More type fixes
author Chris Cannam
date Tue, 10 Mar 2015 13:22:10 +0000
parents d26545a2a02d
children 1badacff7ab2
line wrap: on
line diff
--- a/widgets/AudioDial.cpp	Tue Mar 10 10:31:27 2015 +0000
+++ b/widgets/AudioDial.cpp	Tue Mar 10 13:22:10 2015 +0000
@@ -121,10 +121,10 @@
 
     QPainter paint;
 
-    float angle = AUDIO_DIAL_MIN // offset
+    double angle = AUDIO_DIAL_MIN // offset
 	+ (AUDIO_DIAL_RANGE *
-	   (float(QDial::value() - QDial::minimum()) /
-	    (float(QDial::maximum() - QDial::minimum()))));
+	   (double(QDial::value() - QDial::minimum()) /
+	    (double(QDial::maximum() - QDial::minimum()))));
     int degrees = int(angle * 180.0 / M_PI);
 
     int ns = notchSize();
@@ -268,15 +268,15 @@
 
     // Pointer notch...
 
-    float hyp = float(width) / 2.0;
-    float len = hyp - indent;
+    double hyp = double(width) / 2.0;
+    double len = hyp - indent;
     --len;
 
-    float x0 = hyp;
-    float y0 = hyp;
+    double x0 = hyp;
+    double y0 = hyp;
 
-    float x = hyp - len * sin(angle);
-    float y = hyp + len * cos(angle);
+    double x = hyp - len * sin(angle);
+    double y = hyp + len * cos(angle);
 
     c = palette().dark().color();
     pen.setColor(isEnabled() ? c.dark(130) : c);
@@ -289,27 +289,27 @@
 
 
 void AudioDial::drawTick(QPainter &paint,
-			 float angle, int size, bool internal)
+			 double angle, int size, bool internal)
 {
-    float hyp = float(size) / 2.0;
-    float x0 = hyp - (hyp - 1) * sin(angle);
-    float y0 = hyp + (hyp - 1) * cos(angle);
+    double hyp = double(size) / 2.0;
+    double x0 = hyp - (hyp - 1) * sin(angle);
+    double y0 = hyp + (hyp - 1) * cos(angle);
 
 //    cerr << "drawTick: angle " << angle << ", size " << size << ", internal " << internal << endl;
     
     if (internal) {
 
-	float len = hyp / 4;
-	float x1 = hyp - (hyp - len) * sin(angle);
-	float y1 = hyp + (hyp - len) * cos(angle);
+	double len = hyp / 4;
+	double x1 = hyp - (hyp - len) * sin(angle);
+	double y1 = hyp + (hyp - len) * cos(angle);
 		
 	paint.drawLine(int(x0), int(y0), int(x1), int(y1));
 
     } else {
 
-	float len = hyp / 4;
-	float x1 = hyp - (hyp + len) * sin(angle);
-	float y1 = hyp + (hyp + len) * cos(angle);
+	double len = hyp / 4;
+	double x1 = hyp - (hyp + len) * sin(angle);
+	double y1 = hyp + (hyp + len) * cos(angle);
 
 	paint.drawLine(int(x0), int(y0), int(x1), int(y1));
     }
@@ -350,7 +350,7 @@
     updateMappedValue(value);
 }
 
-void AudioDial::setDefaultMappedValue(float value)
+void AudioDial::setDefaultMappedValue(double value)
 {
     m_defaultMappedValue = value;
     if (m_rangeMapper) {
@@ -358,7 +358,7 @@
     }
 }
 
-void AudioDial::setMappedValue(float mappedValue)
+void AudioDial::setMappedValue(double mappedValue)
 {
     if (m_rangeMapper) {
         int newPosition = m_rangeMapper->getPositionForValue(mappedValue);
@@ -387,7 +387,7 @@
 }
 
 
-float AudioDial::mappedValue() const
+double AudioDial::mappedValue() const
 {
     if (m_rangeMapper) {
 //        SVDEBUG << "AudioDial::mappedValue(): value = " << value() << ", mappedValue = " << m_mappedValue << endl;
@@ -464,11 +464,11 @@
 
     if (m_rangeMapper) {
         
-        float min = m_rangeMapper->getValueForPosition(minimum());
-        float max = m_rangeMapper->getValueForPosition(maximum());
+        double min = m_rangeMapper->getValueForPosition(minimum());
+        double max = m_rangeMapper->getValueForPosition(maximum());
         
         if (min > max) { 
-            float tmp = min;
+            double tmp = min;
             min = max;
             max = tmp;
         }
@@ -494,7 +494,7 @@
             }
         }
         
-        float newValue = QInputDialog::getDouble
+        double newValue = QInputDialog::getDouble
             (this,
              tr("Enter new value"),
              text,