changeset 597:f03bc1d38cac

Make "Select All" select the whole span of everything that exists, not just the main model (toward SF bug #243 Copied Time Instant Layer does not include instant at end of track)
author Chris Cannam
date Thu, 19 Apr 2018 13:17:42 +0100
parents c99892f0c5c3
children 7da68349a0c5
files framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 2 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Apr 18 15:19:09 2018 +0100
+++ b/framework/MainWindowBase.cpp	Thu Apr 19 13:17:42 2018 +0100
@@ -842,12 +842,40 @@
     updateVisibleRangeDisplay(p);
 }
 
+sv_frame_t
+MainWindowBase::getModelsStartFrame() const
+{
+    sv_frame_t startFrame = 0;
+    if (!m_paneStack) return startFrame;
+    for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+        sv_frame_t thisStart = m_paneStack->getPane(i)->getModelsStartFrame();
+        if (i == 0 || thisStart < startFrame) {
+            startFrame = thisStart;
+        }
+    }
+    return startFrame;
+}
+
+sv_frame_t
+MainWindowBase::getModelsEndFrame() const
+{
+    sv_frame_t endFrame = 0;
+    if (!m_paneStack) return endFrame;
+    for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+        sv_frame_t thisEnd = m_paneStack->getPane(i)->getModelsEndFrame();
+        if (i == 0 || thisEnd > endFrame) {
+            endFrame = thisEnd;
+        }
+    }
+    return endFrame;
+}
+
 void
 MainWindowBase::selectAll()
 {
     if (!getMainModel()) return;
-    m_viewManager->setSelection(Selection(getMainModel()->getStartFrame(),
-                                          getMainModel()->getEndFrame()));
+    m_viewManager->setSelection(Selection(getModelsStartFrame(),
+                                          getModelsEndFrame()));
 }
 
 void
--- a/framework/MainWindowBase.h	Wed Apr 18 15:19:09 2018 +0100
+++ b/framework/MainWindowBase.h	Thu Apr 19 13:17:42 2018 +0100
@@ -396,6 +396,9 @@
     const WaveFileModel *getMainModel() const;
     void createDocument();
 
+    sv_frame_t getModelsStartFrame() const; // earliest across all views
+    sv_frame_t getModelsEndFrame() const; // latest across all views
+    
     Pane *addPaneToStack();
     Layer *getSnapLayer() const;