# HG changeset patch # User Chris Cannam # Date 1163614946 0 # Node ID 29f01de27db4edf8c19d03c16b971c642a096ca0 # Parent 6a0d54f3f21a57ba5fa74553da1fdb46a3b3475c * Add vertical zooming and snap-to-selection for OSC control; add a demo script diff -r 6a0d54f3f21a -r 29f01de27db4 layer/Layer.h --- a/layer/Layer.h Tue Nov 14 16:06:00 2006 +0000 +++ b/layer/Layer.h Wed Nov 15 18:22:26 2006 +0000 @@ -127,9 +127,9 @@ * calls to editStart etc. * * Return true if a suitable feature was found and frame adjusted - * accordingly. Return false if no suitable feature was - * available. Also return the resolution of the model in this - * layer in sample frames. + * accordingly. Return false if no suitable feature was available + * (and leave frame unmodified). Also return the resolution of + * the model in this layer in sample frames. */ virtual bool snapToFeatureFrame(View * /* v */, int & /* frame */, @@ -301,7 +301,11 @@ * If vertical zooming is not available, return 0. The meaning of * "zooming" is entirely up to the layer -- changing the zoom * level may cause the layer to reset its display extents or - * change another property such as display gain. + * change another property such as display gain. However, layers + * are advised for consistency to treat smaller zoom steps as + * "more distant" or "zoomed out" and larger ones as "closer" or + * "zoomed in". + * * Layers that provide this facility should also emit the * verticalZoomChanged signal if their vertical zoom changes * due to factors other than setVerticalZoomStep being called. diff -r 6a0d54f3f21a -r 29f01de27db4 layer/SpectrogramLayer.cpp --- a/layer/SpectrogramLayer.cpp Tue Nov 14 16:06:00 2006 +0000 +++ b/layer/SpectrogramLayer.cpp Wed Nov 15 18:22:26 2006 +0000 @@ -2188,8 +2188,8 @@ return; } - std::cerr << "SpectrogramLayer: illuminateLocalFeatures(" - << localPos.x() << "," << localPos.y() << ")" << std::endl; +// std::cerr << "SpectrogramLayer: illuminateLocalFeatures(" +// << localPos.x() << "," << localPos.y() << ")" << std::endl; float s0, s1; float f0, f1; @@ -2206,8 +2206,8 @@ int y1 = getYForFrequency(v, f1); int y0 = getYForFrequency(v, f0); - std::cerr << "SpectrogramLayer: illuminate " - << x0 << "," << y1 << " -> " << x1 << "," << y0 << std::endl; +// std::cerr << "SpectrogramLayer: illuminate " +// << x0 << "," << y1 << " -> " << x1 << "," << y0 << std::endl; paint.setPen(Qt::white); diff -r 6a0d54f3f21a -r 29f01de27db4 view/PaneStack.cpp --- a/view/PaneStack.cpp Tue Nov 14 16:06:00 2006 +0000 +++ b/view/PaneStack.cpp Wed Nov 15 18:22:26 2006 +0000 @@ -426,6 +426,8 @@ if (!m_panes[i].propertyStack) continue; m_panes[i].propertyStack->setMinimumWidth(setWidth); } + + emit propertyStacksResized(); } diff -r 6a0d54f3f21a -r 29f01de27db4 view/PaneStack.h --- a/view/PaneStack.h Tue Nov 14 16:06:00 2006 +0000 +++ b/view/PaneStack.h Wed Nov 15 18:22:26 2006 +0000 @@ -67,6 +67,7 @@ void currentPaneChanged(Pane *pane); void currentLayerChanged(Pane *pane, Layer *layer); void rightButtonMenuRequested(Pane *pane, QPoint position); + void propertyStacksResized(); public slots: void propertyContainerAdded(PropertyContainer *); diff -r 6a0d54f3f21a -r 29f01de27db4 view/View.cpp --- a/view/View.cpp Tue Nov 14 16:06:00 2006 +0000 +++ b/view/View.cpp Wed Nov 15 18:22:26 2006 +0000 @@ -771,7 +771,7 @@ case PlaybackScrollContinuous: if (QApplication::mouseButtons() == Qt::NoButton) { - setCentreFrame(f, false); + setCentreFrame(f, true); //!!! } break; @@ -1451,7 +1451,7 @@ } if (sampleRate && shouldLabelSelections() && m_manager && - m_manager->getOverlayMode() != ViewManager::NoOverlays) { + m_manager->getOverlayMode() == ViewManager::AllOverlays) { QString startText = QString("%1 / %2") .arg(QString::fromStdString diff -r 6a0d54f3f21a -r 29f01de27db4 view/ViewManager.cpp --- a/view/ViewManager.cpp Tue Nov 14 16:06:00 2006 +0000 +++ b/view/ViewManager.cpp Wed Nov 15 18:22:26 2006 +0000 @@ -22,7 +22,7 @@ #include -// #define DEBUG_VIEW_MANAGER 1 +//#define DEBUG_VIEW_MANAGER 1 ViewManager::ViewManager() : m_playSource(0), @@ -69,6 +69,15 @@ return m_globalCentreFrame; } +void +ViewManager::setGlobalCentreFrame(unsigned long f) +{ +#ifdef DEBUG_VIEW_MANAGER + std::cout << "ViewManager::setGlobalCentreFrame to " << f << std::endl; +#endif + m_globalCentreFrame = f; +} + unsigned long ViewManager::getGlobalZoom() const { diff -r 6a0d54f3f21a -r 29f01de27db4 view/ViewManager.h --- a/view/ViewManager.h Tue Nov 14 16:06:00 2006 +0000 +++ b/view/ViewManager.h Wed Nov 15 18:22:26 2006 +0000 @@ -50,6 +50,7 @@ bool isPlaying() const; unsigned long getGlobalCentreFrame() const; + void setGlobalCentreFrame(unsigned long); unsigned long getGlobalZoom() const; unsigned long getPlaybackFrame() const;