mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Changed the way the JUCE_LIVE_CONSTANT singletons are generated, to make it more robust when used in a plugin environment
This commit is contained in:
parent
661533c85d
commit
fd74f1a39d
2 changed files with 15 additions and 19 deletions
|
|
@ -32,13 +32,10 @@ class AllComponentRepainter : private Timer,
|
|||
private DeletedAtShutdown
|
||||
{
|
||||
public:
|
||||
AllComponentRepainter() {}
|
||||
AllComponentRepainter() {}
|
||||
~AllComponentRepainter() { clearSingletonInstance(); }
|
||||
|
||||
static AllComponentRepainter& getInstance()
|
||||
{
|
||||
static AllComponentRepainter* instance = new AllComponentRepainter();
|
||||
return *instance;
|
||||
}
|
||||
juce_DeclareSingleton (AllComponentRepainter, false)
|
||||
|
||||
void trigger()
|
||||
{
|
||||
|
|
@ -57,8 +54,10 @@ private:
|
|||
if (Component* c = TopLevelWindow::getTopLevelWindow(i))
|
||||
repaintAndResizeAllComps (c, alreadyDone);
|
||||
|
||||
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
|
||||
if (Component* c = Desktop::getInstance().getComponent(i))
|
||||
Desktop& desktop = Desktop::getInstance();
|
||||
|
||||
for (int i = desktop.getNumComponents(); --i >= 0;)
|
||||
if (Component* c = desktop.getComponent(i))
|
||||
repaintAndResizeAllComps (c, alreadyDone);
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +84,9 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
juce_ImplementSingleton (AllComponentRepainter)
|
||||
juce_ImplementSingleton (ValueList)
|
||||
|
||||
//==============================================================================
|
||||
int64 parseInt (String s)
|
||||
{
|
||||
|
|
@ -189,7 +191,7 @@ void LivePropertyEditorBase::applyNewValue (const String& s)
|
|||
selectOriginalValue();
|
||||
|
||||
valueEditor.setText (s, dontSendNotification);
|
||||
AllComponentRepainter::getInstance().trigger();
|
||||
AllComponentRepainter::getInstance()->trigger();
|
||||
}
|
||||
|
||||
void LivePropertyEditorBase::selectOriginalValue()
|
||||
|
|
@ -347,14 +349,8 @@ public:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
ValueList::ValueList() {}
|
||||
ValueList::~ValueList() {}
|
||||
|
||||
ValueList& ValueList::getInstance()
|
||||
{
|
||||
static ValueList* i = new ValueList();
|
||||
return *i;
|
||||
}
|
||||
ValueList::ValueList() {}
|
||||
ValueList::~ValueList() { clearSingletonInstance(); }
|
||||
|
||||
void ValueList::addValue (LiveValueBase* v)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ namespace LiveConstantEditor
|
|||
ValueList();
|
||||
~ValueList();
|
||||
|
||||
static ValueList& getInstance();
|
||||
juce_DeclareSingleton (ValueList, false)
|
||||
|
||||
template <typename Type>
|
||||
LiveValue<Type>& getValue (const char* file, int line, const Type& initialValue)
|
||||
|
|
@ -233,7 +233,7 @@ namespace LiveConstantEditor
|
|||
template <typename Type>
|
||||
inline LiveValue<Type>& getValue (const char* file, int line, const Type& initialValue)
|
||||
{
|
||||
return ValueList::getInstance().getValue (file, line, initialValue);
|
||||
return ValueList::getInstance()->getValue (file, line, initialValue);
|
||||
}
|
||||
|
||||
inline LiveValue<String>& getValue (const char* file, int line, const char* initialValue)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue