From 9d6da9bb2df233b63792b73cb3e9d71920481028 Mon Sep 17 00:00:00 2001 From: Roland Rabien Date: Fri, 1 Sep 2023 20:23:08 -0700 Subject: [PATCH] Added resizable UI --- Changelist.txt | 1 + modules/gin | 2 +- plugin/Source/PluginEditor.cpp | 15 +++++++++++++++ plugin/Source/PluginProcessor.cpp | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Changelist.txt b/Changelist.txt index aa64c61..cba363c 100644 --- a/Changelist.txt +++ b/Changelist.txt @@ -2,6 +2,7 @@ - Fixed pan when unison enabled - Fixed preset overwrite dialog not showing +- Added resizable UI 0.0.2: diff --git a/modules/gin b/modules/gin index abaff90..6844a00 160000 --- a/modules/gin +++ b/modules/gin @@ -1 +1 @@ -Subproject commit abaff906847b3dbc009f34e5d6deabbe51229c34 +Subproject commit 6844a00aaceb7555f0dd1e71bd25a22b6dfae235 diff --git a/plugin/Source/PluginEditor.cpp b/plugin/Source/PluginEditor.cpp index bc0967b..952f2ce 100644 --- a/plugin/Source/PluginEditor.cpp +++ b/plugin/Source/PluginEditor.cpp @@ -68,4 +68,19 @@ void WavetableAudioProcessorEditor::addMenuItems (juce::PopupMenu& m) { vaProc.globalParams.mpe->setUserValue (vaProc.globalParams.mpe->getUserValueBool() ? 0.0f : 1.0f); }); + + auto setSize = [this] (float scale) + { + if (auto p = findParentComponentOfClass()) + p->setScale (scale); + }; + + juce::PopupMenu um; + um.addItem ("50%", [setSize] { setSize (0.50f); }); + um.addItem ("75%", [setSize] { setSize (0.75f); }); + um.addItem ("100%", [setSize] { setSize (1.00f); }); + um.addItem ("150%", [setSize] { setSize (1.50f); }); + um.addItem ("200%", [setSize] { setSize (2.00f); }); + + m.addSubMenu ("UI Size", um); } diff --git a/plugin/Source/PluginProcessor.cpp b/plugin/Source/PluginProcessor.cpp index 8309eff..2ee8d94 100644 --- a/plugin/Source/PluginProcessor.cpp +++ b/plugin/Source/PluginProcessor.cpp @@ -932,7 +932,7 @@ bool WavetableAudioProcessor::hasEditor() const juce::AudioProcessorEditor* WavetableAudioProcessor::createEditor() { - return new WavetableAudioProcessorEditor (*this); + return new gin::ScaledPluginEditor (new WavetableAudioProcessorEditor (*this), state); } //==============================================================================