From 7bb5156d33fad742f733eeb2e80e18dd7ad23c81 Mon Sep 17 00:00:00 2001 From: Timothy Schoen Date: Mon, 9 Dec 2024 18:20:45 +0100 Subject: [PATCH] Various inspector fixes --- Source/Components/PropertiesPanel.h | 15 +++++++-------- Source/Dialogs/AudioSettingsPanel.h | 15 +++++++-------- Source/Objects/ArrayObject.h | 16 ++++++++-------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Source/Components/PropertiesPanel.h b/Source/Components/PropertiesPanel.h index 61af85db2..a4e91beda 100644 --- a/Source/Components/PropertiesPanel.h +++ b/Source/Components/PropertiesPanel.h @@ -542,17 +542,16 @@ class PropertiesPanel : public Component { void paint(Graphics& g) override { bool isDown = getValue(toggleStateValue); - + bool isOver = isMouseOver(); + auto bounds = getLocalBounds().toFloat().removeFromRight(getWidth() / (2.0f - hideLabel)); auto buttonBounds = bounds.reduced(4); - - auto contrast = isDown ? 0.3f : 0.0f; - if(isMouseOver()) contrast += 0.05; - - // Add some alpha to make it look good on any background... - g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId).contrasting(contrast).withAlpha(0.3f)); - g.fillRoundedRectangle(buttonBounds, Corners::defaultCornerRadius); + if(isDown || isOver) { + // Add some alpha to make it look good on any background... + g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId).contrasting(isOver ? 0.1f : 0.15f).withAlpha(0.25f)); + g.fillRoundedRectangle(buttonBounds, Corners::defaultCornerRadius); + } auto textColour = findColour(PlugDataColour::panelTextColourId); if (!isEnabled()) { diff --git a/Source/Dialogs/AudioSettingsPanel.h b/Source/Dialogs/AudioSettingsPanel.h index 0132bfdf9..e7e0e5698 100644 --- a/Source/Dialogs/AudioSettingsPanel.h +++ b/Source/Dialogs/AudioSettingsPanel.h @@ -132,17 +132,16 @@ class ChannelToggleProperty : public PropertiesPanel::BoolComponent { void paint(Graphics& g) override { bool isDown = getValue(toggleStateValue); - + bool isOver = isMouseOver(); + auto bounds = getLocalBounds().toFloat().removeFromRight(getWidth() / (2.0f - hideLabel)); auto buttonBounds = bounds.reduced(4); - - auto contrast = isDown ? 0.3f : 0.0f; - if(isMouseOver()) contrast += 0.05; - - // Add some alpha to make it look good on any background... - g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId).contrasting(contrast).withAlpha(0.3f)); - g.fillRoundedRectangle(buttonBounds, Corners::defaultCornerRadius); + if(isDown || isOver) { + // Add some alpha to make it look good on any background... + g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId).contrasting(isOver ? 0.1f : 0.15f).withAlpha(0.25f)); + g.fillRoundedRectangle(buttonBounds, Corners::defaultCornerRadius); + } auto textColour = findColour(PlugDataColour::panelTextColourId); if (!isEnabled()) { diff --git a/Source/Objects/ArrayObject.h b/Source/Objects/ArrayObject.h index 756c96306..920fe3baf 100644 --- a/Source/Objects/ArrayObject.h +++ b/Source/Objects/ArrayObject.h @@ -750,7 +750,7 @@ struct ArrayPropertiesPanel : public PropertiesPanelProperty addAndMakeVisible(deleteButton); } - auto newHeight = (176 * graphs.size()) + 24; + auto newHeight = (184 * graphs.size()) + 40; setPreferredHeight(newHeight); if (auto* propertiesPanel = findParentComponentOfClass()) { propertiesPanel->updatePropHolderLayout(); @@ -776,11 +776,11 @@ struct ArrayPropertiesPanel : public PropertiesPanelProperty if (!graphs[i]) continue; - auto start = (i * 176) - 6; + auto start = (i * 184) - 8; g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId).withAlpha(0.75f)); - g.fillRoundedRectangle(0.0f, start + 26, getWidth(), 158, Corners::largeCornerRadius); + g.fillRoundedRectangle(0.0f, start + 32, getWidth(), 154, Corners::largeCornerRadius); - Fonts::drawStyledText(g, graphs[i]->name.toString(), 8, start - 2, getWidth() - 16, 25, findColour(PlugDataColour::sidebarTextColourId), Semibold, 14.5f); + Fonts::drawStyledText(g, graphs[i]->name.toString(), 8, start + 2, getWidth() - 16, 32, findColour(PlugDataColour::sidebarTextColourId), Semibold, 14.5f); } g.setColour(findColour(PlugDataColour::toolbarOutlineColourId)); @@ -795,16 +795,16 @@ struct ArrayPropertiesPanel : public PropertiesPanelProperty void resized() override { - auto b = getLocalBounds().translated(0, -6); + auto b = getLocalBounds().translated(0, -8); for (int i = 0; i < properties.size(); i++) { if ((i % 5) == 0) { - auto deleteButtonBounds = b.removeFromTop(26).removeFromRight(28); + auto deleteButtonBounds = b.removeFromTop(34).removeFromRight(28); deleteButtons[i / 5]->setBounds(deleteButtonBounds); } - properties[i]->setBounds(b.removeFromTop(32)); + properties[i]->setBounds(b.removeFromTop(30)); } - addButton.setBounds(getLocalBounds().removeFromBottom(40).reduced(0, 8)); + addButton.setBounds(b.removeFromBottom(32).reduced(0, 4)); } };