# HG changeset patch # User Chris Cannam # Date 1184342057 0 # Node ID 3101c68a00c1a8580e986461b9bd693aca4542a5 # Parent 4ca7562dd24672aa2f005545eb20d3b7db61fdff * Restore Scale setting which had mistakenly disappeared from spectrum * Some tweaks to spectrum peaks * Make spectrum default to 4096/75%... or is that overdoing it? * Show harmonic cursor even during playback if in measure mode and mouse in relevant pane * Avoid crash when trying to measure a non-layer * Various adjustments to some icons to make them look better in white-on-black schemes diff -r 4ca7562dd246 -r 3101c68a00c1 layer/SliceLayer.cpp --- a/layer/SliceLayer.cpp Fri Jul 13 13:19:15 2007 +0000 +++ b/layer/SliceLayer.cpp Fri Jul 13 15:54:17 2007 +0000 @@ -267,7 +267,7 @@ break; default: - std::cerr << "thresh = " << m_threshold << std::endl; +// std::cerr << "thresh = " << m_threshold << std::endl; norm = (fabsf(value) - m_threshold); if (norm < 0) norm = 0; y = yorigin - (float(h) * norm); @@ -565,7 +565,7 @@ SliceLayer::getPropertyLabel(const PropertyName &name) const { if (name == "Plot Type") return tr("Plot Type"); - if (name == "Energy Scale") return tr("Scale"); + if (name == "Scale") return tr("Scale"); if (name == "Normalize") return tr("Normalize"); if (name == "Threshold") return tr("Threshold"); if (name == "Gain") return tr("Gain"); @@ -581,7 +581,7 @@ if (name == "Normalize") return ToggleProperty; if (name == "Threshold") return RangeProperty; if (name == "Plot Type") return ValueProperty; - if (name == "Energy Scale") return ValueProperty; + if (name == "Scale") return ValueProperty; if (name == "Sampling Mode") return ValueProperty; if (name == "Bin Scale") return ValueProperty; if (name == "Colour" && m_plotStyle == PlotFilledBlocks) return ValueProperty; diff -r 4ca7562dd246 -r 3101c68a00c1 layer/SpectrumLayer.cpp --- a/layer/SpectrumLayer.cpp Fri Jul 13 13:19:15 2007 +0000 +++ b/layer/SpectrumLayer.cpp Fri Jul 13 15:54:17 2007 +0000 @@ -29,9 +29,9 @@ m_originModel(0), m_channel(-1), m_channelSet(false), - m_windowSize(1024), + m_windowSize(4096), m_windowType(HanningWindow), - m_windowHopLevel(2), + m_windowHopLevel(3), m_showPeaks(false), m_newFFTNeeded(true) { @@ -658,8 +658,13 @@ paint.setRenderHint(QPainter::Antialiasing, false); paint.setPen(QColor(160, 160, 160)); //!!! + int peakminbin = 0; + int peakmaxbin = fft->getHeight() - 1; + float peakmaxfreq = Pitch::getFrequencyForPitch(128); + peakmaxbin = ((peakmaxfreq * fft->getHeight() * 2) / fft->getSampleRate()); + FFTModel::PeakSet peaks = fft->getPeakFrequencies - (FFTModel::MajorPitchAdaptivePeaks, col); + (FFTModel::MajorPitchAdaptivePeaks, col, peakminbin, peakmaxbin); ColourMapper mapper(ColourMapper::BlackOnWhite, 0, 1); diff -r 4ca7562dd246 -r 3101c68a00c1 view/Pane.cpp --- a/view/Pane.cpp Fri Jul 13 13:19:15 2007 +0000 +++ b/view/Pane.cpp Fri Jul 13 15:54:17 2007 +0000 @@ -61,7 +61,8 @@ m_vpan(0), m_hthumb(0), m_vthumb(0), - m_reset(0) + m_reset(0), + m_mouseInWidget(false) { setObjectName("Pane"); setMouseTracking(true); @@ -380,7 +381,8 @@ ViewManager::ToolMode toolMode = m_manager->getToolMode(); if (m_manager && - !m_manager->isPlaying() && +// !m_manager->isPlaying() && + m_mouseInWidget && toolMode == ViewManager::MeasureMode) { for (LayerList::iterator vi = m_layers.end(); vi != m_layers.begin(); ) { @@ -1360,8 +1362,10 @@ if (m_measureCursor2) setCursor(*m_measureCursor2); Layer *layer = getTopLayer(); - if (layer) layer->measureDrag(this, e); - if (layer->hasTimeXAxis()) edgeScrollMaybe(e->x()); + if (layer) { + layer->measureDrag(this, e); + if (layer->hasTimeXAxis()) edgeScrollMaybe(e->x()); + } update(); } @@ -1676,8 +1680,15 @@ } void +Pane::enterEvent(QEvent *) +{ + m_mouseInWidget = true; +} + +void Pane::leaveEvent(QEvent *) { + m_mouseInWidget = false; bool previouslyIdentifying = m_identifyFeatures; m_identifyFeatures = false; if (previouslyIdentifying) update(); diff -r 4ca7562dd246 -r 3101c68a00c1 view/Pane.h --- a/view/Pane.h Fri Jul 13 13:19:15 2007 +0000 +++ b/view/Pane.h Fri Jul 13 15:54:17 2007 +0000 @@ -89,6 +89,7 @@ virtual void mouseReleaseEvent(QMouseEvent *e); virtual void mouseMoveEvent(QMouseEvent *e); virtual void mouseDoubleClickEvent(QMouseEvent *e); + virtual void enterEvent(QEvent *e); virtual void leaveEvent(QEvent *e); virtual void wheelEvent(QWheelEvent *e); virtual void resizeEvent(QResizeEvent *e); @@ -156,6 +157,8 @@ Thumbwheel *m_vthumb; NotifyingPushButton *m_reset; + bool m_mouseInWidget; + static QCursor *m_measureCursor1; static QCursor *m_measureCursor2; }; diff -r 4ca7562dd246 -r 3101c68a00c1 widgets/PropertyBox.cpp --- a/widgets/PropertyBox.cpp Fri Jul 13 13:19:15 2007 +0000 +++ b/widgets/PropertyBox.cpp Fri Jul 13 15:54:17 2007 +0000 @@ -443,6 +443,9 @@ cb->setEditable(true); } else { // ColourProperty + + //!!! should be a proper colour combobox class that + // manages its own Add New Colour entry... ColourDatabase *db = ColourDatabase::getInstance(); for (size_t i = 0; i < db->getColourCount(); ++i) {