From ddba403e149d6fbd202caff3fd4f9ac76eda19c9 Mon Sep 17 00:00:00 2001 From: James H Ball Date: Wed, 21 Aug 2024 13:43:30 +0100 Subject: [PATCH] Close visualiser settings when going from new to legacy visualiser --- Source/PluginEditor.cpp | 4 ++++ Source/components/VisualiserComponent.cpp | 4 ++++ Source/components/VisualiserComponent.h | 1 + 3 files changed, 9 insertions(+) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 19b50aa..4eb3581 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -108,6 +108,10 @@ OscirenderAudioProcessorEditor::OscirenderAudioProcessorEditor(OscirenderAudioPr visualiserSettingsWindow.toFront(true); }; + visualiser.closeSettings = [this] { + visualiserSettingsWindow.setVisible(false); + }; + visualiserSettingsWindow.setResizable(false, false); visualiserSettingsWindow.setUsingNativeTitleBar(true); visualiserSettings.setLookAndFeel(&getLookAndFeel()); diff --git a/Source/components/VisualiserComponent.cpp b/Source/components/VisualiserComponent.cpp index 2c5ff66..fb107f2 100644 --- a/Source/components/VisualiserComponent.cpp +++ b/Source/components/VisualiserComponent.cpp @@ -221,6 +221,9 @@ void VisualiserComponent::setVisualiserType(bool oldVisualiser) { } if (oldVisualiser) { browser.reset(); + if (closeSettings != nullptr) { + closeSettings(); + } } else { initialiseBrowser(); } @@ -345,6 +348,7 @@ void VisualiserComponent::popoutWindow() { auto visualiser = new VisualiserComponent(audioProcessor, settings, this, oldVisualiser); visualiser->settings.setLookAndFeel(&getLookAndFeel()); visualiser->openSettings = openSettings; + visualiser->closeSettings = closeSettings; child = visualiser; childChanged(); popOutButton.setVisible(false); diff --git a/Source/components/VisualiserComponent.h b/Source/components/VisualiserComponent.h index cab52ad..547d90a 100644 --- a/Source/components/VisualiserComponent.h +++ b/Source/components/VisualiserComponent.h @@ -22,6 +22,7 @@ public: ~VisualiserComponent() override; std::function openSettings; + std::function closeSettings; void childChanged(); void enableFullScreen();