kopia lustrzana https://github.com/jameshball/osci-render
Move settings cog to title bar
rodzic
558bd0011d
commit
212d518fd0
|
@ -186,6 +186,7 @@
|
|||
if (visualiserOnly) {
|
||||
popout.remove();
|
||||
fullscreen.remove();
|
||||
settings.remove();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -12,17 +12,8 @@ SosciPluginEditor::SosciPluginEditor(SosciAudioProcessor& p)
|
|||
|
||||
setLookAndFeel(&lookAndFeel);
|
||||
|
||||
#if JUCE_MAC
|
||||
if (audioProcessor.wrapperType == juce::AudioProcessor::WrapperType::wrapperType_Standalone) {
|
||||
usingNativeMenuBar = true;
|
||||
menuBarModel.setMacMainMenu(&menuBarModel);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!usingNativeMenuBar) {
|
||||
menuBar.setModel(&menuBarModel);
|
||||
addAndMakeVisible(menuBar);
|
||||
}
|
||||
menuBar.setModel(&menuBarModel);
|
||||
addAndMakeVisible(menuBar);
|
||||
|
||||
if (juce::JUCEApplicationBase::isStandaloneApp()) {
|
||||
if (juce::TopLevelWindow::getNumTopLevelWindows() > 0) {
|
||||
|
@ -42,11 +33,16 @@ SosciPluginEditor::SosciPluginEditor(SosciAudioProcessor& p)
|
|||
}
|
||||
}
|
||||
|
||||
addAndMakeVisible(settings);
|
||||
|
||||
settings.onClick = [this] {
|
||||
openVisualiserSettings();
|
||||
};
|
||||
|
||||
addAndMakeVisible(visualiser);
|
||||
|
||||
visualiser.openSettings = [this] {
|
||||
visualiserSettingsWindow.setVisible(true);
|
||||
visualiserSettingsWindow.toFront(true);
|
||||
openVisualiserSettings();
|
||||
};
|
||||
|
||||
visualiser.closeSettings = [this] {
|
||||
|
@ -73,24 +69,18 @@ SosciPluginEditor::SosciPluginEditor(SosciAudioProcessor& p)
|
|||
SosciPluginEditor::~SosciPluginEditor() {
|
||||
setLookAndFeel(nullptr);
|
||||
juce::Desktop::getInstance().setDefaultLookAndFeel(nullptr);
|
||||
|
||||
#if JUCE_MAC
|
||||
if (usingNativeMenuBar) {
|
||||
menuBarModel.setMacMainMenu(nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SosciPluginEditor::paint(juce::Graphics& g) {
|
||||
g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::backgroundColourId));
|
||||
g.fillAll(Colours::veryDark);
|
||||
}
|
||||
|
||||
void SosciPluginEditor::resized() {
|
||||
auto area = getLocalBounds();
|
||||
|
||||
if (!usingNativeMenuBar) {
|
||||
menuBar.setBounds(area.removeFromTop(25));
|
||||
}
|
||||
auto topBar = area.removeFromTop(25);
|
||||
settings.setBounds(topBar.removeFromRight(25));
|
||||
menuBar.setBounds(topBar);
|
||||
|
||||
visualiser.setBounds(area);
|
||||
}
|
||||
|
@ -171,3 +161,8 @@ void SosciPluginEditor::resetToDefault() {
|
|||
window->resetToDefaultState();
|
||||
}
|
||||
}
|
||||
|
||||
void SosciPluginEditor::openVisualiserSettings() {
|
||||
visualiserSettingsWindow.setVisible(true);
|
||||
visualiserSettingsWindow.toFront(true);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "LookAndFeel.h"
|
||||
#include "components/VisualiserSettings.h"
|
||||
#include "components/SosciMainMenuBarModel.h"
|
||||
#include "components/SvgButton.h"
|
||||
|
||||
class SosciPluginEditor : public juce::AudioProcessorEditor {
|
||||
public:
|
||||
|
@ -21,6 +22,7 @@ public:
|
|||
void updateTitle();
|
||||
void openAudioSettings();
|
||||
void resetToDefault();
|
||||
void openVisualiserSettings();
|
||||
|
||||
private:
|
||||
SosciAudioProcessor& audioProcessor;
|
||||
|
@ -36,6 +38,8 @@ public:
|
|||
juce::MenuBarComponent menuBar;
|
||||
|
||||
juce::TooltipWindow tooltipWindow{nullptr, 0};
|
||||
|
||||
SvgButton settings{"Settings", BinaryData::cog_svg, juce::Colours::white, juce::Colours::white};
|
||||
|
||||
bool usingNativeMenuBar = false;
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
file="Source/components/SosciMainMenuBarModel.cpp"/>
|
||||
<FILE id="EymEr3" name="SosciMainMenuBarModel.h" compile="0" resource="0"
|
||||
file="Source/components/SosciMainMenuBarModel.h"/>
|
||||
<FILE id="f2kkHV" name="SvgButton.h" compile="0" resource="0" file="Source/components/SvgButton.h"/>
|
||||
<FILE id="qzfstC" name="SwitchButton.h" compile="0" resource="0" file="Source/components/SwitchButton.h"/>
|
||||
<FILE id="y3UiR0" name="VisualiserComponent.cpp" compile="1" resource="0"
|
||||
file="Source/components/VisualiserComponent.cpp"/>
|
||||
|
|
Ładowanie…
Reference in New Issue