changeset 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 70b2681665a7
children fe83e6e68683
files framework/MainWindowBase.cpp framework/MainWindowBase.h
diffstat 2 files changed, 42 insertions(+), 0 deletions(-) [+]
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()) {
--- a/framework/MainWindowBase.h	Fri Oct 08 13:30:56 2010 +0100
+++ b/framework/MainWindowBase.h	Sun Oct 24 17:39:00 2010 +0200
@@ -171,6 +171,7 @@
     virtual void showStandardOverlays();
     virtual void showAllOverlays();
 
+    virtual void toggleTimeRulers();
     virtual void toggleZoomWheels();
     virtual void togglePropertyBoxes();
     virtual void toggleStatusBar();