Mercurial > hg > svgui
changeset 180:29f01de27db4
* Add vertical zooming and snap-to-selection for OSC control;
add a demo script
author | Chris Cannam |
---|---|
date | Wed, 15 Nov 2006 18:22:26 +0000 |
parents | 6a0d54f3f21a |
children | c4d407272010 |
files | layer/Layer.h layer/SpectrogramLayer.cpp view/PaneStack.cpp view/PaneStack.h view/View.cpp view/ViewManager.cpp view/ViewManager.h |
diffstat | 7 files changed, 28 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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);
--- 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(); }
--- 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 *);
--- 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
--- 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 <iostream> -// #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 {
--- 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;