WYSWYG editor for JUCE GUIs including Visualisers
Loading...
Searching...
No Matches
MagicGUIState Class Reference

The MagicGuiState is the docking station for the MagicGUIBuilder. More...

#include <foleys_MagicGUIState.h>

+ Inheritance diagram for MagicGUIState:

Public Member Functions

 MagicGUIState ()
 
virtual ~MagicGUIState ()
 
juce::ValueTree getPropertyRoot ()
 Returns the root node for exposed properties for the GUI.
 
juce::ValueTree getPropertyRoot () const
 
void setGuiValueTree (const juce::ValueTree &dom)
 Set the GUI DOM to create the GUI components from.
 
void setGuiValueTree (const char *data, int dataSize)
 
void setGuiValueTree (const juce::File &file)
 
juce::ValueTree & getGuiTree ()
 Grants access to the gui tree.
 
juce::ValueTree & getValueTree ()
 
void setApplicationSettingsFile (juce::File file)
 Set a file to save common settings for all instances.
 
juce::ValueTree & getSettings ()
 This is a settings ValueTree that is stored globally for all plugin instances.
 
virtual juce::StringArray getParameterNames () const
 Returns the IDs of AudioProcessorParameters for selection.
 
virtual juce::RangedAudioParameter * getParameter (const juce::String &paramID)
 
virtual std::unique_ptr< juce::SliderParameterAttachment > createAttachment (const juce::String &paramID, juce::Slider &)
 
virtual std::unique_ptr< juce::ComboBoxParameterAttachment > createAttachment (const juce::String &paramID, juce::ComboBox &)
 
virtual std::unique_ptr< juce::ButtonParameterAttachment > createAttachment (const juce::String &paramID, juce::Button &)
 
virtual juce::PopupMenu createParameterMenu () const
 Return a hierarchical menu of the AudioParameters.
 
void addTrigger (const juce::Identifier &triggerID, std::function< void()> function)
 You can store a lambda that can be called from e.g.
 
std::function< void()> getTrigger (const juce::Identifier &triggerID)
 Returns a lambda to be connected to your components.
 
juce::Value getPropertyAsValue (const juce::String &pathToProperty)
 Returns a property as value inside the ValueTreeState.
 
void populatePropertiesMenu (juce::ComboBox &comboBox) const
 Populates a menu with properties found in the persistent ValueTree.
 
juce::PopupMenu createPropertiesMenu (juce::ComboBox &combo) const
 
juce::PopupMenu createTriggerMenu () const
 
juce::PopupMenu createAssetFilesMenu () const
 
template<typename T , typename... Ts>
T * createAndAddObject (const juce::Identifier &objectID, Ts &&... t)
 Create and add an object.
 
template<typename ObjectType >
juce::StringArray getObjectIDsByType () const
 Returns all identifiers of objects, that can be casted to the given type.
 
template<typename ObjectType >
ObjectType * getObjectWithType (juce::Identifier objectID)
 Return an object by objectID.
 
void clearAllObjects ()
 This removes all objects managed by the MagicGuiState.
 
void prepareToPlay (double sampleRate, int samplesPerBlockExpected)
 Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup.
 
void addBackgroundProcessing (MagicPlotSource *source)
 Registers background processing.
 
juce::MidiKeyboardState & getKeyboardState ()
 
virtual juce::AudioProcessor * getProcessor ()
 Return the referenced AudioProcessor, if this state can provide one.
 
void setResourcesFolder (const juce::String &name)
 
juce::File getResourcesFolder () const
 

Detailed Description

The MagicGuiState is the docking station for the MagicGUIBuilder.

You can register properties or objects there, that your GuiItems will connect to. It is also the place, where the data for the visualisers is sent to, which are MagicPlotSources and MagicLevelSources.

Constructor & Destructor Documentation

◆ MagicGUIState()

◆ ~MagicGUIState()

~MagicGUIState ( )
virtual

Member Function Documentation

◆ getPropertyRoot() [1/2]

juce::ValueTree getPropertyRoot ( )

Returns the root node for exposed properties for the GUI.

Referenced by MagicGUIState::getPropertyAsValue().

◆ getPropertyRoot() [2/2]

juce::ValueTree getPropertyRoot ( ) const

◆ setGuiValueTree() [1/3]

void setGuiValueTree ( const juce::ValueTree & dom)

Set the GUI DOM to create the GUI components from.

Referenced by MagicProcessor::createEditor(), ToolBox::loadGUI(), MagicGUIState::setGuiValueTree(), and MagicGUIState::setGuiValueTree().

◆ setGuiValueTree() [2/3]

void setGuiValueTree ( const char * data,
int dataSize )

◆ setGuiValueTree() [3/3]

void setGuiValueTree ( const juce::File & file)

◆ getGuiTree()

juce::ValueTree & getGuiTree ( )

Grants access to the gui tree.

This is returned as reference so you are able to connect listeners to it.

Referenced by MagicProcessor::createEditor(), MagicGUIBuilder::getConfigTree(), and MagicPluginEditor::MagicPluginEditor().

◆ getValueTree()

◆ setApplicationSettingsFile()

void setApplicationSettingsFile ( juce::File file)

Set a file to save common settings for all instances.

◆ getSettings()

juce::ValueTree & getSettings ( )

This is a settings ValueTree that is stored globally for all plugin instances.

◆ getParameterNames()

juce::StringArray getParameterNames ( ) const
virtual

Returns the IDs of AudioProcessorParameters for selection.

Reimplemented in MagicProcessorState.

◆ getParameter()

virtual juce::RangedAudioParameter * getParameter ( const juce::String & paramID)
virtual

◆ createAttachment() [1/3]

virtual std::unique_ptr< juce::SliderParameterAttachment > createAttachment ( const juce::String & paramID,
juce::Slider &  )
virtual

◆ createAttachment() [2/3]

virtual std::unique_ptr< juce::ComboBoxParameterAttachment > createAttachment ( const juce::String & paramID,
juce::ComboBox &  )
virtual

Reimplemented in MagicProcessorState.

◆ createAttachment() [3/3]

virtual std::unique_ptr< juce::ButtonParameterAttachment > createAttachment ( const juce::String & paramID,
juce::Button &  )
virtual

Reimplemented in MagicProcessorState.

◆ createParameterMenu()

virtual juce::PopupMenu createParameterMenu ( ) const
virtual

Return a hierarchical menu of the AudioParameters.

Implemented in MagicPluginState

Reimplemented in MagicProcessorState.

Referenced by MagicGUIBuilder::createParameterMenuLambda().

◆ addTrigger()

void addTrigger ( const juce::Identifier & triggerID,
std::function< void()> function )

You can store a lambda that can be called from e.g.

a TextButton.

◆ getTrigger()

std::function< void()> getTrigger ( const juce::Identifier & triggerID)

Returns a lambda to be connected to your components.

Referenced by TextButtonItem::update().

◆ getPropertyAsValue()

juce::Value getPropertyAsValue ( const juce::String & pathToProperty)

Returns a property as value inside the ValueTreeState.

The nodes are a colon separated list, the last component is the property name

References MagicGUIState::getPropertyRoot().

Referenced by Stylesheet::updateStyleClasses().

◆ populatePropertiesMenu()

void populatePropertiesMenu ( juce::ComboBox & comboBox) const

Populates a menu with properties found in the persistent ValueTree.

Referenced by MagicGUIBuilder::createPropertiesMenuLambda().

◆ createPropertiesMenu()

juce::PopupMenu createPropertiesMenu ( juce::ComboBox & combo) const

◆ createTriggerMenu()

juce::PopupMenu createTriggerMenu ( ) const

◆ createAssetFilesMenu()

juce::PopupMenu createAssetFilesMenu ( ) const

◆ createAndAddObject()

template<typename T , typename... Ts>
T * createAndAddObject ( const juce::Identifier & objectID,
Ts &&... t )

Create and add an object.

The type to create needs to be added as template parameter, the arguments will be forwarded to the constructor.

References MagicGUIState::addBackgroundProcessing().

◆ getObjectIDsByType()

template<typename ObjectType >
juce::StringArray getObjectIDsByType ( ) const

Returns all identifiers of objects, that can be casted to the given type.

Referenced by MagicGUIBuilder::createObjectsMenuLambda().

◆ getObjectWithType()

template<typename ObjectType >
ObjectType * getObjectWithType ( juce::Identifier objectID)

Return an object by objectID.

The returned type needs to be specified as template parameter. If there is no object with that objectID, or the object is not of the selected type, this will return a nullptr.

Parameters
objectIDis the ID to identify the object.

◆ clearAllObjects()

void clearAllObjects ( )

This removes all objects managed by the MagicGuiState.

Make sure all objects that depend on those objects are deleted first (especially GUI)

◆ prepareToPlay()

void prepareToPlay ( double sampleRate,
int samplesPerBlockExpected )

Call this method in your prepareToPlay implementation, to allow th visualisers to be properly setup.

◆ addBackgroundProcessing()

void addBackgroundProcessing ( MagicPlotSource * source)

Registers background processing.

References MagicPlotSource::getBackgroundJob().

Referenced by MagicGUIState::createAndAddObject().

◆ getKeyboardState()

juce::MidiKeyboardState & getKeyboardState ( )

◆ getProcessor()

virtual juce::AudioProcessor * getProcessor ( )
virtual

Return the referenced AudioProcessor, if this state can provide one.

Reimplemented in MagicProcessorState.

◆ setResourcesFolder()

void setResourcesFolder ( const juce::String & name)

◆ getResourcesFolder()

juce::File getResourcesFolder ( ) const

The documentation for this class was generated from the following files: