Skip to content

Commit 076eadf

Browse files
author
alcomposer
committed
Split inspector fixes:
* Fix inspector overpainting over reset-button * Fix split inspector becoming active when changing modes but empty * Fix top panel painting underneath split inspector resize bar
1 parent aa8ec6f commit 076eadf

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

Source/Sidebar/Inspector.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ class Inspector final : public Component {
155155
loadParameters(properties);
156156
}
157157

158+
bool isEmpty()
159+
{
160+
return properties.empty();
161+
}
162+
158163
bool loadParameters(SmallArray<ObjectParameters, 6>& objectParameters)
159164
{
160165
properties = objectParameters;

Source/Sidebar/Sidebar.cpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -108,21 +108,6 @@ void Sidebar::paint(Graphics& g)
108108
if (!sidebarHidden) {
109109
g.setColour(findColour(PlugDataColour::sidebarBackgroundColourId));
110110
g.fillRect(0, 30, getWidth(), getHeight());
111-
}
112-
}
113-
114-
void Sidebar::paintOverChildren(Graphics& g)
115-
{
116-
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
117-
g.drawLine(0.5f, 30, 0.5f, getHeight() + 0.5f);
118-
119-
g.drawLine(dividerBounds.getX() + 4, dividerBounds.getCentreY(), dividerBounds.getRight() - 4, dividerBounds.getCentreY());
120-
121-
if (!sidebarHidden) {
122-
g.drawLine(0, 30, getWidth(), 30);
123-
124-
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId).withAlpha(0.5f));
125-
g.drawLine(getWidth() - 30, 30, getWidth() - 30, getHeight() + 0.5f);
126111

127112
auto panelName = panelNames[currentPanel];
128113
if (inspectorButton.isInspectorAuto() && inspector->isVisible())
@@ -131,7 +116,7 @@ void Sidebar::paintOverChildren(Graphics& g)
131116

132117
if (inspectorButton.isInspectorPinned()) {
133118
auto inpectorPos = Point<int>(0, dividerFactor * getHeight());
134-
if(!inspector->isVisible()) inpectorPos.setY(getHeight() - 30);
119+
if (inspector->isEmpty()) inpectorPos.setY(getHeight() - 30);
135120
g.setColour(findColour(PlugDataColour::sidebarActiveBackgroundColourId));
136121
g.fillRect(inpectorPos.x, inpectorPos.y, getWidth() - 30, 30);
137122
auto inspectorTitle = inspector->getTitle();
@@ -142,6 +127,21 @@ void Sidebar::paintOverChildren(Graphics& g)
142127
}
143128
}
144129

130+
void Sidebar::paintOverChildren(Graphics& g)
131+
{
132+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId));
133+
g.drawLine(0.5f, 30, 0.5f, getHeight() + 0.5f);
134+
135+
g.drawLine(dividerBounds.getX() + 4, dividerBounds.getCentreY(), dividerBounds.getRight() - 4, dividerBounds.getCentreY());
136+
137+
if (!sidebarHidden) {
138+
g.drawLine(0, 30, getWidth(), 30);
139+
140+
g.setColour(findColour(PlugDataColour::toolbarOutlineColourId).withAlpha(0.5f));
141+
g.drawLine(getWidth() - 30, 30, getWidth() - 30, getHeight() + 0.5f);
142+
}
143+
}
144+
145145
void Sidebar::settingsChanged(String const& name, var const& value)
146146
{
147147
if (name == "centre_sidepanel_buttons") {
@@ -192,15 +192,15 @@ void Sidebar::resized()
192192
}
193193
inspector->setBounds(bounds);
194194
} else {
195-
auto bottomB = bounds.removeFromBottom(dividerPos);
195+
auto bottomB = bounds.removeFromBottom(inspector->isEmpty() ? 30 : dividerPos);
196196
auto resetB = bottomB.removeFromTop(30);
197197
inspector->setBounds(bottomB);
198198
auto const resetBounds = resetB.removeFromLeft(30);
199199
if (extraSettingsButton)
200200
extraSettingsButton->setVisible(true);
201201
if (resetInspectorButton) {
202202
resetInspectorButton->setBounds(resetBounds);
203-
resetInspectorButton->setVisible(true);
203+
resetInspectorButton->setVisible(!inspector->isEmpty());
204204
}
205205
}
206206
} else {
@@ -331,7 +331,7 @@ void Sidebar::showPanel(SidePanel const panelToShow)
331331
break;
332332
case SidePanel::InspectorPan:
333333
if (!sidebarHidden) {
334-
auto const isVisible = (inspectorButton.isInspectorPinned() || inspectorButton.isInspectorAuto()) && lastParameters.not_empty();
334+
auto const isVisible = (inspectorButton.isInspectorPinned() || (inspectorButton.isInspectorAuto() && !inspector->isEmpty()));
335335
if (!areParamObjectsAllValid()) {
336336
clearInspector();
337337
}
@@ -455,7 +455,7 @@ void Sidebar::showParameters(SmallArray<Component*>& objects, SmallArray<ObjectP
455455

456456
auto const haveParams = showOnSelect && params.not_empty() && activeParams;
457457

458-
auto const isVis = (inspectorButton.isInspectorAuto() || inspectorButton.isInspectorPinned()) && params.not_empty() && showOnSelect && activeParams;
458+
auto const isVis = (inspectorButton.isInspectorAuto() && params.not_empty() && showOnSelect && activeParams) || inspectorButton.isInspectorPinned();
459459

460460
// Reset console notifications if the inspector is not visible and console is
461461
if (!isVis && currentPanel == SidePanel::ConsolePan) {
@@ -526,7 +526,7 @@ void Sidebar::updateExtraSettingsButton()
526526

527527
void Sidebar::hideParameters()
528528
{
529-
if (inspectorButton.isInspectorAuto() || inspectorButton.isInspectorPinned()) {
529+
if (inspectorButton.isInspectorAuto()) {
530530
inspector->setVisible(false);
531531
}
532532

0 commit comments

Comments
 (0)