mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Projucer: Synchronise access to EnabledModuleList state
This commit is contained in:
parent
94d853b00d
commit
3de4fab219
2 changed files with 21 additions and 4 deletions
|
|
@ -411,6 +411,8 @@ void EnabledModulesList::sortAlphabetically()
|
|||
};
|
||||
|
||||
ModuleTreeSorter sorter;
|
||||
|
||||
const ScopedLock sl (stateLock);
|
||||
state.sort (sorter, getUndoManager(), false);
|
||||
}
|
||||
|
||||
|
|
@ -439,6 +441,7 @@ ModuleDescription EnabledModulesList::getModuleInfo (const String& moduleID) con
|
|||
|
||||
bool EnabledModulesList::isModuleEnabled (const String& moduleID) const
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
return state.getChildWithProperty (Ids::ID, moduleID).isValid();
|
||||
}
|
||||
|
||||
|
|
@ -502,11 +505,13 @@ bool EnabledModulesList::doesModuleHaveHigherCppStandardThanProject (const Strin
|
|||
|
||||
bool EnabledModulesList::shouldUseGlobalPath (const String& moduleID) const
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
return (bool) shouldUseGlobalPathValue (moduleID).getValue();
|
||||
}
|
||||
|
||||
Value EnabledModulesList::shouldUseGlobalPathValue (const String& moduleID) const
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
return state.getChildWithProperty (Ids::ID, moduleID)
|
||||
.getPropertyAsValue (Ids::useGlobalPath, getUndoManager());
|
||||
}
|
||||
|
|
@ -518,6 +523,7 @@ bool EnabledModulesList::shouldShowAllModuleFilesInProject (const String& module
|
|||
|
||||
Value EnabledModulesList::shouldShowAllModuleFilesInProjectValue (const String& moduleID) const
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
return state.getChildWithProperty (Ids::ID, moduleID)
|
||||
.getPropertyAsValue (Ids::showAllCode, getUndoManager());
|
||||
}
|
||||
|
|
@ -529,6 +535,7 @@ bool EnabledModulesList::shouldCopyModuleFilesLocally (const String& moduleID) c
|
|||
|
||||
Value EnabledModulesList::shouldCopyModuleFilesLocallyValue (const String& moduleID) const
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
return state.getChildWithProperty (Ids::ID, moduleID)
|
||||
.getPropertyAsValue (Ids::useLocalCopy, getUndoManager());
|
||||
}
|
||||
|
|
@ -616,7 +623,11 @@ void EnabledModulesList::addModule (const File& moduleFolder, bool copyLocally,
|
|||
ValueTree module (Ids::MODULE);
|
||||
module.setProperty (Ids::ID, moduleID, getUndoManager());
|
||||
|
||||
state.appendChild (module, getUndoManager());
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
state.appendChild (module, getUndoManager());
|
||||
}
|
||||
|
||||
sortAlphabetically();
|
||||
|
||||
shouldShowAllModuleFilesInProjectValue (moduleID) = true;
|
||||
|
|
@ -686,9 +697,13 @@ void EnabledModulesList::addModuleOfferingToCopy (const File& f, bool isFromUser
|
|||
|
||||
void EnabledModulesList::removeModule (String moduleID) // must be pass-by-value, and not a const ref!
|
||||
{
|
||||
for (auto i = state.getNumChildren(); --i >= 0;)
|
||||
if (state.getChild(i) [Ids::ID] == moduleID)
|
||||
state.removeChild (i, getUndoManager());
|
||||
{
|
||||
const ScopedLock sl (stateLock);
|
||||
|
||||
for (auto i = state.getNumChildren(); --i >= 0;)
|
||||
if (state.getChild(i) [Ids::ID] == moduleID)
|
||||
state.removeChild (i, getUndoManager());
|
||||
}
|
||||
|
||||
for (Project::ExporterIterator exporter (project); exporter.next();)
|
||||
exporter->removePathForModule (moduleID);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue