From c6f0be41970f36ba7bb383275d9e74adcf174544 Mon Sep 17 00:00:00 2001 From: Anjal Doshi Date: Thu, 10 Oct 2024 17:52:03 -0700 Subject: [PATCH 1/2] Add resize limits to AudioConfigurationWindow --- Source/MainWindow.cpp | 4 ++-- Source/Processors/AudioNode/AudioEditor.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/MainWindow.cpp b/Source/MainWindow.cpp index 9000acc2a..bb2b08e92 100644 --- a/Source/MainWindow.cpp +++ b/Source/MainWindow.cpp @@ -135,9 +135,9 @@ MainWindow::MainWindow (const File& fileToLoad, bool isConsoleApp_) : isConsoleA documentWindow->setUsingNativeTitleBar (true); // Use native title bar on Mac and Linux #endif - documentWindow->addToDesktop (documentWindow->getDesktopWindowStyleFlags()); // prevents the maximize - // button from randomly disappearing + documentWindow->addToDesktop(); documentWindow->setVisible (true); + documentWindow->toFront (true); // Constraining the window's size doesn't seem to work: documentWindow->setResizeLimits (800, 600, 10000, 10000); diff --git a/Source/Processors/AudioNode/AudioEditor.cpp b/Source/Processors/AudioNode/AudioEditor.cpp index b7094d655..861dfb72e 100755 --- a/Source/Processors/AudioNode/AudioEditor.cpp +++ b/Source/Processors/AudioNode/AudioEditor.cpp @@ -63,7 +63,7 @@ AudioWindowButton::AudioWindowButton() void AudioWindowButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDown) { - float alpha = isMouseOver ? 0.6f : 1.0f; + float alpha = (isMouseOver && getClickingTogglesState()) ? 0.6f : 1.0f; if (getToggleState()) g.setColour (Colours::yellow.withAlpha (alpha)); @@ -203,6 +203,7 @@ void AudioEditor::buttonClicked (Button* button) AccessClass::getAudioComponent()->restartDevice(); audioConfigurationWindow->setLookAndFeel (&getLookAndFeel()); audioConfigurationWindow->setVisible (true); + audioConfigurationWindow->toFront (true); } else { @@ -293,6 +294,11 @@ AudioConfigurationWindow::AudioConfigurationWindow (AudioDeviceManager& adm, Aud setContentOwned (adsc, true); setVisible (false); + + int fixedWidth = adsc->getWidth() + 10; + int fixedHeight = adsc->getHeight() + getTitleBarHeight() + 20; + + setResizeLimits (fixedWidth, fixedHeight, fixedWidth, fixedHeight); } void AudioConfigurationWindow::closeButtonPressed() From df3a0e3d2b31d3c30a259314173aaac344b7f996 Mon Sep 17 00:00:00 2001 From: Anjal Doshi Date: Thu, 10 Oct 2024 18:08:16 -0700 Subject: [PATCH 2/2] Fix UtilityButton look when disabled --- Source/Processors/Editors/GenericEditor.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Processors/Editors/GenericEditor.cpp b/Source/Processors/Editors/GenericEditor.cpp index 8af07540a..4052b4387 100755 --- a/Source/Processors/Editors/GenericEditor.cpp +++ b/Source/Processors/Editors/GenericEditor.cpp @@ -854,6 +854,7 @@ void UtilityButton::setCorners (bool UL, bool UR, bool LL, bool LR) void UtilityButton::setEnabledState (bool state) { isEnabled = state; + setEnabled (state); repaint(); } @@ -865,6 +866,8 @@ void UtilityButton::setRadius (float r) void UtilityButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDown) { + isEnabled = Button::isEnabled(); + if (getToggleState()) { g.setColour (findColour (ThemeColours::highlightedFill)); @@ -887,10 +890,10 @@ void UtilityButton::paintButton (Graphics& g, bool isMouseOver, bool isButtonDow g.setFont (font); - if (isEnabled || ! isButtonDown) - g.setColour (findColour (ThemeColours::defaultText)); - else + if (! isEnabled || isButtonDown) g.setColour (findColour (ThemeColours::defaultText).withAlpha (0.4f)); + else + g.setColour (findColour (ThemeColours::defaultText)); g.drawFittedText (label, 1, 1, getWidth() - 2, getHeight() - 2, Justification::centred, 2, 1.0f); }