diff framework/MainWindowBase.cpp @ 47:d97a7ed7aa39

* Add auto-alignment toggle to Document * Make MainWindowBase cope if there is no time ruler layer
author Chris Cannam
date Thu, 25 Oct 2007 11:32:54 +0000
parents 7fbe1c99d5d8
children 73f682a551dc
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Oct 24 16:43:20 2007 +0000
+++ b/framework/MainWindowBase.cpp	Thu Oct 25 11:32:54 2007 +0000
@@ -897,12 +897,9 @@
 
 	Pane *pane = command->getPane();
 
-	if (!m_timeRulerLayer) {
-	    m_timeRulerLayer = m_document->createMainModelLayer
-		(LayerFactory::TimeRuler);
-	}
-
-	m_document->addLayerToView(pane, m_timeRulerLayer);
+        if (m_timeRulerLayer) {
+            m_document->addLayerToView(pane, m_timeRulerLayer);
+        }
 
 	Layer *newLayer = m_document->createImportedLayer(newModel);
 
@@ -1865,7 +1862,7 @@
 MainWindowBase::layerAboutToBeDeleted(Layer *layer)
 {
 //    std::cerr << "MainWindowBase::layerAboutToBeDeleted(" << layer << ")" << std::endl;
-    if (layer == m_timeRulerLayer) {
+    if (m_timeRulerLayer && (layer == m_timeRulerLayer)) {
 //	std::cerr << "(this is the time ruler layer)" << std::endl;
 	m_timeRulerLayer = 0;
     }