changeset 1419:e7e626a87a1e scale-ticks

SVDEBUG, though it turns out not to be very useful
author Chris Cannam
date Thu, 04 May 2017 19:20:24 +0100
parents e7cb4fb2aee4
children a533662c17f4
files base/ScaleTickIntervals.h
diffstat 1 files changed, 34 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/base/ScaleTickIntervals.h	Thu May 04 15:37:43 2017 +0100
+++ b/base/ScaleTickIntervals.h	Thu May 04 19:20:24 2017 +0100
@@ -20,13 +20,11 @@
 #include <vector>
 #include <cmath>
 
-#define DEBUG_SCALE_TICK_INTERVALS 1
+#include "LogRange.h"
+#include "Debug.h"
 
-#ifdef DEBUG_SCALE_TICK_INTERVALS
-#include <iostream>
-#endif
-
-#include "LogRange.h"
+// Can't have this on by default, as we're called on every refresh
+//#define DEBUG_SCALE_TICK_INTERVALS 1
 
 class ScaleTickIntervals
 {
@@ -134,14 +132,16 @@
         }
 
 #ifdef DEBUG_SCALE_TICK_INTERVALS
-        std::cerr << "\nmin = " << r.min << ", max = " << r.max << ", n = " << r.n
-                  << ", inc = " << inc << std::endl;
-        std::cerr << "digMax = " << digMax << ", digInc = " << digInc
-                  << std::endl;
-        std::cerr << "display = " << display << ", inc = " << inc
-                  << ", precInc = " << precInc << ", precRange = " << precRange
-                  << ", prec = " << prec << std::endl;
-        std::cerr << "roundTo = " << roundTo << std::endl;
+        SVDEBUG << "ScaleTickIntervals: calculating linearInstruction" << endl
+                << "ScaleTickIntervals: min = " << r.min << ", max = " << r.max
+                << ", n = " << r.n << ", inc = " << inc << endl;
+        SVDEBUG << "ScaleTickIntervals: digMax = " << digMax
+                << ", digInc = " << digInc << endl;
+        SVDEBUG << "ScaleTickIntervals: display = " << display
+                << ", inc = " << inc << ", precInc = " << precInc
+                << ", precRange = " << precRange
+                << ", prec = " << prec << ", roundTo = " << roundTo
+                << endl;
 #endif
 
         double min = r.min;
@@ -158,8 +158,7 @@
             if (digNewMin < digInc) {
                 prec = int(ceil(digMax - digNewMin));
 #ifdef DEBUG_SCALE_TICK_INTERVALS
-                std::cerr << "min is smaller than increment, adjusting prec to "
-                          << prec << std::endl;
+                SVDEBUG << "ScaleTickIntervals: min is smaller than increment, adjusting prec to " << prec << endl;
 #endif
             }
         }
@@ -213,15 +212,17 @@
             display = Fixed;
             if (prec == 0) prec = 1;
         }
-        
+
 #ifdef DEBUG_SCALE_TICK_INTERVALS
-        std::cerr << "\nmin = " << r.min << ", max = " << r.max << ", n = " << r.n
-                  << ", inc = " << inc << ", minDispInc = " << minDispInc
-                  << ", digInc = " << digInc << std::endl;
-        std::cerr << "display = " << display << ", inc = " << inc
-                  << ", precInc = " << precInc
-                  << ", prec = " << prec << std::endl;
-        std::cerr << "roundTo = " << roundTo << std::endl;
+        SVDEBUG << "ScaleTickIntervals: calculating logInstruction" << endl
+                << "ScaleTickIntervals: min = " << r.min << ", max = " << r.max
+                << ", n = " << r.n << ", inc = " << inc
+                << ", minDispInc = " << minDispInc << ", digInc = " << digInc
+                << endl;
+        SVDEBUG << "ScaleTickIntervals: display = " << display
+                << ", inc = " << inc << ", precInc = " << precInc
+                << ", prec = " << prec << endl;
+        SVDEBUG << "ScaleTickIntervals: roundTo = " << roundTo << endl;
 #endif
         
 	double min = r.min;
@@ -259,14 +260,15 @@
     static Ticks explode(Instruction instruction) {
 
 #ifdef DEBUG_SCALE_TICK_INTERVALS
-	std::cerr << "initial = " << instruction.initial
-                  << ", limit = " << instruction.limit
-                  << ", spacing = " << instruction.spacing
-		  << ", roundTo = " << instruction.roundTo
-                  << ", display = " << instruction.display
-		  << ", precision = " << instruction.precision
-                  << ", logUnmap = " << instruction.logUnmap
-                  << std::endl;
+	SVDEBUG << "ScaleTickIntervals::explode:" << endl
+                << "initial = " << instruction.initial
+                << ", limit = " << instruction.limit
+                << ", spacing = " << instruction.spacing
+                << ", roundTo = " << instruction.roundTo
+                << ", display = " << instruction.display
+                << ", precision = " << instruction.precision
+                << ", logUnmap = " << instruction.logUnmap
+                << endl;
 #endif
 
         if (instruction.spacing == 0.0) {