From 2f7e6c00fcc36a4d697cc2fe49f3353220520685 Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Sat, 25 May 2024 11:24:45 +0200 Subject: [PATCH] Cleaned up interface --- .clang-format | 2 +- .github/workflows/build.yml | 6 +- .../PlayerExample/Source/MainComponent.cpp | 2 +- .../Editor/foleys_GUITreeEditor.cpp | 2 +- .../Editor/foleys_GUITreeEditor.h | 2 +- .../Editor/foleys_StylePropertyComponent.cpp | 2 + .../Editor/foleys_ToolBox.cpp | 158 ++++++++---------- .../foleys_gui_magic/Editor/foleys_ToolBox.h | 52 +++--- .../General/foleys_MagicGUIBuilder.cpp | 145 ++++++++-------- .../General/foleys_MagicGUIBuilder.h | 73 ++++---- .../General/foleys_MagicPluginEditor.cpp | 2 +- .../Layout/foleys_Container.cpp | 2 - .../Layout/foleys_Container.h | 2 - .../Layout/foleys_GuiItem.cpp | 12 -- .../foleys_gui_magic/Layout/foleys_GuiItem.h | 4 - .../State/foleys_MagicGUIState.h | 10 ++ .../Widgets/foleys_XYDragComponent.cpp | 70 ++++---- 17 files changed, 273 insertions(+), 273 deletions(-) diff --git a/.clang-format b/.clang-format index dae6f733..9b0bf721 100644 --- a/.clang-format +++ b/.clang-format @@ -55,7 +55,7 @@ PenaltyExcessCharacter: '1' PenaltyReturnTypeOnItsOwnLine: '20' PointerAlignment: Left ReflowComments: 'false' -SortIncludes: 'true' +SortIncludes: 'false' SortUsingDeclarations: 'true' SpaceAfterCStyleCast: 'true' SpaceAfterLogicalNot: 'false' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9277d4d..cab7dc3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,12 +21,12 @@ jobs: name: ${{ matrix.os }} - ${{ matrix.build_type }} strategy: matrix: - os: [macos-13, windows-latest] + os: [macos-latest, windows-latest] build_type: [Debug, Release] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: submodules: recursive @@ -43,7 +43,7 @@ jobs: echo PLUGINVAL_PATH=$(pwd)/$PLUGINVAL_BINARY >> $GITHUB_OUTPUT - name: Configure CMake - run: cmake --preset maintainer --log-level=VERBOSE -D PLUGINVAL_PROGRAM=${{ steps.pluginval.outputs.PLUGINVAL_PATH }} + run: cmake --preset maintainer --log-level=VERBOSE -D PLUGINVAL_PROGRAM=${{ steps.pluginval.outputs.PLUGINVAL_PATH }} -DJUCE_SILENCE_XCODE_15_LINKER_WARNING=1 - name: Build run: cmake --build --preset maintainer --config ${{ matrix.build_type }} diff --git a/Examples/PlayerExample/Source/MainComponent.cpp b/Examples/PlayerExample/Source/MainComponent.cpp index 15dbf545..a5a9ac00 100644 --- a/Examples/PlayerExample/Source/MainComponent.cpp +++ b/Examples/PlayerExample/Source/MainComponent.cpp @@ -184,5 +184,5 @@ void MainComponent::paint (juce::Graphics& g) void MainComponent::resized() { - magicBuilder.updateLayout(); + magicBuilder.updateLayout (getLocalBounds()); } diff --git a/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.cpp b/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.cpp index 6d7a606f..cf418107 100644 --- a/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.cpp +++ b/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.cpp @@ -64,7 +64,7 @@ void GUITreeEditor::resized() treeView.setBounds (bounds); } -void GUITreeEditor::setValueTree (juce::ValueTree& refTree) +void GUITreeEditor::setValueTree (const juce::ValueTree& refTree) { auto restorer = treeView.getRootItem() != nullptr ? treeView.getOpennessState (true) : std::unique_ptr(); diff --git a/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.h b/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.h index 4e618f66..277b3215 100644 --- a/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.h +++ b/modules/foleys_gui_magic/Editor/foleys_GUITreeEditor.h @@ -53,7 +53,7 @@ class GUITreeEditor : public juce::Component, void paint (juce::Graphics&) override; void resized() override; - void setValueTree (juce::ValueTree& refTree); + void setValueTree (const juce::ValueTree& refTree); void updateTree(); diff --git a/modules/foleys_gui_magic/Editor/foleys_StylePropertyComponent.cpp b/modules/foleys_gui_magic/Editor/foleys_StylePropertyComponent.cpp index e8eba802..4dfc8afe 100644 --- a/modules/foleys_gui_magic/Editor/foleys_StylePropertyComponent.cpp +++ b/modules/foleys_gui_magic/Editor/foleys_StylePropertyComponent.cpp @@ -136,8 +136,10 @@ void StylePropertyComponent::resized() void StylePropertyComponent::mouseDoubleClick (const juce::MouseEvent&) { +#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE if (inheritedFrom.isValid()) builder.getMagicToolBox().setNodeToEdit (inheritedFrom); +#endif } void StylePropertyComponent::valueTreePropertyChanged (juce::ValueTree& tree, const juce::Identifier& changedProperty) diff --git a/modules/foleys_gui_magic/Editor/foleys_ToolBox.cpp b/modules/foleys_gui_magic/Editor/foleys_ToolBox.cpp index 1707c85e..f49ff0b8 100644 --- a/modules/foleys_gui_magic/Editor/foleys_ToolBox.cpp +++ b/modules/foleys_gui_magic/Editor/foleys_ToolBox.cpp @@ -38,13 +38,11 @@ namespace foleys namespace IDs { - static juce::String lastLocation { "lastLocation" }; +static juce::String lastLocation { "lastLocation" }; } ToolBox::ToolBox (juce::Component* parentToUse, MagicGUIBuilder& builderToControl) - : parent (parentToUse), - builder (builderToControl), - undo (builder.getUndoManager()) + : parent (parentToUse), builder (builderToControl), undo (builder.getUndoManager()) { appProperties.setStorageParameters (getApplicationPropertyStorage()); @@ -54,11 +52,11 @@ ToolBox::ToolBox (juce::Component* parentToUse, MagicGUIBuilder& builderToContro setAlwaysOnTop (properties->getValue ("alwaysOnTop") == "true"); } - EditorColours::background = findColour (juce::ResizableWindow::backgroundColourId); - EditorColours::outline = juce::Colours::silver; - EditorColours::text = juce::Colours::white; - EditorColours::disabledText = juce::Colours::grey; - EditorColours::removeButton = juce::Colours::darkred; + EditorColours::background = findColour (juce::ResizableWindow::backgroundColourId); + EditorColours::outline = juce::Colours::silver; + EditorColours::text = juce::Colours::white; + EditorColours::disabledText = juce::Colours::grey; + EditorColours::removeButton = juce::Colours::darkred; EditorColours::selectedBackground = juce::Colours::darkorange; setOpaque (true); @@ -81,9 +79,9 @@ ToolBox::ToolBox (juce::Component* parentToUse, MagicGUIBuilder& builderToContro file.addItem ("Load XML", [&] { loadDialog(); }); file.addItem ("Save XML", [&] { saveDialog(); }); file.addSeparator(); - file.addItem ("Clear", [&] { builder.clearGUI(); }); + file.addItem ("Clear", [&] { builder.clearGUI(); }); file.addSeparator(); - file.addItem ("Refresh", [&] { builder.updateComponents(); }); + file.addItem ("Refresh", [&] { builder.updateComponents(); }); file.showMenuAsync (juce::PopupMenu::Options()); }; @@ -91,30 +89,26 @@ ToolBox::ToolBox (juce::Component* parentToUse, MagicGUIBuilder& builderToContro { juce::PopupMenu view; - view.addItem ("Left", true, positionOption == left, [&]() { setToolboxPosition (left); }); + view.addItem ("Left", true, positionOption == left, [&]() { setToolboxPosition (left); }); view.addItem ("Right", true, positionOption == right, [&]() { setToolboxPosition (right); }); view.addItem ("Detached", true, positionOption == detached, [&]() { setToolboxPosition (detached); }); view.addSeparator(); - view.addItem ("AlwaysOnTop", true, isAlwaysOnTop(), [&]() { - setAlwaysOnTop ( ! isAlwaysOnTop() ); - if (auto* properties = appProperties.getUserSettings()) - properties->setValue ("alwaysOnTop", isAlwaysOnTop() ? "true" : "false"); - }); + view.addItem ("AlwaysOnTop", true, isAlwaysOnTop(), + [&]() + { + setAlwaysOnTop (!isAlwaysOnTop()); + if (auto* properties = appProperties.getUserSettings()) + properties->setValue ("alwaysOnTop", isAlwaysOnTop() ? "true" : "false"); + }); view.showMenuAsync (juce::PopupMenu::Options()); }; - undoButton.onClick = [&] - { - undo.undo(); - }; + undoButton.onClick = [&] { undo.undo(); }; editSwitch.setClickingTogglesState (true); editSwitch.setColour (juce::TextButton::buttonOnColourId, EditorColours::selectedBackground); - editSwitch.onStateChange = [&] - { - builder.setEditMode (editSwitch.getToggleState()); - }; + editSwitch.onStateChange = [&] { builder.setEditMode (editSwitch.getToggleState()); }; addAndMakeVisible (treeEditor); addAndMakeVisible (resizer1); @@ -140,11 +134,14 @@ ToolBox::ToolBox (juce::Component* parentToUse, MagicGUIBuilder& builderToContro stateWasReloaded(); + builder.addListener (this); parent->addKeyListener (this); } ToolBox::~ToolBox() { + builder.removeListener (this); + if (parent != nullptr) parent->removeKeyListener (this); @@ -169,39 +166,35 @@ void ToolBox::mouseDrag (const juce::MouseEvent& e) void ToolBox::loadDialog() { - auto dialog = std::make_unique(NEEDS_TRANS ("Cancel"), NEEDS_TRANS ("Load"), - juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles, - lastLocation, getFileFilter()); - dialog->setAcceptFunction ([&, dlg=dialog.get()] - { - loadGUI (dlg->getFile()); - builder.closeOverlayDialog(); - }); - dialog->setCancelFunction ([&] - { - builder.closeOverlayDialog(); - }); + auto dialog = std::make_unique (NEEDS_TRANS ("Cancel"), NEEDS_TRANS ("Load"), + juce::FileBrowserComponent::openMode | juce::FileBrowserComponent::canSelectFiles, lastLocation, getFileFilter()); + dialog->setAcceptFunction ( + [&, dlg = dialog.get()] + { + loadGUI (dlg->getFile()); + builder.closeOverlayDialog(); + }); + dialog->setCancelFunction ([&] { builder.closeOverlayDialog(); }); builder.showOverlayDialog (std::move (dialog)); } void ToolBox::saveDialog() { - auto dialog = std::make_unique(NEEDS_TRANS ("Cancel"), NEEDS_TRANS ("Save"), - juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::canSelectFiles | juce::FileBrowserComponent::warnAboutOverwriting, - lastLocation, getFileFilter()); - dialog->setAcceptFunction ([&, dlg=dialog.get()] - { - auto xmlFile = dlg->getFile(); - saveGUI (xmlFile); - setLastLocation (xmlFile); - - builder.closeOverlayDialog(); - }); - dialog->setCancelFunction ([&] - { - builder.closeOverlayDialog(); - }); + auto dialog = std::make_unique (NEEDS_TRANS ("Cancel"), NEEDS_TRANS ("Save"), + juce::FileBrowserComponent::saveMode | juce::FileBrowserComponent::canSelectFiles + | juce::FileBrowserComponent::warnAboutOverwriting, + lastLocation, getFileFilter()); + dialog->setAcceptFunction ( + [&, dlg = dialog.get()] + { + auto xmlFile = dlg->getFile(); + saveGUI (xmlFile); + setLastLocation (xmlFile); + + builder.closeOverlayDialog(); + }); + dialog->setCancelFunction ([&] { builder.closeOverlayDialog(); }); builder.showOverlayDialog (std::move (dialog)); } @@ -209,7 +202,7 @@ void ToolBox::saveDialog() void ToolBox::loadGUI (const juce::File& xmlFile) { juce::FileInputStream stream (xmlFile); - auto tree = juce::ValueTree::fromXml (stream.readEntireStreamAsString()); + auto tree = juce::ValueTree::fromXml (stream.readEntireStreamAsString()); if (tree.isValid() && tree.getType() == IDs::magic) { @@ -267,36 +260,22 @@ void ToolBox::paint (juce::Graphics& g) void ToolBox::resized() { - auto bounds = getLocalBounds().reduced (2).withTop (24); + auto bounds = getLocalBounds().reduced (2).withTop (24); auto buttons = bounds.removeFromTop (24); - auto w = buttons.getWidth() / 5; + auto w = buttons.getWidth() / 5; fileMenu.setBounds (buttons.removeFromLeft (w)); viewMenu.setBounds (buttons.removeFromLeft (w)); undoButton.setBounds (buttons.removeFromLeft (w)); editSwitch.setBounds (buttons.removeFromLeft (w)); - juce::Component* comps[] = { - &treeEditor, - &resizer1, - &propertiesEditor, - &resizer3, - &palette - }; + juce::Component* comps[] = { &treeEditor, &resizer1, &propertiesEditor, &resizer3, &palette }; - resizeManager.layOutComponents (comps, 5, - bounds.getX(), - bounds.getY(), - bounds.getWidth(), - bounds.getHeight(), - true, true); + resizeManager.layOutComponents (comps, 5, bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight(), true, true); - const int resizeCornerSize { 20 }; + const int resizeCornerSize { 20 }; const auto bottomRight { getLocalBounds().getBottomRight() }; - juce::Rectangle resizeCornerArea { bottomRight.getX() - resizeCornerSize, - bottomRight.getY() - resizeCornerSize, - resizeCornerSize, - resizeCornerSize }; + juce::Rectangle resizeCornerArea { bottomRight.getX() - resizeCornerSize, bottomRight.getY() - resizeCornerSize, resizeCornerSize, resizeCornerSize }; resizeCorner.setBounds (resizeCornerArea); } @@ -341,7 +320,7 @@ bool ToolBox::keyPressed (const juce::KeyPress& key) if (key.isKeyCode ('V') && key.getModifiers().isCommandDown()) { - auto paste = juce::ValueTree::fromXml (juce::SystemClipboard::getTextFromClipboard()); + auto paste = juce::ValueTree::fromXml (juce::SystemClipboard::getTextFromClipboard()); auto selected = builder.getSelectedNode(); if (paste.isValid() && selected.isValid()) builder.draggedItemOnto (paste, selected); @@ -352,6 +331,11 @@ bool ToolBox::keyPressed (const juce::KeyPress& key) return false; } +void ToolBox::selectedItem (const juce::ValueTree& node) +{ + setSelectedNode (node); +} + void ToolBox::timerCallback (int timer) { if (timer == Timers::WindowDrag) @@ -362,7 +346,7 @@ void ToolBox::timerCallback (int timer) void ToolBox::setToolboxPosition (PositionOption position) { - positionOption = position; + positionOption = position; const auto isDetached = (positionOption == PositionOption::detached); auto* userSettings = appProperties.getUserSettings(); @@ -391,7 +375,7 @@ void ToolBox::updateToolboxPosition() setBounds (parentBounds.getRight(), parentBounds.getY(), width, height); } -void ToolBox::setLastLocation(juce::File file) +void ToolBox::setLastLocation (juce::File file) { if (file.getFullPathName().isEmpty()) return; @@ -402,28 +386,24 @@ void ToolBox::setLastLocation(juce::File file) lastLocation = file; autoSaveFile.deleteFile(); - autoSaveFile = lastLocation.getParentDirectory() - .getNonexistentChildFile (file.getFileNameWithoutExtension() + ".sav", ".xml"); + autoSaveFile = lastLocation.getParentDirectory().getNonexistentChildFile (file.getFileNameWithoutExtension() + ".sav", ".xml"); startTimer (Timers::AutoSave, 10000); } std::unique_ptr ToolBox::getFileFilter() { - return std::make_unique("*.xml", "*", "XML files"); + return std::make_unique ("*.xml", "*", "XML files"); } juce::String ToolBox::positionOptionToString (PositionOption option) { switch (option) { - case PositionOption::right: - return "right"; - case PositionOption::detached: - return "detached"; + case PositionOption::right: return "right"; + case PositionOption::detached: return "detached"; case PositionOption::left: - default: - return "left"; + default: return "left"; } } @@ -440,11 +420,11 @@ ToolBox::PositionOption ToolBox::positionOptionFromString (const juce::String& t juce::PropertiesFile::Options ToolBox::getApplicationPropertyStorage() { juce::PropertiesFile::Options options; - options.folderName = "FoleysFinest"; - options.applicationName = "foleys_gui_magic"; - options.filenameSuffix = ".settings"; + options.folderName = "FoleysFinest"; + options.applicationName = "foleys_gui_magic"; + options.filenameSuffix = ".settings"; options.osxLibrarySubFolder = "Application Support"; return options; } -} // namespace foleys +} // namespace foleys diff --git a/modules/foleys_gui_magic/Editor/foleys_ToolBox.h b/modules/foleys_gui_magic/Editor/foleys_ToolBox.h index a3ea74d6..1c5844a1 100644 --- a/modules/foleys_gui_magic/Editor/foleys_ToolBox.h +++ b/modules/foleys_gui_magic/Editor/foleys_ToolBox.h @@ -33,11 +33,11 @@ #pragma once -#include - #include "foleys_GUITreeEditor.h" -#include "foleys_PropertiesEditor.h" #include "foleys_Palette.h" +#include "foleys_PropertiesEditor.h" + +#include namespace foleys { @@ -47,10 +47,12 @@ class MagicGUIBuilder; /** The Toolbox defines a floating window, that allows live editing of the currently loaded GUI. */ -class ToolBox : public juce::Component, - public juce::DragAndDropContainer, - public juce::KeyListener, - private juce::MultiTimer +class ToolBox + : public juce::Component + , public juce::DragAndDropContainer + , public juce::KeyListener + , private juce::MultiTimer + , private foleys::MagicGUIBuilder::Listener { public: /** @@ -63,7 +65,12 @@ class ToolBox : public juce::Component, ToolBox (juce::Component* parent, MagicGUIBuilder& builder); ~ToolBox() override; - enum PositionOption { left, right, detached }; + enum PositionOption + { + left, + right, + detached + }; void loadDialog(); void saveDialog(); @@ -87,6 +94,9 @@ class ToolBox : public juce::Component, bool keyPressed (const juce::KeyPress& key) override; bool keyPressed (const juce::KeyPress& key, juce::Component* originalComponent) override; + void selectedItem (const juce::ValueTree& node) override; + void guiItemDropped ([[maybe_unused]] const juce::ValueTree& node, [[maybe_unused]] juce::ValueTree& droppedOnto) override { } + static juce::PropertiesFile::Options getApplicationPropertyStorage(); void setLastLocation (juce::File file); @@ -94,11 +104,11 @@ class ToolBox : public juce::Component, private: enum Timers : int { - WindowDrag=1, + WindowDrag = 1, AutoSave }; - static juce::String positionOptionToString (PositionOption option); + static juce::String positionOptionToString (PositionOption option); static PositionOption positionOptionFromString (const juce::String& text); static std::unique_ptr getFileFilter(); @@ -109,18 +119,18 @@ class ToolBox : public juce::Component, juce::UndoManager& undo; juce::ApplicationProperties appProperties; - juce::TextButton fileMenu { TRANS ("File...") }; - juce::TextButton viewMenu { TRANS ("View...") }; + juce::TextButton fileMenu { TRANS ("File...") }; + juce::TextButton viewMenu { TRANS ("View...") }; - juce::TextButton undoButton { TRANS ("Undo") }; + juce::TextButton undoButton { TRANS ("Undo") }; - juce::TextButton editSwitch { TRANS ("Edit") }; + juce::TextButton editSwitch { TRANS ("Edit") }; - PositionOption positionOption { left }; + PositionOption positionOption { left }; - GUITreeEditor treeEditor { builder }; - PropertiesEditor propertiesEditor { builder }; - Palette palette { builder }; + GUITreeEditor treeEditor { builder }; + PropertiesEditor propertiesEditor { builder }; + Palette palette { builder }; juce::StretchableLayoutManager resizeManager; juce::StretchableLayoutResizerBar resizer1 { &resizeManager, 1, false }; @@ -130,9 +140,9 @@ class ToolBox : public juce::Component, juce::File lastLocation; juce::File autoSaveFile; - void updateToolboxPosition(); + void updateToolboxPosition(); juce::ResizableCornerComponent resizeCorner { this, nullptr }; - juce::ComponentDragger componentDragger; + juce::ComponentDragger componentDragger; void mouseDown (const juce::MouseEvent& e) override; void mouseDrag (const juce::MouseEvent& e) override; @@ -140,4 +150,4 @@ class ToolBox : public juce::Component, JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToolBox) }; -} // namespace foleys +} // namespace foleys diff --git a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp index a1234365..b88f01fe 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp +++ b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.cpp @@ -32,9 +32,10 @@ */ #include "foleys_MagicGUIBuilder.h" -#include "../Layout/foleys_RootItem.h" -#include "../Layout/foleys_Container.h" + #include "../Helpers/foleys_DefaultGuiTrees.h" +#include "../Layout/foleys_Container.h" +#include "../Layout/foleys_RootItem.h" #include "../LookAndFeels/foleys_JuceLookAndFeels.h" #include "../LookAndFeels/foleys_LookAndFeel.h" #include "../LookAndFeels/foleys_Skeuomorphic.h" @@ -47,8 +48,7 @@ namespace foleys { -MagicGUIBuilder::MagicGUIBuilder (MagicGUIState& state) - : magicState (state) +MagicGUIBuilder::MagicGUIBuilder (MagicGUIState& state) : magicState (state) { updateStylesheet(); getConfigTree().addListener (this); @@ -57,6 +57,7 @@ MagicGUIBuilder::MagicGUIBuilder (MagicGUIState& state) MagicGUIBuilder::~MagicGUIBuilder() { getConfigTree().removeListener (this); + masterReference.clear(); } Stylesheet& MagicGUIBuilder::getStylesheet() @@ -78,8 +79,7 @@ std::unique_ptr MagicGUIBuilder::createGuiItem (const juce::ValueTree& { if (node.getType() == IDs::view) { - auto item = (node == getGuiRootNode()) ? std::make_unique(*this, node) - : std::make_unique(*this, node); + auto item = (node == getGuiRootNode()) ? std::make_unique (*this, node) : std::make_unique (*this, node); item->updateInternal(); item->createSubComponents(); return item; @@ -93,7 +93,7 @@ std::unique_ptr MagicGUIBuilder::createGuiItem (const juce::ValueTree& return item; } - DBG ("No factory for: " << node.getType().toString()); + DBG ("No GUI factory for: " << node.getType().toString()); return {}; } @@ -135,7 +135,7 @@ void MagicGUIBuilder::showOverlayDialog (std::unique_ptr dialog overlayDialog = std::move (dialog); parent->addAndMakeVisible (overlayDialog.get()); - updateLayout(); + parent->resized(); } void MagicGUIBuilder::closeOverlayDialog() @@ -167,37 +167,35 @@ void MagicGUIBuilder::updateComponents() root->setBounds (parent->getLocalBounds()); -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE if (root.get() != nullptr) root->setEditMode (editMode); -#endif } -void MagicGUIBuilder::updateLayout() +void MagicGUIBuilder::updateLayout (juce::Rectangle bounds) { if (parent == nullptr) return; if (root.get() != nullptr) { - if (! stylesheet.setMediaSize (parent->getWidth(), parent->getHeight())) + if (!stylesheet.setMediaSize (bounds.getWidth(), bounds.getHeight())) { stylesheet.updateValidRanges(); root->updateInternal(); } - if (root->getBounds() == parent->getLocalBounds()) + if (root->getBounds() == bounds) root->updateLayout(); else - root->setBounds (parent->getLocalBounds()); + root->setBounds (bounds); } if (overlayDialog) { - if (overlayDialog->getBounds() == parent->getLocalBounds()) + if (overlayDialog->getBounds() == bounds) overlayDialog->resized(); else - overlayDialog->setBounds (parent->getLocalBounds()); + overlayDialog->setBounds (bounds); } parent->repaint(); @@ -225,7 +223,7 @@ GuiItem* MagicGUIBuilder::findGuiItem (const juce::ValueTree& node) return nullptr; } -void MagicGUIBuilder::registerFactory (juce::Identifier type, std::unique_ptr(*factory)(MagicGUIBuilder& builder, const juce::ValueTree&)) +void MagicGUIBuilder::registerFactory (juce::Identifier type, std::unique_ptr (*factory) (MagicGUIBuilder& builder, const juce::ValueTree&)) { if (factories.find (type) != factories.cend()) { @@ -235,7 +233,7 @@ void MagicGUIBuilder::registerFactory (juce::Identifier type, std::unique_ptr MagicGUIBuilder::createChoicesMenuLambda (juce::StringArray choices) const +std::function MagicGUIBuilder::createChoicesMenuLambda (juce::StringArray choices) const { - return [choices](juce::ComboBox& combo) + return [choices] (juce::ComboBox& combo) { int index = 0; - for (auto& choice : choices) + for (auto& choice: choices) combo.addItem (choice, ++index); }; } -std::function MagicGUIBuilder::createParameterMenuLambda() const +std::function MagicGUIBuilder::createParameterMenuLambda() const { - return [this](juce::ComboBox& combo) - { - *combo.getRootMenu() = magicState.createParameterMenu(); - }; + return [this] (juce::ComboBox& combo) { *combo.getRootMenu() = magicState.createParameterMenu(); }; } -std::function MagicGUIBuilder::createPropertiesMenuLambda() const +std::function MagicGUIBuilder::createPropertiesMenuLambda() const { - return [this](juce::ComboBox& combo) - { - magicState.populatePropertiesMenu (combo); - }; + return [this] (juce::ComboBox& combo) { magicState.populatePropertiesMenu (combo); }; } -std::function MagicGUIBuilder::createTriggerMenuLambda() const +std::function MagicGUIBuilder::createTriggerMenuLambda() const { - return [this](juce::ComboBox& combo) - { - *combo.getRootMenu() = magicState.createTriggerMenu(); - }; + return [this] (juce::ComboBox& combo) { *combo.getRootMenu() = magicState.createTriggerMenu(); }; } juce::var MagicGUIBuilder::getPropertyDefaultValue (juce::Identifier property) const { // flexbox - if (property == IDs::flexDirection) return IDs::flexDirRow; - if (property == IDs::flexWrap) return IDs::flexNoWrap; - if (property == IDs::flexAlignContent) return IDs::flexStretch; - if (property == IDs::flexAlignItems) return IDs::flexStretch; - if (property == IDs::flexJustifyContent) return IDs::flexStart; - if (property == IDs::flexAlignSelf) return IDs::flexStretch; - if (property == IDs::flexOrder) return 0; - if (property == IDs::flexGrow) return 1.0; - if (property == IDs::flexShrink) return 1.0; - if (property == IDs::minWidth) return 0.0; - if (property == IDs::minHeight) return 0.0; - if (property == IDs::display) return IDs::flexbox; - - if (property == IDs::captionPlacement) return "centred-top"; - if (property == IDs::lookAndFeel) return "FoleysFinest"; - - if (property == juce::Identifier ("font-size")) return 12.0; + if (property == IDs::flexDirection) + return IDs::flexDirRow; + if (property == IDs::flexWrap) + return IDs::flexNoWrap; + if (property == IDs::flexAlignContent) + return IDs::flexStretch; + if (property == IDs::flexAlignItems) + return IDs::flexStretch; + if (property == IDs::flexJustifyContent) + return IDs::flexStart; + if (property == IDs::flexAlignSelf) + return IDs::flexStretch; + if (property == IDs::flexOrder) + return 0; + if (property == IDs::flexGrow) + return 1.0; + if (property == IDs::flexShrink) + return 1.0; + if (property == IDs::minWidth) + return 0.0; + if (property == IDs::minHeight) + return 0.0; + if (property == IDs::display) + return IDs::flexbox; + + if (property == IDs::captionPlacement) + return "centred-top"; + if (property == IDs::lookAndFeel) + return "FoleysFinest"; + + if (property == juce::Identifier ("font-size")) + return 12.0; return {}; } @@ -361,7 +365,7 @@ void MagicGUIBuilder::changeListenerCallback (juce::ChangeBroadcaster*) if (root.get() != nullptr) root->updateInternal(); - updateLayout(); + root->resized(); } void MagicGUIBuilder::valueTreeRedirected (juce::ValueTree& treeWhichHasBeenChanged) @@ -380,8 +384,6 @@ juce::UndoManager& MagicGUIBuilder::getUndoManager() return undo; } -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE - void MagicGUIBuilder::setEditMode (bool shouldEdit) { editMode = shouldEdit; @@ -411,8 +413,8 @@ void MagicGUIBuilder::setSelectedNode (const juce::ValueTree& node) item->setDraggable (false); selectedNode = node; - if (magicToolBox.get() != nullptr) - magicToolBox->setSelectedNode (selectedNode); + + listeners.call ([node] (Listener& l) { l.selectedItem (node); }); if (auto* item = findGuiItem (selectedNode)) item->setDraggable (true); @@ -449,18 +451,21 @@ void MagicGUIBuilder::draggedItemOnto (juce::ValueTree dragged, juce::ValueTree targetParent.addChild (dragged, index, &undo); } +#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE + void MagicGUIBuilder::attachToolboxToWindow (juce::Component& window) { juce::Component::SafePointer reference (&window); - juce::MessageManager::callAsync ([&, reference] - { - if (reference != nullptr) - { - magicToolBox = std::make_unique(reference->getTopLevelComponent(), *this); - magicToolBox->setLastLocation (magicState.getResourcesFolder()); - } - }); + juce::MessageManager::callAsync ( + [&, reference] + { + if (reference != nullptr) + { + magicToolBox = std::make_unique (reference->getTopLevelComponent(), *this); + magicToolBox->setLastLocation (magicState.getResourcesFolder()); + } + }); } ToolBox& MagicGUIBuilder::getMagicToolBox() @@ -476,4 +481,4 @@ ToolBox& MagicGUIBuilder::getMagicToolBox() #endif -} // namespace foleys +} // namespace foleys diff --git a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h index 15e318b2..50c77e45 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h +++ b/modules/foleys_gui_magic/General/foleys_MagicGUIBuilder.h @@ -33,13 +33,13 @@ #pragma once -#include - #include "../Layout/foleys_GuiItem.h" #include "../Layout/foleys_Stylesheet.h" #include "../State/foleys_MagicGUIState.h" #include "../State/foleys_RadioButtonManager.h" +#include + namespace foleys { #if FOLEYS_SHOW_GUI_EDITOR_PALLETTE @@ -50,8 +50,9 @@ namespace foleys The MagicGUIBuilder is responsible to recreate the GUI from a single ValueTree. You can add your own factories to the builder to allow additional components. */ -class MagicGUIBuilder : public juce::ChangeListener, - public juce::ValueTree::Listener +class MagicGUIBuilder + : public juce::ChangeListener + , public juce::ValueTree::Listener { public: MagicGUIBuilder (MagicGUIState& magicStateToUse); @@ -109,7 +110,7 @@ class MagicGUIBuilder : public juce::ChangeListener, /** Recalculates the layout of all components */ - void updateLayout(); + void updateLayout (juce::Rectangle bounds); /** Resolve all colours fresh, in case the palette has changed @@ -119,7 +120,7 @@ class MagicGUIBuilder : public juce::ChangeListener, /** Register a factory for Components to be available in the GUI editor. If you need a reference to the application, you can capture that in the factory lambda. */ - void registerFactory (juce::Identifier type, std::unique_ptr(*factory)(MagicGUIBuilder& builder, const juce::ValueTree&)); + void registerFactory (juce::Identifier type, std::unique_ptr (*factory) (MagicGUIBuilder& builder, const juce::ValueTree&)); /** With that method you can register your custom LookAndFeel class and apply it to different components. @@ -177,18 +178,18 @@ class MagicGUIBuilder : public juce::ChangeListener, juce::StringArray getFactoryNames() const; - std::function createChoicesMenuLambda (juce::StringArray choices) const; - std::function createParameterMenuLambda() const; - std::function createPropertiesMenuLambda() const; - std::function createTriggerMenuLambda() const; + std::function createChoicesMenuLambda (juce::StringArray choices) const; + std::function createParameterMenuLambda() const; + std::function createPropertiesMenuLambda() const; + std::function createTriggerMenuLambda() const; template - std::function createObjectsMenuLambda() const + std::function createObjectsMenuLambda() const { - return [this](juce::ComboBox& combo) + return [this] (juce::ComboBox& combo) { int index = 0; - for (const auto& name : magicState.getObjectIDsByType()) + for (const auto& name: magicState.getObjectIDsByType()) combo.addItem (name, ++index); }; } @@ -215,22 +216,34 @@ class MagicGUIBuilder : public juce::ChangeListener, #if FOLEYS_SHOW_GUI_EDITOR_PALLETTE void attachToolboxToWindow (juce::Component& window); + ToolBox& getMagicToolBox(); +#endif + + class Listener + { + public: + /** This is called in edit mode, when the user selects an item */ + virtual void selectedItem (const juce::ValueTree& node) = 0; + + /** This is called when the user drops an item in edit node */ + virtual void guiItemDropped (const juce::ValueTree& node, juce::ValueTree& droppedOnto) = 0; + }; + + void addListener (Listener* listener) { listeners.add (listener); } + void removeListener (Listener* listener) { listeners.remove (listener); } + /** This method sets the GUI in edit mode, that allows to drag the components around. */ void setEditMode (bool shouldEdit); bool isEditModeOn() const; - void setSelectedNode (const juce::ValueTree& node); + void setSelectedNode (const juce::ValueTree& node); const juce::ValueTree& getSelectedNode() const; - void draggedItemOnto (juce::ValueTree dropped, juce::ValueTree target, int index=-1); - - ToolBox& getMagicToolBox(); -#endif + void draggedItemOnto (juce::ValueTree dropped, juce::ValueTree target, int index = -1); private: - juce::UndoManager undo; Stylesheet stylesheet { *this }; @@ -246,23 +259,25 @@ class MagicGUIBuilder : public juce::ChangeListener, std::unique_ptr overlayDialog; - std::map(*)(MagicGUIBuilder& builder, const juce::ValueTree&)> factories; + std::map (*) (MagicGUIBuilder& builder, const juce::ValueTree&)> factories; -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE - bool editMode = false; - juce::ValueTree selectedNode; + juce::ListenerList listeners; + bool editMode = false; + juce::ValueTree selectedNode; +#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE std::unique_ptr magicToolBox; #endif + JUCE_DECLARE_WEAK_REFERENCEABLE (MagicGUIBuilder) JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MagicGUIBuilder) }; -#define FOLEYS_DECLARE_GUI_FACTORY(itemName) \ -static inline std::unique_ptr factory (foleys::MagicGUIBuilder& builder, const juce::ValueTree& node)\ -{\ - return std::make_unique(builder, node);\ -} +#define FOLEYS_DECLARE_GUI_FACTORY(itemName) \ + static inline std::unique_ptr factory (foleys::MagicGUIBuilder& builder, const juce::ValueTree& node) \ + { \ + return std::make_unique (builder, node); \ + } -} // namespace foleys +} // namespace foleys diff --git a/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp b/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp index 9efd5ab0..159b3d5e 100644 --- a/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp +++ b/modules/foleys_gui_magic/General/foleys_MagicPluginEditor.cpp @@ -142,7 +142,7 @@ void MagicPluginEditor::paint (juce::Graphics& g) void MagicPluginEditor::resized() { - builder->updateLayout(); + builder->updateLayout (getLocalBounds()); processorState.setLastEditorSize (getWidth(), getHeight()); } diff --git a/modules/foleys_gui_magic/Layout/foleys_Container.cpp b/modules/foleys_gui_magic/Layout/foleys_Container.cpp index c154924d..6981ed71 100644 --- a/modules/foleys_gui_magic/Layout/foleys_Container.cpp +++ b/modules/foleys_gui_magic/Layout/foleys_Container.cpp @@ -381,7 +381,6 @@ std::vector>::iterator Container::end() return children.end(); } -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE void Container::setEditMode (bool shouldEdit) { for (auto& child : children) @@ -389,7 +388,6 @@ void Container::setEditMode (bool shouldEdit) GuiItem::setEditMode (shouldEdit); } -#endif //============================================================================== diff --git a/modules/foleys_gui_magic/Layout/foleys_Container.h b/modules/foleys_gui_magic/Layout/foleys_Container.h index 6cfe535b..3883cbe1 100644 --- a/modules/foleys_gui_magic/Layout/foleys_Container.h +++ b/modules/foleys_gui_magic/Layout/foleys_Container.h @@ -127,14 +127,12 @@ class Container : public GuiItem, */ GuiItem* findGuiItem (const juce::ValueTree& node) override; -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE /** This switches this node and all it's descendents in the edit mode, which means, the components don't react, but instead you can move them around. */ void setEditMode (bool shouldEdit) override; -#endif private: class Scroller : public juce::Viewport diff --git a/modules/foleys_gui_magic/Layout/foleys_GuiItem.cpp b/modules/foleys_gui_magic/Layout/foleys_GuiItem.cpp index 058b339f..e940d7fa 100644 --- a/modules/foleys_gui_magic/Layout/foleys_GuiItem.cpp +++ b/modules/foleys_gui_magic/Layout/foleys_GuiItem.cpp @@ -102,9 +102,7 @@ void GuiItem::updateInternal() update(); -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE setEditMode (magicBuilder.isEditModeOn()); -#endif repaint(); } @@ -250,10 +248,8 @@ juce::Rectangle GuiItem::getClientBounds() const void GuiItem::resized() { -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE if (borderDragger) borderDragger->setBounds (getLocalBounds()); -#endif if (auto* component = getWrappedComponent()) { @@ -373,13 +369,11 @@ GuiItem* GuiItem::findGuiItem (const juce::ValueTree& node) void GuiItem::paintOverChildren (juce::Graphics& g) { -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE if (magicBuilder.isEditModeOn() && magicBuilder.getSelectedNode() == configNode) { g.setColour (juce::Colours::orange.withAlpha (0.5f)); g.fillRoundedRectangle (getLocalBounds().toFloat(), 5.0f); } -#endif if (highlight.isNotEmpty()) { @@ -388,8 +382,6 @@ void GuiItem::paintOverChildren (juce::Graphics& g) } } -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE - void GuiItem::setEditMode (bool shouldEdit) { setInterceptsMouseClicks (shouldEdit, true); @@ -481,8 +473,6 @@ void GuiItem::mouseUp (const juce::MouseEvent& event) magicBuilder.setSelectedNode (configNode); } -#endif - bool GuiItem::isInterestedInDragSource (const juce::DragAndDropTarget::SourceDetails &) { return true; @@ -505,7 +495,6 @@ void GuiItem::itemDropped (const juce::DragAndDropTarget::SourceDetails &dragSou return; } -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE if (dragSourceDetails.description == IDs::dragSelected) { auto dragged = magicBuilder.getSelectedNode(); @@ -519,7 +508,6 @@ void GuiItem::itemDropped (const juce::DragAndDropTarget::SourceDetails &dragSou auto node = juce::ValueTree::fromXml (dragSourceDetails.description.toString()); if (node.isValid()) magicBuilder.draggedItemOnto (node, configNode); -#endif } diff --git a/modules/foleys_gui_magic/Layout/foleys_GuiItem.h b/modules/foleys_gui_magic/Layout/foleys_GuiItem.h index 4984f66e..f29ae17c 100644 --- a/modules/foleys_gui_magic/Layout/foleys_GuiItem.h +++ b/modules/foleys_gui_magic/Layout/foleys_GuiItem.h @@ -168,8 +168,6 @@ class GuiItem : public juce::Component, */ virtual GuiItem* findGuiItem (const juce::ValueTree& node); -#if FOLEYS_SHOW_GUI_EDITOR_PALLETTE - /** This method sets the GUI in edit mode, that allows to drag the components around. */ @@ -181,8 +179,6 @@ class GuiItem : public juce::Component, void mouseDrag (const juce::MouseEvent& event) override; void mouseUp (const juce::MouseEvent& event) override; -#endif - bool isInterestedInDragSource (const juce::DragAndDropTarget::SourceDetails &dragSourceDetails) override; void itemDropped (const juce::DragAndDropTarget::SourceDetails &dragSourceDetails) override; diff --git a/modules/foleys_gui_magic/State/foleys_MagicGUIState.h b/modules/foleys_gui_magic/State/foleys_MagicGUIState.h index 7b4f6501..0b9683c4 100644 --- a/modules/foleys_gui_magic/State/foleys_MagicGUIState.h +++ b/modules/foleys_gui_magic/State/foleys_MagicGUIState.h @@ -200,6 +200,16 @@ class MagicGUIState return nullptr; } + /** + * This removes all objects managed by the MagicGuiState. + * Make sure all objects that depend on those objects are deleted first (especially GUI) + */ + void clearAllObjects() + { + visualiserThread.removeAllClients(); + advertisedObjects.clear(); + } + /** Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup diff --git a/modules/foleys_gui_magic/Widgets/foleys_XYDragComponent.cpp b/modules/foleys_gui_magic/Widgets/foleys_XYDragComponent.cpp index 77c3bf9d..7a14837a 100644 --- a/modules/foleys_gui_magic/Widgets/foleys_XYDragComponent.cpp +++ b/modules/foleys_gui_magic/Widgets/foleys_XYDragComponent.cpp @@ -40,12 +40,12 @@ XYDragComponent::XYDragComponent() { setOpaque (false); - setColour (xyDotColourId, juce::Colours::orange.darker()); - setColour (xyDotOverColourId, juce::Colours::orange); - setColour (xyHorizontalColourId, juce::Colours::orange.darker()); + setColour (xyDotColourId, juce::Colours::orange.darker()); + setColour (xyDotOverColourId, juce::Colours::orange); + setColour (xyHorizontalColourId, juce::Colours::orange.darker()); setColour (xyHorizontalOverColourId, juce::Colours::orange); - setColour (xyVerticalColourId, juce::Colours::orange.darker()); - setColour (xyVerticalOverColourId, juce::Colours::orange); + setColour (xyVerticalColourId, juce::Colours::orange.darker()); + setColour (xyVerticalOverColourId, juce::Colours::orange); xAttachment.onParameterChangedAsync = [&] { repaint(); }; yAttachment.onParameterChangedAsync = [&] { repaint(); }; @@ -59,14 +59,14 @@ XYDragComponent::XYDragComponent() */ void XYDragComponent::setCrossHair (bool horizontal, bool vertical) { - wantsVerticalDrag = horizontal; + wantsVerticalDrag = horizontal; wantsHorizontalDrag = vertical; } void XYDragComponent::paint (juce::Graphics& g) { - const auto x = getXposition(); - const auto y = getYposition(); + const auto x = getXposition(); + const auto y = getYposition(); const auto gap = radius * 1.8f; if (wantsVerticalDrag) @@ -134,8 +134,8 @@ void XYDragComponent::updateWhichToDrag (juce::Point pos) const auto centre = juce::Point (getXposition(), getYposition()).toFloat(); mouseOverDot = (centre.getDistanceFrom (pos) < radius * senseFactor); - mouseOverX = (wantsHorizontalDrag && std::abs (pos.getX() - centre.getX()) < senseFactor + 1.0f); - mouseOverY = (wantsVerticalDrag && std::abs (pos.getY() - centre.getY()) < senseFactor + 1.0f); + mouseOverX = (wantsHorizontalDrag && std::abs (pos.getX() - centre.getX()) < senseFactor + 1.0f); + mouseOverY = (wantsVerticalDrag && std::abs (pos.getY() - centre.getY()) < senseFactor + 1.0f); repaint(); } @@ -145,8 +145,8 @@ bool XYDragComponent::hitTest (int x, int y) if (jumpToClick) return true; - const auto click = juce::Point (x, y).toFloat (); - const auto centre = juce::Point (getXposition (), getYposition ()).toFloat (); + const auto click = juce::Point (x, y).toFloat(); + const auto centre = juce::Point (getXposition(), getYposition()).toFloat(); if (centre.getDistanceFrom (click) < radius * senseFactor) return true; @@ -165,34 +165,32 @@ void XYDragComponent::mouseDown (const juce::MouseEvent& event) if (contextMenuParameter && (event.mods.isPopupMenu())) { juce::PopupMenu menu; - int id = 0; - auto current = contextMenuParameter->getCurrentValueAsText(); + int id = 0; + auto current = contextMenuParameter->getCurrentValueAsText(); - for (const auto& item : contextMenuParameter->getAllValueStrings()) + for (const auto& item: contextMenuParameter->getAllValueStrings()) menu.addItem (++id, item, true, item == current); - menu.showMenuAsync (juce::PopupMenu::Options() - .withTargetComponent (this) - .withTargetScreenArea ({event.getScreenX(), event.getScreenY(), 1, 1}), - [cmp = contextMenuParameter](int selected) - { - if (selected <= 0) - return; - - const auto& range = cmp->getNormalisableRange(); - auto value = range.start + (selected-1) * range.interval; - cmp->beginChangeGesture(); - cmp->setValueNotifyingHost (cmp->convertTo0to1 (value)); - cmp->endChangeGesture(); - }); + menu.showMenuAsync (juce::PopupMenu::Options().withTargetComponent (this).withTargetScreenArea ({ event.getScreenX(), event.getScreenY(), 1, 1 }), + [cmp = contextMenuParameter] (int selected) + { + if (selected <= 0) + return; + + const auto& range = cmp->getNormalisableRange(); + auto value = range.start + (static_cast (selected - 1)) * range.interval; + cmp->beginChangeGesture(); + cmp->setValueNotifyingHost (cmp->convertTo0to1 (value)); + cmp->endChangeGesture(); + }); return; } if (jumpToClick) { - mouseOverX = true; - mouseOverY = true; + mouseOverX = true; + mouseOverY = true; mouseOverDot = true; xAttachment.beginGesture(); @@ -249,13 +247,13 @@ void XYDragComponent::mouseWheelMove (const juce::MouseEvent& event, const juce: wheelParameter->beginChangeGesture(); auto range = wheelParameter->getNormalisableRange(); auto lastValue = range.convertFrom0to1 (wheelParameter->getValue()); - auto interval = details.deltaY > 0.0f ? range.interval : -range.interval; + auto interval = details.deltaY > 0.0f ? range.interval : -range.interval; wheelParameter->setValueNotifyingHost (range.convertTo0to1 (juce::jlimit (range.start, range.end, lastValue + interval))); wheelParameter->endChangeGesture(); return; } - juce::Component::mouseWheelMove(event, details); + juce::Component::mouseWheelMove (event, details); } void XYDragComponent::mouseEnter (const juce::MouseEvent& event) @@ -266,8 +264,8 @@ void XYDragComponent::mouseEnter (const juce::MouseEvent& event) void XYDragComponent::mouseExit (const juce::MouseEvent&) { mouseOverDot = false; - mouseOverX = false; - mouseOverY = false; + mouseOverX = false; + mouseOverY = false; repaint(); } @@ -282,4 +280,4 @@ int XYDragComponent::getYposition() const return juce::roundToInt ((1.0f - yAttachment.getNormalisedValue()) * getHeight()); } -} // namespace foleys +} // namespace foleys