From 217426e65a7e347ac270c04ba64300a6e89f3df3 Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Sun, 1 Aug 2021 23:14:00 +0200 Subject: [PATCH 1/6] Added backward compatibility for changed AlertWindow::IconType --- Editor/foleys_PropertiesEditor.cpp | 7 ++++++- VERSION.md | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Editor/foleys_PropertiesEditor.cpp b/Editor/foleys_PropertiesEditor.cpp index 993775ef..009e04a5 100644 --- a/Editor/foleys_PropertiesEditor.cpp +++ b/Editor/foleys_PropertiesEditor.cpp @@ -175,10 +175,15 @@ juce::ValueTree& PropertiesEditor::getNodeToEdit() void PropertiesEditor::createNewClass() { static juce::String editorID { "styleClass" }; +#if JUCE_VERSION > 0x60008 // bump to 9 once juce fixes the version number + auto iconType = juce::MessageBoxIconType::QuestionIcon; +#else + auto iconType = juce::AlertWindow::QuestionIcon; +#endif classNameInput = std::make_unique (TRANS ("New style class"), TRANS ("Enter a name:"), - juce::MessageBoxIconType::QuestionIcon, + iconType, this); classNameInput->addTextEditor (editorID, "class"); classNameInput->addButton (TRANS ("Cancel"), 0); diff --git a/VERSION.md b/VERSION.md index 16fda3f2..feec51a5 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1,9 +1,12 @@ PluginGuiMagic - Versions history ================================ -1.3.4 +1.3.5 ----- +1.3.4 - 01.08.2021 +------------------ + - Removed modal loops (needed for JUCE 6.0.9) - Added PopupMenu background and colours in ComboBox for all shipped LookAndFeels - Made Tooltip colours configurable From 351e7107b1b50a9f74fa91e5b7afa3b556be24bb Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Sun, 1 Aug 2021 23:33:35 +0200 Subject: [PATCH 2/6] Cleanup --- Editor/foleys_PropertiesEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Editor/foleys_PropertiesEditor.cpp b/Editor/foleys_PropertiesEditor.cpp index 009e04a5..37d383ee 100644 --- a/Editor/foleys_PropertiesEditor.cpp +++ b/Editor/foleys_PropertiesEditor.cpp @@ -175,7 +175,7 @@ juce::ValueTree& PropertiesEditor::getNodeToEdit() void PropertiesEditor::createNewClass() { static juce::String editorID { "styleClass" }; -#if JUCE_VERSION > 0x60008 // bump to 9 once juce fixes the version number +#if JUCE_VERSION > 0x60008 auto iconType = juce::MessageBoxIconType::QuestionIcon; #else auto iconType = juce::AlertWindow::QuestionIcon; From 6fbb3721ff80a8813dab025396f62686df3c5b0a Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Fri, 20 Aug 2021 09:57:40 +0200 Subject: [PATCH 3/6] Documented common settings --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 7b09bfdf..45adfb66 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,22 @@ The `foleys::MagicProcessor` takes care of saving and restoring the parameters a You can add your own values to the ValueTree in the `magicState`. There is a callback after restoring that you can override, in case you need to do some additional action. +Additionally to saving the values in the plugin state you can have settings across all instances of your plugin. +To use that you need to setup the path to a file. After that the settings are synchronised in the +settings of the magicState: +``` +// in constructor +magicState.setApplicationSettingsFile (juce::File::getSpecialLocation (juce::File::userApplicationDataDirectory) + .getChildFile (ProjectInfo::companyName) + .getChildFile (ProjectInfo::projectName + juce::String (".settings"))); + +// use it like +presetNode = magicState.getSettings().getOrCreateChildWithName ("presets", nullptr); +presetNode.setProperty ("foo", 100, nullptr); +``` + +Other than the juce::ApplicationSettings this is not a flat list but can deal with hierarchical data in form of ValueTrees. +PluginGuiMagic will deal with interprocess safety and update if the file has changed. Bake in the xml --------------- From 28f765c28753385cad9b9e8ceb9eb881a7da2675 Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Sun, 29 Aug 2021 15:02:57 +0200 Subject: [PATCH 4/6] Add ParameterAttachment for Label --- General/foleys_MagicJUCEFactories.cpp | 28 ++++++++++++++++++++++++++- VERSION.md | 2 ++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/General/foleys_MagicJUCEFactories.cpp b/General/foleys_MagicJUCEFactories.cpp index a152f54a..75793fb6 100644 --- a/General/foleys_MagicJUCEFactories.cpp +++ b/General/foleys_MagicJUCEFactories.cpp @@ -413,6 +413,30 @@ class LabelItem : public GuiItem label.setEditable (getProperty (pEditable)); + auto parameterName = getProperty (IDs::parameter).toString(); + if (parameterName.isNotEmpty()) + { + auto* parameter = getMagicState().getParameter (parameterName); + if (parameter) + { + label.setEditable (true); + attachment = std::make_unique( + *parameter, + [&, parameter](float value) + { + auto normalised = parameter->convertTo0to1 (value); + label.setText (parameter->getText (normalised, 0), + juce::dontSendNotification); + }); + label.onTextChange = [&, parameter] + { + auto denormalised = parameter->convertFrom0to1 (parameter->getValueForText (label.getText())); + attachment->setValueAsCompleteGesture (denormalised); + }; + attachment->sendInitialUpdate(); + } + } + auto propertyPath = getProperty (pValue).toString(); if (propertyPath.isNotEmpty()) label.getTextValue().referTo (getMagicState().getPropertyAsValue (propertyPath)); @@ -425,6 +449,7 @@ class LabelItem : public GuiItem props.push_back ({ configNode, pJustification, SettableProperty::Choice, {}, magicBuilder.createChoicesMenuLambda (getAllKeyNames (makeJustificationsChoices())) }); props.push_back ({ configNode, pFontSize, SettableProperty::Number, {}, {} }); props.push_back ({ configNode, pEditable, SettableProperty::Toggle, {}, {} }); + props.push_back ({ configNode, IDs::parameter, SettableProperty::Choice, {}, magicBuilder.createParameterMenuLambda() }); props.push_back ({ configNode, pValue, SettableProperty::Choice, {}, magicBuilder.createPropertiesMenuLambda() }); return props; } @@ -435,7 +460,8 @@ class LabelItem : public GuiItem } private: - juce::Label label; + juce::Label label; + std::unique_ptr attachment; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LabelItem) }; diff --git a/VERSION.md b/VERSION.md index feec51a5..3a802e7f 100644 --- a/VERSION.md +++ b/VERSION.md @@ -4,6 +4,8 @@ PluginGuiMagic - Versions history 1.3.5 ----- +- Add ParameterAttachment for Label + 1.3.4 - 01.08.2021 ------------------ From 6b3d657986ee5f0d821323390ac3900a375c8dfd Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Sun, 29 Aug 2021 15:16:49 +0200 Subject: [PATCH 5/6] Added safety check for invalid last location --- Editor/foleys_ToolBox.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Editor/foleys_ToolBox.cpp b/Editor/foleys_ToolBox.cpp index 874596dc..d7b40b09 100644 --- a/Editor/foleys_ToolBox.cpp +++ b/Editor/foleys_ToolBox.cpp @@ -379,6 +379,9 @@ void ToolBox::updateToolboxPosition() void ToolBox::setLastLocation(juce::File file) { + if (file.getFullPathName().isEmpty()) + return; + if (file.isDirectory()) file = file.getChildFile ("magic.xml"); From 7c28c5db92db16b6224a509747d53a41e875d32a Mon Sep 17 00:00:00 2001 From: Daniel Walz Date: Mon, 13 Sep 2021 23:31:54 +0200 Subject: [PATCH 6/6] Fixed a crash when undoing after a drag operation --- Editor/foleys_StyleBoolPropertyComponent.cpp | 5 +++++ Editor/foleys_StyleChoicePropertyComponent.cpp | 5 +++++ Editor/foleys_StyleColourPropertyComponent.cpp | 1 + Editor/foleys_StyleGradientPropertyComponent.cpp | 1 + Editor/foleys_StyleTextPropertyComponent.cpp | 5 +++++ VERSION.md | 2 ++ foleys_gui_magic.h | 2 +- 7 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Editor/foleys_StyleBoolPropertyComponent.cpp b/Editor/foleys_StyleBoolPropertyComponent.cpp index 624432a6..94984df7 100644 --- a/Editor/foleys_StyleBoolPropertyComponent.cpp +++ b/Editor/foleys_StyleBoolPropertyComponent.cpp @@ -68,9 +68,14 @@ void StyleBoolPropertyComponent::refresh() if (auto* toggle = dynamic_cast(editor.get())) { if (node == inheritedFrom) + { toggle->getToggleStateValue().referTo (node.getPropertyAsValue (property, &builder.getUndoManager())); + } else + { + toggle->getToggleStateValue().referTo (toggle->getToggleStateValue()); toggle->setToggleState (value, juce::dontSendNotification); + } } repaint(); diff --git a/Editor/foleys_StyleChoicePropertyComponent.cpp b/Editor/foleys_StyleChoicePropertyComponent.cpp index 6785826b..374ba320 100644 --- a/Editor/foleys_StyleChoicePropertyComponent.cpp +++ b/Editor/foleys_StyleChoicePropertyComponent.cpp @@ -97,9 +97,14 @@ void StyleChoicePropertyComponent::refresh() if (auto* combo = dynamic_cast(editor.get())) { if (node == inheritedFrom) + { proxy.referTo (node.getPropertyAsValue (property, &builder.getUndoManager())); + } else + { + proxy.referTo (proxy); combo->setText (value.toString(), juce::dontSendNotification); + } } repaint(); diff --git a/Editor/foleys_StyleColourPropertyComponent.cpp b/Editor/foleys_StyleColourPropertyComponent.cpp index 7204a69d..a0ebaf68 100644 --- a/Editor/foleys_StyleColourPropertyComponent.cpp +++ b/Editor/foleys_StyleColourPropertyComponent.cpp @@ -133,6 +133,7 @@ void StyleColourPropertyComponent::refresh() if (value.isVoid()) getLookAndFeelColourFallback(); + label->getTextValue().referTo (label->getTextValue()); label->setText (value.toString(), juce::dontSendNotification); } } diff --git a/Editor/foleys_StyleGradientPropertyComponent.cpp b/Editor/foleys_StyleGradientPropertyComponent.cpp index 4ff5b29a..4ec4f826 100644 --- a/Editor/foleys_StyleGradientPropertyComponent.cpp +++ b/Editor/foleys_StyleGradientPropertyComponent.cpp @@ -97,6 +97,7 @@ void StyleGradientPropertyComponent::refresh() } else { + label->getTextValue().referTo (label->getTextValue()); label->setText (value.toString(), juce::dontSendNotification); } } diff --git a/Editor/foleys_StyleTextPropertyComponent.cpp b/Editor/foleys_StyleTextPropertyComponent.cpp index 31a81628..04b87f93 100644 --- a/Editor/foleys_StyleTextPropertyComponent.cpp +++ b/Editor/foleys_StyleTextPropertyComponent.cpp @@ -68,9 +68,14 @@ void StyleTextPropertyComponent::refresh() if (auto* label = dynamic_cast(editor.get())) { if (node == inheritedFrom) + { label->getTextValue().referTo (node.getPropertyAsValue (property, &builder.getUndoManager())); + } else + { + label->getTextValue().referTo (label->getTextValue()); label->setText (value.toString(), juce::dontSendNotification); + } } repaint(); diff --git a/VERSION.md b/VERSION.md index 3a802e7f..c8c1b10d 100644 --- a/VERSION.md +++ b/VERSION.md @@ -4,7 +4,9 @@ PluginGuiMagic - Versions history 1.3.5 ----- +- Fixed AlertWindow::IconType to a backward compatible version - Add ParameterAttachment for Label +- Added a fix when undo after a edit-drag operation 1.3.4 - 01.08.2021 ------------------ diff --git a/foleys_gui_magic.h b/foleys_gui_magic.h index 2c066860..4e5914ec 100644 --- a/foleys_gui_magic.h +++ b/foleys_gui_magic.h @@ -37,7 +37,7 @@ ID: foleys_gui_magic vendor: Foleys Finest Audio - version: 1.3.3 + version: 1.3.5 name: Foleys GUI magic description: This module allows to create GUI with a drag and drop editor dependencies: juce_core, juce_audio_basics, juce_audio_devices, juce_audio_formats,