diff view/View.cpp @ 733:87512dacc4bd tonioni

Do not return a dormant layer as the currently-selected layer
author Chris Cannam
date Wed, 05 Mar 2014 13:44:10 +0000
parents 596414d20ef0
children fe59d97750ba
line wrap: on
line diff
--- a/view/View.cpp	Wed Mar 05 13:04:09 2014 +0000
+++ b/view/View.cpp	Wed Mar 05 13:44:10 2014 +0000
@@ -626,7 +626,15 @@
 View::getSelectedLayer()
 {
     if (m_haveSelectedLayer && !m_layers.empty()) {
-	return getLayer(getLayerCount() - 1);
+        int n = getLayerCount();
+        while (n > 0) {
+            --n;
+            Layer *layer = getLayer(n);
+            if (!(layer->isLayerDormant(this))) {
+                return layer;
+            }
+        }
+        return 0;
     } else {
 	return 0;
     }