diff framework/MainWindowBase.cpp @ 211:84422236db20

* Add function to toggle all time ruler display on and off at once
author Chris Cannam
date Sun, 24 Oct 2010 17:39:00 +0200
parents 944af6246560
children eed79c69be61
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Fri Oct 08 13:30:56 2010 +0100
+++ b/framework/MainWindowBase.cpp	Sun Oct 24 17:39:00 2010 +0200
@@ -2038,6 +2038,47 @@
 }
 
 void
+MainWindowBase::toggleTimeRulers()
+{
+    bool haveRulers = false;
+    bool someHidden = false;
+
+    for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+
+        Pane *pane = m_paneStack->getPane(i);
+        if (!pane) continue;
+
+        for (int j = 0; j < pane->getLayerCount(); ++j) {
+
+            Layer *layer = pane->getLayer(j);
+            if (!dynamic_cast<TimeRulerLayer *>(layer)) continue;
+
+            haveRulers = true;
+            if (layer->isLayerDormant(pane)) someHidden = true;
+        }
+    }
+
+    if (haveRulers) {
+
+        bool show = someHidden;
+
+        for (int i = 0; i < m_paneStack->getPaneCount(); ++i) {
+
+            Pane *pane = m_paneStack->getPane(i);
+            if (!pane) continue;
+
+            for (int j = 0; j < pane->getLayerCount(); ++j) {
+
+                Layer *layer = pane->getLayer(j);
+                if (!dynamic_cast<TimeRulerLayer *>(layer)) continue;
+
+                layer->showLayer(pane, show);
+            }
+        }
+    }
+}
+
+void
 MainWindowBase::toggleZoomWheels()
 {
     if (m_viewManager->getZoomWheelsEnabled()) {