changeset 2488:c18b837341ff

Merge from branch audio-source-refactor. This fixes #1969 Auditioning plugin is failing on Windows. Also somewhat modernises lifecycle management for plugins generally
author Chris Cannam
date Fri, 03 Apr 2020 12:25:17 +0100
parents 9a46bac7de52 (diff) 266d2fc815f4 (current diff)
children 612eed7050a0 f67b7a489f75
files repoint-lock.json repoint-project.json
diffstat 6 files changed, 139 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGELOG	Mon Mar 23 14:16:11 2020 +0000
+++ b/CHANGELOG	Fri Apr 03 12:25:17 2020 +0100
@@ -1,3 +1,19 @@
+
+Changes in Sonic Visualiser v4.1 (April 2020) since the previous release 4.0.1:
+
+ - Support "dark mode" on Windows and Linux as well as macOS
+
+ - Add right-click (or Ctrl-click, on the Mac) context menus to the
+   layer property tabs, pane zoom controls, and all dial controls,
+   providing some basic edit and reset functions
+
+ - Provide format options when exporting layers to CSV, allowing
+   control over column separator, header row, and timestamp forma
+
+ - Add export of spectrogram data to CSV formats
+
+ - Fix missing undo/redo of layer renames
+
 
 Changes in Sonic Visualiser v4.0.1 (10 Dec 2019) since the previous release 4.0:
 
--- a/deploy/win64/generate-wxs.ps1	Mon Mar 23 14:16:11 2020 +0000
+++ b/deploy/win64/generate-wxs.ps1	Fri Apr 03 12:25:17 2020 +0100
@@ -2,13 +2,23 @@
 Set-StrictMode -Version 2.0
 $ErrorActionPreference = "Stop"
 
-$redist_ver = "14.24.28127"
+$redist_parent_dir = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\"
+
+$redists = (Get-ChildItem -Path $redist_parent_dir -Name -Include 14.* -Attributes Directory)
+
+if (!$redists) {
+    echo "ERROR: No 14.x redistributable directories found under $redist_parent_dir"
+    exit 1
+}
+
+$redist_ver = $redists[-1]
+
 $version = (Get-Content version.h) -replace '#define SV_VERSION ','' -replace '"',''
 $wxs = "deploy\win64\sonic-visualiser.wxs"
 
 $in = "$wxs.in"
 
-$redist_dir="C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Redist\MSVC\$redist_ver\x64\Microsoft.VC142.CRT"
+$redist_dir="$redist_parent_dir\$redist_ver\x64\Microsoft.VC142.CRT"
 
 echo "Generating $wxs..."
 echo " ...for SV version $version"
--- a/main/MainWindow.cpp	Mon Mar 23 14:16:11 2020 +0000
+++ b/main/MainWindow.cpp	Fri Apr 03 12:25:17 2020 +0100
@@ -84,6 +84,7 @@
 #include "layer/ColourDatabase.h"
 #include "widgets/ModelDataTableDialog.h"
 #include "widgets/CSVExportDialog.h"
+#include "widgets/MenuTitle.h"
 #include "rdf/PluginRDFIndexer.h"
 
 #include "Surveyer.h"
@@ -126,6 +127,7 @@
 #include <QDialogButtonBox>
 #include <QFileSystemWatcher>
 #include <QTextEdit>
+#include <QWidgetAction>
 
 #include <iostream>
 #include <cstdio>
@@ -153,6 +155,7 @@
     m_rightButtonLayerMenu(nullptr),
     m_rightButtonTransformsMenu(nullptr),
     m_rightButtonPlaybackMenu(nullptr),
+    m_lastRightButtonPropertyMenu(nullptr),
     m_soloAction(nullptr),
     m_rwdStartAction(nullptr),
     m_rwdSimilarAction(nullptr),
@@ -4359,20 +4362,32 @@
 MainWindow::renameCurrentLayer()
 {
     Pane *pane = m_paneStack->getCurrentPane();
-    if (pane) {
-        Layer *layer = pane->getSelectedLayer();
-        if (layer) {
-            bool ok = false;
-            QString newName = QInputDialog::getText
-                (this, tr("Rename Layer"),
-                 tr("New name for this layer:"),
-                 QLineEdit::Normal, layer->objectName(), &ok);
-            if (ok) {
-                layer->setPresentationName(newName);
-                setupExistingLayersMenus();
-            }
-        }
-    }
+    if (!pane) return;
+    
+    Layer *layer = pane->getSelectedLayer();
+    if (!layer) return;
+    
+    bool ok = false;
+    QString newName = QInputDialog::getText
+        (this, tr("Rename Layer"),
+         tr("New name for this layer:"),
+         QLineEdit::Normal, layer->objectName(), &ok);
+    if (!ok) return;
+            
+    bool existingNameSet = layer->isPresentationNameSet();
+    QString existingName = layer->getLayerPresentationName();
+
+    CommandHistory::getInstance()->addCommand
+        (new GenericCommand
+         (tr("Rename Layer"),
+          [=]() {
+              layer->setPresentationName(newName);
+              setupExistingLayersMenus();
+          },
+          [=]() {
+              layer->setPresentationName(existingNameSet ? existingName : "");
+              setupExistingLayersMenus();
+          }));
 }
 
 void
@@ -5050,14 +5065,84 @@
 }
 
 void
-MainWindow::rightButtonMenuRequested(Pane *pane, QPoint position)
+MainWindow::paneRightButtonMenuRequested(Pane *pane, QPoint position)
 {
-//    SVDEBUG << "MainWindow::rightButtonMenuRequested(" << pane << ", " << position.x() << ", " << position.y() << ")" << endl;
     m_paneStack->setCurrentPane(pane);
     m_rightButtonMenu->popup(position);
 }
 
 void
+MainWindow::panePropertiesRightButtonMenuRequested(Pane *pane, QPoint position)
+{
+    if (m_lastRightButtonPropertyMenu) {
+        delete m_lastRightButtonPropertyMenu;
+    }
+
+    m_paneStack->setCurrentLayer(pane, nullptr);
+    
+    QMenu *m = new QMenu;
+    IconLoader il;
+
+    MenuTitle::addTitle(m, tr("Pane"));
+
+    // We repeat the setCurrentLayer call here just in case some
+    // unexpected UI interaction (scripting?) changes it while the
+    // menu is visible
+    
+    m->addAction(il.load("editdelete"),
+                 tr("&Delete Pane"),
+                 [=]() {
+                     m_paneStack->setCurrentLayer(pane, nullptr);
+                     deleteCurrentPane();
+                 });
+
+    m->popup(position);
+    m_lastRightButtonPropertyMenu = m;
+}
+
+void
+MainWindow::layerPropertiesRightButtonMenuRequested(Pane *pane, Layer *layer, QPoint position)
+{
+    if (m_lastRightButtonPropertyMenu) {
+        delete m_lastRightButtonPropertyMenu;
+    }
+
+    m_paneStack->setCurrentLayer(pane, layer);
+    
+    QMenu *m = new QMenu;
+    IconLoader il;
+
+    MenuTitle::addTitle(m, layer->getLayerPresentationName());
+
+    // We repeat the setCurrentLayer calls here just in case some
+    // unexpected UI interaction (scripting?) changes it while the
+    // menu is visible
+    
+    m->addAction(tr("&Rename Layer..."),
+                 [=]() {
+                     m_paneStack->setCurrentLayer(pane, layer);
+                     renameCurrentLayer();
+                 });
+
+    m->addAction(tr("Edit Layer Data"),
+                 [=]() {
+                     m_paneStack->setCurrentLayer(pane, layer);
+                     editCurrentLayer();
+                 })
+        ->setEnabled(layer->isLayerEditable());
+    
+    m->addAction(il.load("editdelete"),
+                 tr("&Delete Layer"),
+                 [=]() {
+                     m_paneStack->setCurrentLayer(pane, layer);
+                     deleteCurrentLayer();
+                 });
+
+    m->popup(position);
+    m_lastRightButtonPropertyMenu = m;
+}
+
+void
 MainWindow::showLayerTree()
 {
     if (!m_layerTreeDialog.isNull()) {
--- a/main/MainWindow.h	Mon Mar 23 14:16:11 2020 +0000
+++ b/main/MainWindow.h	Fri Apr 03 12:25:17 2020 +0100
@@ -101,7 +101,9 @@
     void modelRegenerationWarning(QString, QString, QString) override;
     void alignmentFailed(QString) override;
 
-    void rightButtonMenuRequested(Pane *, QPoint point) override;
+    void paneRightButtonMenuRequested(Pane *, QPoint point) override;
+    void panePropertiesRightButtonMenuRequested(Pane *, QPoint point) override;
+    void layerPropertiesRightButtonMenuRequested(Pane *, Layer *, QPoint point) override;
 
     virtual void propertyStacksResized(int);
 
@@ -190,6 +192,7 @@
     QMenu                   *m_rightButtonLayerMenu;
     QMenu                   *m_rightButtonTransformsMenu;
     QMenu                   *m_rightButtonPlaybackMenu;
+    QMenu                   *m_lastRightButtonPropertyMenu;
 
     QAction                 *m_deleteSelectedAction;
     QAction                 *m_soloAction;
--- a/repoint-lock.json	Mon Mar 23 14:16:11 2020 +0000
+++ b/repoint-lock.json	Fri Apr 03 12:25:17 2020 +0100
@@ -4,13 +4,13 @@
       "pin": "74c5b0bfa108"
     },
     "svcore": {
-      "pin": "5f8fbbde08ff"
+      "pin": "7c92c644db20"
     },
     "svgui": {
-      "pin": "11660e0c896f"
+      "pin": "1da52d5e6700"
     },
     "svapp": {
-      "pin": "6508d9d216c7"
+      "pin": "771ec060c1d2"
     },
     "checker": {
       "pin": "ef64b3f171d9"
--- a/repoint-project.json	Mon Mar 23 14:16:11 2020 +0000
+++ b/repoint-project.json	Fri Apr 03 12:25:17 2020 +0100
@@ -16,18 +16,15 @@
         },
         "svcore": {
             "vcs": "hg",
-            "service": "soundsoftware",
-            "branch": "audio-source-refactor"
+            "service": "soundsoftware"
         },
         "svgui": {
             "vcs": "hg",
-            "service": "soundsoftware",
-            "branch": "audio-source-refactor"
+            "service": "soundsoftware"
         },
         "svapp": {
             "vcs": "hg",
-	    "service": "soundsoftware",
-            "branch": "audio-source-refactor"
+	    "service": "soundsoftware"
         },
         "checker": {
             "vcs": "hg",