From 5ad222e0c418eec67ae00d7ab0fd757ee4223390 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Mon, 22 Nov 2021 20:23:19 -0500 Subject: [PATCH] Change top level window borders on skin changes Basically just calling the right thing at the right time just annoyingly correctly as opposed to lcose-to-correctly like we were Closes #5447 --- src/surge-xt/SurgeSynthEditor.cpp | 31 ++++++++++---------- src/surge-xt/SurgeSynthEditor.h | 1 + src/surge-xt/gui/SurgeGUIEditor.cpp | 1 + src/surge-xt/gui/overlays/OverlayWrapper.cpp | 11 +++++++ 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/surge-xt/SurgeSynthEditor.cpp b/src/surge-xt/SurgeSynthEditor.cpp index 5144c554f84..8110871d028 100644 --- a/src/surge-xt/SurgeSynthEditor.cpp +++ b/src/surge-xt/SurgeSynthEditor.cpp @@ -140,6 +140,20 @@ void SurgeSynthEditor::reapplySurgeComponentColours() tempoTypein->applyColourToAllText( findColour(SurgeJUCELookAndFeel::SurgeColourIds::tempoTypeinTextId), true); + for (auto *p = getParentComponent(); p != nullptr; p = p->getParentComponent()) + { + if (auto dw = dynamic_cast(p)) + { + dw->setName("Surge XT"); + + if (processor.wrapperType == juce::AudioProcessor::wrapperType_Standalone) + { + dw->setColour(juce::DocumentWindow::backgroundColourId, + findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId)); + } + } + } + repaint(); } @@ -218,22 +232,7 @@ void SurgeSynthEditor::resized() } } -void SurgeSynthEditor::parentHierarchyChanged() -{ - for (auto *p = getParentComponent(); p != nullptr; p = p->getParentComponent()) - { - if (auto dw = dynamic_cast(p)) - { - dw->setName("Surge XT"); - - if (processor.wrapperType == juce::AudioProcessor::wrapperType_Standalone) - { - dw->setColour(juce::DocumentWindow::backgroundColourId, - findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId)); - } - } - } -} +void SurgeSynthEditor::parentHierarchyChanged() { reapplySurgeComponentColours(); } void SurgeSynthEditor::IdleTimer::timerCallback() { ed->idle(); } diff --git a/src/surge-xt/SurgeSynthEditor.h b/src/surge-xt/SurgeSynthEditor.h index e3f06c95e2d..f07cb5dee50 100644 --- a/src/surge-xt/SurgeSynthEditor.h +++ b/src/surge-xt/SurgeSynthEditor.h @@ -43,6 +43,7 @@ class SurgeSynthEditor : public juce::AudioProcessorEditor, SurgeSynthEditor *editor{nullptr}; }; void parentHierarchyChanged() override; + void resetWindowFromSkin(); void paramsChangedCallback(); void setEffectType(int i); diff --git a/src/surge-xt/gui/SurgeGUIEditor.cpp b/src/surge-xt/gui/SurgeGUIEditor.cpp index eab7766b223..30d2dc2ff80 100644 --- a/src/surge-xt/gui/SurgeGUIEditor.cpp +++ b/src/surge-xt/gui/SurgeGUIEditor.cpp @@ -3701,6 +3701,7 @@ void SurgeGUIEditor::reloadFromSkin() if (component) { component->setSkin(currentSkin, bitmapStore); + ol.second->repaint(); } } diff --git a/src/surge-xt/gui/overlays/OverlayWrapper.cpp b/src/surge-xt/gui/overlays/OverlayWrapper.cpp index 5dfe0c0c972..ac60cfc4f00 100644 --- a/src/surge-xt/gui/overlays/OverlayWrapper.cpp +++ b/src/surge-xt/gui/overlays/OverlayWrapper.cpp @@ -19,6 +19,7 @@ #include "SurgeGUIEditor.h" #include "OverlayComponent.h" #include "widgets/MainFrame.h" +#include "SurgeJUCELookAndFeel.h" namespace Surge { @@ -237,6 +238,8 @@ void OverlayWrapper::doTearOut(const juce::Point &showAt) dw->supressMoveUpdates = false; supressInteriorDecoration(); tearOutParent = std::move(dw); + tearOutParent->setColour(juce::DocumentWindow::backgroundColourId, + findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId)); } juce::Point OverlayWrapper::currentTearOutLocation() @@ -367,6 +370,14 @@ void OverlayWrapper::onSkinChanged() skc->setSkin(skin, associatedBitmapStore); } icon = associatedBitmapStore->getImage(IDB_SURGE_ICON); + if (tearOutParent) + { + tearOutParent->setColour( + juce::DocumentWindow::backgroundColourId, + findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId)); + tearOutParent->repaint(); + } + repaint(); } } // namespace Overlays