diff base/Preferences.cpp @ 140:a35098a9c814

* start work on prefs dialog * some work on highlighting local points in spectrogram
author Chris Cannam
date Thu, 20 Jul 2006 16:51:20 +0000
parents 6332e41c1619
children 4f26f623a8bc
line wrap: on
line diff
--- a/base/Preferences.cpp	Wed Jul 19 16:55:29 2006 +0000
+++ b/base/Preferences.cpp	Thu Jul 20 16:51:20 2006 +0000
@@ -20,7 +20,9 @@
 
 Preferences::Preferences() :
     m_smoothSpectrogram(true),
-    m_tuningFrequency(440)
+    m_tuningFrequency(440),
+    m_propertyBoxLayout(VerticallyStacked),
+    m_windowType(HanningWindow)
 {
 }
 
@@ -31,6 +33,7 @@
     props.push_back("Smooth Spectrogram");
     props.push_back("Tuning Frequency");
     props.push_back("Property Box Layout");
+    props.push_back("Window Type");
     return props;
 }
 
@@ -46,6 +49,9 @@
     if (name == "Property Box Layout") {
         return tr("Arrangement of Layer Properties");
     }
+    if (name == "Window Type") {
+        return tr("Spectral Analysis Window Shape");
+    }
     return name;
 }
 
@@ -61,6 +67,9 @@
     if (name == "Property Box Layout") {
         return ValueProperty;
     }
+    if (name == "Window Type") {
+        return ValueProperty;
+    }
     return InvalidProperty;
 }
 
@@ -82,6 +91,12 @@
         return m_propertyBoxLayout == Layered ? 1 : 0;
     }        
 
+    if (name == "Window Type") {
+        if (min) *min = int(RectangularWindow);
+        if (max) *max = int(ParzenWindow);
+        return int(m_windowType);
+    }
+
     return 0;
 }
 
@@ -93,6 +108,17 @@
         if (value == 0) return tr("Vertically Stacked");
         else return tr("Layered");
     }
+    if (name == "Window Type") {
+        switch (WindowType(value)) {
+        case RectangularWindow: return tr("Rectangular");
+        case BartlettWindow: return tr("Bartlett");
+        case HammingWindow: return tr("Hamming");
+        case HanningWindow: return tr("Hanning");
+        case BlackmanWindow: return tr("Blackman");
+        case GaussianWindow: return tr("Gaussian");
+        case ParzenWindow: return tr("Parzen");
+        }
+    }
     return "";
 }
 
@@ -117,6 +143,8 @@
         //!!!
     } else if (name == "Property Box Layout") {
         setPropertyBoxLayout(value == 0 ? VerticallyStacked : Layered);
+    } else if (name == "Window Type") {
+        setWindowType(WindowType(value));
     }
 }
 
@@ -147,3 +175,12 @@
     }
 }
 
+void
+Preferences::setWindowType(WindowType type)
+{
+    if (m_windowType != type) {
+        m_windowType = type;
+        //!!! emit
+    }
+}
+