diff main/MainWindow.cpp @ 238:cdb227563bc1

* Add pitch range in octaves, semitones and cents to the measurement rect as well as in Hz * Avoid crash when adding time ruler This commit contains a lot of debug output (will be slow)
author Chris Cannam
date Wed, 06 Feb 2008 16:21:29 +0000
parents 198915eac073
children d936e3d77b95
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Feb 06 14:15:09 2008 +0000
+++ b/main/MainWindow.cpp	Wed Feb 06 16:21:29 2008 +0000
@@ -2903,20 +2903,24 @@
 
 	} else {
 
-//	    newLayer = m_document->createMainModelLayer(type);
-            newLayer = m_document->createLayer(type);
-            if (m_document->isKnownModel(i->second.sourceModel)) {
-                m_document->setChannel(newLayer, i->second.channel);
-                m_document->setModel(newLayer, i->second.sourceModel);
+            if (!i->second.sourceModel) {
+                // e.g. time ruler
+                newLayer = m_document->createMainModelLayer(type);
             } else {
-                std::cerr << "WARNING: MainWindow::addLayer: unknown model "
-                          << i->second.sourceModel
-                          << " (\""
-                          << i->second.sourceModel->objectName().toStdString()
-                          << "\") in layer action map"
-                          << std::endl;
+                newLayer = m_document->createLayer(type);
+                if (m_document->isKnownModel(i->second.sourceModel)) {
+                    m_document->setChannel(newLayer, i->second.channel);
+                    m_document->setModel(newLayer, i->second.sourceModel);
+                } else {
+                    std::cerr << "WARNING: MainWindow::addLayer: unknown model "
+                              << i->second.sourceModel
+                              << " (\""
+                              << (i->second.sourceModel ? i->second.sourceModel->objectName().toStdString() : "")
+                              << "\") in layer action map"
+                              << std::endl;
+                }
             }
-	}
+        }
 
         if (newLayer) {
             m_document->addLayerToView(pane, newLayer);