changeset 2332:1057ae621c87 time-frequency-boxes

Rename time-frequency box to plain box; have it adopt the unit from the layer beneath if created empty
author Chris Cannam
date Wed, 25 Sep 2019 09:53:15 +0100
parents 10f7d8210957
children 2721030c939f
files main/MainWindow.cpp repoint-lock.json sonic-visualiser.qrc
diffstat 3 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Tue Sep 24 11:33:57 2019 +0100
+++ b/main/MainWindow.cpp	Wed Sep 25 09:53:15 2019 +0100
@@ -4020,16 +4020,13 @@
 
         Layer *newLayer = nullptr;
 
+        bool isNewEmptyLayer = false;
+        
         if (emptyTypes.find(type) != emptyTypes.end()) {
 
             newLayer = m_document->createEmptyLayer(type);
             if (newLayer) {
-                for (auto &a : m_toolActions) {
-                    if (a.first == ViewManager::DrawMode) {
-                        a.second->trigger();
-                        break;
-                    }
-                }
+                isNewEmptyLayer = true;
             }
 
         } else {
@@ -4068,6 +4065,23 @@
             }
         }
 
+        if (isNewEmptyLayer) {
+
+            double vmin, vmax, dmin, dmax;
+            QString unit;
+            if (pane->getTopLayerDisplayExtents
+                (vmin, vmax, dmin, dmax, &unit)) {
+                newLayer->adoptExtents(vmin, vmax, unit);
+            }
+            
+            for (auto &a : m_toolActions) {
+                if (a.first == ViewManager::DrawMode) {
+                    a.second->trigger();
+                    break;
+                }
+            }
+        }
+
         if (newLayer) {
             m_document->addLayerToView(pane, newLayer);
             m_paneStack->setCurrentLayer(pane, newLayer);
--- a/repoint-lock.json	Tue Sep 24 11:33:57 2019 +0100
+++ b/repoint-lock.json	Wed Sep 25 09:53:15 2019 +0100
@@ -4,13 +4,13 @@
       "pin": "0b6802e3b755"
     },
     "svcore": {
-      "pin": "baafe1bb7e51"
+      "pin": "c2388289fce8"
     },
     "svgui": {
-      "pin": "c5d2de8f7647"
+      "pin": "4eafe5a1b655"
     },
     "svapp": {
-      "pin": "dde6ff56a84b"
+      "pin": "3e930ea94db6"
     },
     "checker": {
       "pin": "c8c17e51aab0"
@@ -46,7 +46,7 @@
       "pin": "f3731af47c4b"
     },
     "icons/scalable": {
-      "pin": "a5a304f7bd01"
+      "pin": "be45984f7915"
     }
   }
 }
--- a/sonic-visualiser.qrc	Tue Sep 24 11:33:57 2019 +0100
+++ b/sonic-visualiser.qrc	Wed Sep 25 09:53:15 2019 +0100
@@ -61,7 +61,7 @@
     <file>icons/scalable/smooth.svg</file>
     <file>icons/scalable/invert-colour.svg</file>
     <file>icons/scalable/values.svg</file>
-    <file>icons/scalable/timefreq.svg</file>
+    <file>icons/scalable/boxes.svg</file>
     <file>icons/scalable/waveform.svg</file>
     <file>icons/scalable/zoom.svg</file>
     <file>icons/scalable/zoom-in.svg</file>