Skip to content

Commit

Permalink
Various inspector fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Dec 9, 2024
1 parent cc5285d commit 7bb5156
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
15 changes: 7 additions & 8 deletions Source/Components/PropertiesPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -542,17 +542,16 @@ class PropertiesPanel : public Component {
void paint(Graphics& g) override
{
bool isDown = getValue<bool>(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()) {
Expand Down
15 changes: 7 additions & 8 deletions Source/Dialogs/AudioSettingsPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,16 @@ class ChannelToggleProperty : public PropertiesPanel::BoolComponent {
void paint(Graphics& g) override
{
bool isDown = getValue<bool>(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()) {
Expand Down
16 changes: 8 additions & 8 deletions Source/Objects/ArrayObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>()) {
propertiesPanel->updatePropHolderLayout();
Expand All @@ -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));
Expand All @@ -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));
}
};

Expand Down

0 comments on commit 7bb5156

Please sign in to comment.