Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change top level window borders on skin changes #5451

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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