Skip to content

Commit

Permalink
Change top level window borders on skin changes
Browse files Browse the repository at this point in the history
Basically just calling the right thing at the right time just
annoyingly correctly as opposed to lcose-to-correctly like
we were

Closes surge-synthesizer#5447
  • Loading branch information
baconpaul committed Nov 23, 2021
1 parent 90f5272 commit 5ad222e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/surge-xt/SurgeSynthEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<juce::DocumentWindow *>(p))
{
dw->setName("Surge XT");

if (processor.wrapperType == juce::AudioProcessor::wrapperType_Standalone)
{
dw->setColour(juce::DocumentWindow::backgroundColourId,
findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId));
}
}
}

repaint();
}

Expand Down Expand Up @@ -218,22 +232,7 @@ void SurgeSynthEditor::resized()
}
}

void SurgeSynthEditor::parentHierarchyChanged()
{
for (auto *p = getParentComponent(); p != nullptr; p = p->getParentComponent())
{
if (auto dw = dynamic_cast<juce::DocumentWindow *>(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(); }

Expand Down
1 change: 1 addition & 0 deletions src/surge-xt/SurgeSynthEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class SurgeSynthEditor : public juce::AudioProcessorEditor,
SurgeSynthEditor *editor{nullptr};
};
void parentHierarchyChanged() override;
void resetWindowFromSkin();

void paramsChangedCallback();
void setEffectType(int i);
Expand Down
1 change: 1 addition & 0 deletions src/surge-xt/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3701,6 +3701,7 @@ void SurgeGUIEditor::reloadFromSkin()
if (component)
{
component->setSkin(currentSkin, bitmapStore);
ol.second->repaint();
}
}

Expand Down
11 changes: 11 additions & 0 deletions src/surge-xt/gui/overlays/OverlayWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "SurgeGUIEditor.h"
#include "OverlayComponent.h"
#include "widgets/MainFrame.h"
#include "SurgeJUCELookAndFeel.h"

namespace Surge
{
Expand Down Expand Up @@ -237,6 +238,8 @@ void OverlayWrapper::doTearOut(const juce::Point<int> &showAt)
dw->supressMoveUpdates = false;
supressInteriorDecoration();
tearOutParent = std::move(dw);
tearOutParent->setColour(juce::DocumentWindow::backgroundColourId,
findColour(SurgeJUCELookAndFeel::SurgeColourIds::topWindowBorderId));
}

juce::Point<int> OverlayWrapper::currentTearOutLocation()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ad222e

Please sign in to comment.