Skip to content

Commit

Permalink
Merge pull request #65 from ffAudio/develop
Browse files Browse the repository at this point in the history
Release 1.3.5
  • Loading branch information
ffAudio authored Sep 28, 2021
2 parents b5cf9bc + 7c28c5d commit f7458e5
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Editor/foleys_PropertiesEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,15 @@ juce::ValueTree& PropertiesEditor::getNodeToEdit()
void PropertiesEditor::createNewClass()
{
static juce::String editorID { "styleClass" };
#if JUCE_VERSION > 0x60008
auto iconType = juce::MessageBoxIconType::QuestionIcon;
#else
auto iconType = juce::AlertWindow::QuestionIcon;
#endif

classNameInput = std::make_unique<juce::AlertWindow> (TRANS ("New style class"),
TRANS ("Enter a name:"),
juce::MessageBoxIconType::QuestionIcon,
iconType,
this);
classNameInput->addTextEditor (editorID, "class");
classNameInput->addButton (TRANS ("Cancel"), 0);
Expand Down
5 changes: 5 additions & 0 deletions Editor/foleys_StyleBoolPropertyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ void StyleBoolPropertyComponent::refresh()
if (auto* toggle = dynamic_cast<juce::ToggleButton*>(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();
Expand Down
5 changes: 5 additions & 0 deletions Editor/foleys_StyleChoicePropertyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,14 @@ void StyleChoicePropertyComponent::refresh()
if (auto* combo = dynamic_cast<juce::ComboBox*>(editor.get()))
{
if (node == inheritedFrom)
{
proxy.referTo (node.getPropertyAsValue (property, &builder.getUndoManager()));
}
else
{
proxy.referTo (proxy);
combo->setText (value.toString(), juce::dontSendNotification);
}
}

repaint();
Expand Down
1 change: 1 addition & 0 deletions Editor/foleys_StyleColourPropertyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ void StyleColourPropertyComponent::refresh()
if (value.isVoid())
getLookAndFeelColourFallback();

label->getTextValue().referTo (label->getTextValue());
label->setText (value.toString(), juce::dontSendNotification);
}
}
Expand Down
1 change: 1 addition & 0 deletions Editor/foleys_StyleGradientPropertyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void StyleGradientPropertyComponent::refresh()
}
else
{
label->getTextValue().referTo (label->getTextValue());
label->setText (value.toString(), juce::dontSendNotification);
}
}
Expand Down
5 changes: 5 additions & 0 deletions Editor/foleys_StyleTextPropertyComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,14 @@ void StyleTextPropertyComponent::refresh()
if (auto* label = dynamic_cast<juce::Label*>(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();
Expand Down
3 changes: 3 additions & 0 deletions Editor/foleys_ToolBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
28 changes: 27 additions & 1 deletion General/foleys_MagicJUCEFactories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<juce::ParameterAttachment>(
*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));
Expand All @@ -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;
}
Expand All @@ -435,7 +460,8 @@ class LabelItem : public GuiItem
}

private:
juce::Label label;
juce::Label label;
std::unique_ptr<juce::ParameterAttachment> attachment;

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LabelItem)
};
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------------
Expand Down
9 changes: 8 additions & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
PluginGuiMagic - Versions history
================================

1.3.4
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
------------------

- Removed modal loops (needed for JUCE 6.0.9)
- Added PopupMenu background and colours in ComboBox for all shipped LookAndFeels
- Made Tooltip colours configurable
Expand Down
2 changes: 1 addition & 1 deletion foleys_gui_magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f7458e5

Please sign in to comment.