changeset 314:7b96a3261e1c

* "Align mode"
author Chris Cannam
date Tue, 16 Oct 2007 18:42:51 +0000
parents 1517c76cd678
children c30a7cd29f4a
files view/View.cpp view/ViewManager.cpp view/ViewManager.h
diffstat 3 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/view/View.cpp	Tue Oct 16 15:13:41 2007 +0000
+++ b/view/View.cpp	Tue Oct 16 18:42:51 2007 +0000
@@ -1055,7 +1055,10 @@
 View::getAlignedPlaybackFrame() const
 {
     if (!m_manager) return 0;
-    if (!m_manager->getPlaybackModel()) return m_manager->getPlaybackFrame();
+    if (!m_manager->getAlignMode() ||
+        !m_manager->getPlaybackModel()) {
+        return m_manager->getPlaybackFrame();
+    }
 
     RangeSummarisableTimeValueModel *waveformModel = 0;
     for (LayerList::const_iterator i = m_layers.begin(); i != m_layers.end(); ++i) {
--- a/view/ViewManager.cpp	Tue Oct 16 15:13:41 2007 +0000
+++ b/view/ViewManager.cpp	Tue Oct 16 18:42:51 2007 +0000
@@ -40,6 +40,7 @@
     m_playLoopMode(false),
     m_playSelectionMode(false),
     m_playSoloMode(false),
+    m_alignMode(false),
     m_overlayMode(StandardOverlays),
     m_zoomWheelsEnabled(true),
     m_lightPalette(QApplication::palette()),
@@ -358,6 +359,18 @@
     }
 }
 
+void
+ViewManager::setAlignMode(bool mode)
+{
+    if (m_alignMode != mode) {
+
+        m_alignMode = mode;
+
+        emit alignModeChanged();
+        emit alignModeChanged(mode);
+    }
+}
+
 size_t 
 ViewManager::getPlaybackSampleRate() const
 {
--- a/view/ViewManager.h	Tue Oct 16 15:13:41 2007 +0000
+++ b/view/ViewManager.h	Tue Oct 16 18:42:51 2007 +0000
@@ -112,6 +112,9 @@
     bool getPlaySoloMode() const { return m_playSoloMode; }
     void setPlaySoloMode(bool on);
 
+    bool getAlignMode() const { return m_alignMode; }
+    void setAlignMode(bool on);
+
     /**
      * The sample rate that is used for playback.  This is usually the
      * rate of the main model, but not always.  Models whose rates
@@ -210,6 +213,10 @@
     void playSoloModeChanged();
     void playSoloModeChanged(bool);
 
+    /** Emitted when the alignment mode has been changed. */
+    void alignModeChanged();
+    void alignModeChanged(bool);
+
     /** Emitted when the overlay mode has been changed. */
     void overlayModeChanged();
 
@@ -248,6 +255,7 @@
     bool m_playLoopMode;
     bool m_playSelectionMode;
     bool m_playSoloMode;
+    bool m_alignMode;
 
     void setSelections(const MultiSelection &ms);
     void signalSelectionChange();