changeset 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 558c71a802d4
children 4ce1dbeaf9ab
files view/View.cpp
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
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;
     }