Skip to content

Commit 1d855bd

Browse files
committed
Fix window controls on Windows/Linux
1 parent 4889ed3 commit 1d855bd

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

Source/PluginEditor.cpp

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ PluginEditor::PluginEditor(PluginProcessor& p)
124124
mainMenuButton.setButtonText(Icons::Menu);
125125
undoButton.setButtonText(Icons::Undo);
126126
redoButton.setButtonText(Icons::Redo);
127-
pluginModeButton.setButtonText(Icons::PluginMode);
128127
welcomePanelSearchButton.setButtonText(Icons::Search);
129128

130129
addKeyListener(commandManager.getKeyMappings());
@@ -195,8 +194,7 @@ PluginEditor::PluginEditor(PluginProcessor& p)
195194
&undoButton,
196195
&redoButton,
197196
&addObjectMenuButton,
198-
&welcomePanelSearchButton,
199-
//&pluginModeButton,
197+
&welcomePanelSearchButton
200198
}) {
201199
addChildComponent(button);
202200
}
@@ -245,15 +243,6 @@ PluginEditor::PluginEditor(PluginProcessor& p)
245243
recentlyOpenedPanelSelector.setToggleState(!lastWelcomePanel, sendNotification);
246244
libraryPanelSelector.setToggleState(lastWelcomePanel, sendNotification);
247245

248-
// Enter plugin mode
249-
pluginModeButton.setTooltip("Enter plugin mode");
250-
pluginModeButton.setColour(ComboBox::outlineColourId, PlugDataColours::toolbarBackgroundColour);
251-
pluginModeButton.onClick = [this] {
252-
if (auto const* cnv = getCurrentCanvas()) {
253-
tabComponent.openInPluginMode(cnv->refCountedPatch);
254-
}
255-
};
256-
257246
sidebar->setSize(250, pd->lastUIHeight);
258247

259248
setSize(pd->lastUIWidth, pd->lastUIHeight);
@@ -510,13 +499,12 @@ CallOutBox& PluginEditor::showCalloutBox(std::unique_ptr<Component> content, Rec
510499

511500
void PluginEditor::showWelcomePanel(bool const shouldShow)
512501
{
513-
pluginModeButton.setVisible(!shouldShow);
514502
addObjectMenuButton.setVisible(!shouldShow);
515503
undoButton.setVisible(!shouldShow);
516504
redoButton.setVisible(!shouldShow);
517505
sidebar->setVisible(!shouldShow);
518506

519-
welcomePanelSearchButton.setVisible(shouldShow);
507+
welcomePanelSearchButton.setVisible(false); // TODO: fix this!
520508
recentlyOpenedPanelSelector.setVisible(shouldShow);
521509
libraryPanelSelector.setVisible(shouldShow);
522510

@@ -607,21 +595,21 @@ void PluginEditor::resized()
607595
touchSelectionHelper->setBounds(touchHelperBounds);
608596
}
609597

598+
#if JUCE_IOS
599+
auto windowControlsOffset = 45.0f;
600+
#else
601+
auto windowControlsOffset = useNonNativeTitlebar && !useLeftButtons ? 90.f : 0.f;
602+
#endif
603+
610604
auto statusbarBounds = getLocalBounds().removeFromBottom(48).withSizeKeepingCentre(204, 48).translated(0, -12);
611605
if(statusbar) statusbar->setBounds(statusbarBounds);
612606

613-
if(audioToolbar) audioToolbar->setBounds(getLocalBounds().removeFromTop(toolbarHeight).removeFromRight(500).translated(0, 2));
607+
if(audioToolbar) audioToolbar->setBounds(getLocalBounds().removeFromTop(toolbarHeight).removeFromRight(500).translated(-windowControlsOffset, 2));
614608

615609
auto welcomeSelectorBounds = getLocalBounds().removeFromTop(toolbarHeight + 8).withSizeKeepingCentre(200, toolbarHeight).translated(0, -1);
616610
recentlyOpenedPanelSelector.setBounds(welcomeSelectorBounds.removeFromLeft(100));
617611
libraryPanelSelector.setBounds(welcomeSelectorBounds.removeFromLeft(100));
618612

619-
#if JUCE_IOS
620-
auto windowControlsOffset = 45.0f;
621-
#else
622-
auto windowControlsOffset = useNonNativeTitlebar && !useLeftButtons ? 135.0f : 45.0f;
623-
#endif
624-
625613
if (borderResizer && ProjectInfo::isStandalone) {
626614
borderResizer->setBounds(getLocalBounds());
627615
} else if (cornerResizer) {
@@ -631,7 +619,6 @@ void PluginEditor::resized()
631619
resizerSize, resizerSize);
632620
}
633621

634-
//pluginModeButton.setBounds(getWidth() - windowControlsOffset, 0, buttonSize, buttonSize);
635622
welcomePanelSearchButton.setBounds(getWidth() - windowControlsOffset, 0, buttonSize, buttonSize);
636623

637624
welcomePanelSearchInput.setBounds(libraryPanelSelector.getRight() + 10, 4, welcomePanelSearchButton.getX() - libraryPanelSelector.getRight() - 20, toolbarHeight - 4);
@@ -967,9 +954,6 @@ void PluginEditor::handleAsyncUpdate()
967954

968955
// Application commands need to be updated when undo state changes
969956
commandManager.commandStatusChanged();
970-
971-
pluginModeButton.setEnabled(true);
972-
973957
addObjectMenuButton.setEnabled(true);
974958

975959
if (touchSelectionHelper) {
@@ -980,8 +964,6 @@ void PluginEditor::handleAsyncUpdate()
980964
}
981965
}
982966
} else {
983-
pluginModeButton.setEnabled(false);
984-
985967
undoButton.setEnabled(false);
986968
redoButton.setEnabled(false);
987969
addObjectMenuButton.setEnabled(false);

Source/PluginEditor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ class PluginEditor final : public AudioProcessorEditor
178178

179179
int const toolbarHeight = 32;
180180

181-
MainToolbarButton mainMenuButton, undoButton, redoButton, addObjectMenuButton, pluginModeButton, welcomePanelSearchButton;
181+
MainToolbarButton mainMenuButton, undoButton, redoButton, addObjectMenuButton, welcomePanelSearchButton;
182182
SettingsToolbarButton recentlyOpenedPanelSelector, libraryPanelSelector;
183183

184184
SearchEditor welcomePanelSearchInput;

0 commit comments

Comments
 (0)