diff framework/MainWindowBase.cpp @ 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 b23bebfdfaba
children a558a3fb44fc
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