# HG changeset patch # User Chris Cannam # Date 1153414280 0 # Node ID a35098a9c8148fa85de53c785b8a8698c86fca7f # Parent 8ce30801f39afcbee9c6ca76ec13e3efbd0b27b9 * start work on prefs dialog * some work on highlighting local points in spectrogram diff -r 8ce30801f39a -r a35098a9c814 base/Preferences.cpp --- 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 + } +} + diff -r 8ce30801f39a -r a35098a9c814 base/Preferences.h --- a/base/Preferences.h Wed Jul 19 16:55:29 2006 +0000 +++ b/base/Preferences.h Thu Jul 20 16:51:20 2006 +0000 @@ -18,6 +18,8 @@ #include "PropertyContainer.h" +#include "Window.h" + class Preferences : public PropertyContainer { Q_OBJECT @@ -35,6 +37,7 @@ bool getSmoothSpectrogram() const { return m_smoothSpectrogram; } float getTuningFrequency() const { return m_tuningFrequency; } + WindowType getWindowType() const { return m_windowType; } //!!! harmonise with PaneStack enum PropertyBoxLayout { @@ -49,6 +52,7 @@ void setSmoothSpectrogram(bool smooth); void setTuningFrequency(float freq); void setPropertyBoxLayout(PropertyBoxLayout layout); + void setWindowType(WindowType type); private: Preferences(); @@ -59,6 +63,7 @@ bool m_smoothSpectrogram; float m_tuningFrequency; PropertyBoxLayout m_propertyBoxLayout; + WindowType m_windowType; }; #endif diff -r 8ce30801f39a -r a35098a9c814 base/View.cpp --- a/base/View.cpp Wed Jul 19 16:55:29 2006 +0000 +++ b/base/View.cpp Thu Jul 20 16:51:20 2006 +0000 @@ -31,7 +31,7 @@ #include #include -#define DEBUG_VIEW_WIDGET_PAINT 1 +//#define DEBUG_VIEW_WIDGET_PAINT 1 using std::cerr; using std::endl; diff -r 8ce30801f39a -r a35098a9c814 base/Window.h --- a/base/Window.h Wed Jul 19 16:55:29 2006 +0000 +++ b/base/Window.h Thu Jul 20 16:51:20 2006 +0000 @@ -53,6 +53,8 @@ for (size_t i = 0; i < m_size; ++i) dst[i] = src[i] * m_cache[i]; } + T getValue(size_t i) { return m_cache[i]; } + WindowType getType() const { return m_type; } size_t getSize() const { return m_size; }