@@ -604,14 +604,6 @@ private: | |||||
replaceFileIfDifferent (generatedCodeFolder.getChildFile ("ReadMe.txt"), out); | replaceFileIfDifferent (generatedCodeFolder.getChildFile ("ReadMe.txt"), out); | ||||
} | } | ||||
static void sortGroupRecursively (Project::Item group) | |||||
{ | |||||
group.sortAlphabetically (true); | |||||
for (int i = group.getNumChildren(); --i >= 0;) | |||||
sortGroupRecursively (group.getChild(i)); | |||||
} | |||||
void addError (const String& message) | void addError (const String& message) | ||||
{ | { | ||||
const ScopedLock sl (errorLock); | const ScopedLock sl (errorLock); | ||||
@@ -645,7 +637,7 @@ private: | |||||
if (project.getProjectType().isAudioPlugin()) | if (project.getProjectType().isAudioPlugin()) | ||||
writePluginCharacteristicsFile(); | writePluginCharacteristicsFile(); | ||||
sortGroupRecursively (generatedFilesGroup); | |||||
generatedFilesGroup.sortAlphabetically (true, true); | |||||
exporter->getAllGroups().add (generatedFilesGroup); | exporter->getAllGroups().add (generatedFilesGroup); | ||||
threadPool.addJob (new ExporterJob (*this, exporter.exporter.release(), modules), true); | threadPool.addJob (new ExporterJob (*this, exporter.exporter.release(), modules), true); | ||||
@@ -496,29 +496,19 @@ static void addFileWithGroups (Project::Item& group, const RelativePath& file, c | |||||
} | } | ||||
} | } | ||||
static void findWildcardMatches (const File& folder, Array<File>& result) | |||||
void LibraryModule::findBrowseableFiles (const File& folder, Array<File>& filesFound) const | |||||
{ | { | ||||
Array<File> tempList; | Array<File> tempList; | ||||
FileSorter sorter; | FileSorter sorter; | ||||
DirectoryIterator iter (folder, false, "*"); | |||||
DirectoryIterator iter (folder, true, "*", File::findFiles); | |||||
bool isHiddenFile; | bool isHiddenFile; | ||||
while (iter.next (nullptr, &isHiddenFile, nullptr, nullptr, nullptr, nullptr)) | while (iter.next (nullptr, &isHiddenFile, nullptr, nullptr, nullptr, nullptr)) | ||||
if (! isHiddenFile) | |||||
if (! isHiddenFile && iter.getFile().hasFileExtension (browseableFileExtensions)) | |||||
tempList.addSorted (sorter, iter.getFile()); | tempList.addSorted (sorter, iter.getFile()); | ||||
result.addArray (tempList); | |||||
} | |||||
void LibraryModule::findBrowseableFiles (const File& localModuleFolder, Array<File>& filesFound) const | |||||
{ | |||||
DirectoryIterator iter (localModuleFolder, true, "*", File::findDirectories); | |||||
bool isHiddenFile; | |||||
while (iter.next (nullptr, &isHiddenFile, nullptr, nullptr, nullptr, nullptr)) | |||||
if (! isHiddenFile) | |||||
findWildcardMatches (iter.getFile(), filesFound); | |||||
filesFound.addArray (tempList); | |||||
} | } | ||||
void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<File>& compiled, const File& localModuleFolder) const | void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<File>& compiled, const File& localModuleFolder) const | ||||
@@ -542,6 +532,7 @@ void LibraryModule::addBrowseableCode (ProjectExporter& exporter, const Array<Fi | |||||
pathWithinModule); | pathWithinModule); | ||||
} | } | ||||
sourceGroup.sortAlphabetically (true, true); | |||||
sourceGroup.addFileAtIndex (moduleInfo.getHeader(), -1, false); | sourceGroup.addFileAtIndex (moduleInfo.getHeader(), -1, false); | ||||
exporter.getModulesGroup().state.addChild (sourceGroup.state.createCopy(), -1, nullptr); | exporter.getModulesGroup().state.addChild (sourceGroup.state.createCopy(), -1, nullptr); | ||||
@@ -52,7 +52,7 @@ struct ModuleDescription | |||||
String getPreprocessorDefs() const { return moduleInfo [Ids::defines].toString(); } | String getPreprocessorDefs() const { return moduleInfo [Ids::defines].toString(); } | ||||
String getExtraSearchPaths() const { return moduleInfo [Ids::searchpaths].toString(); } | String getExtraSearchPaths() const { return moduleInfo [Ids::searchpaths].toString(); } | ||||
File getFolder() const { jassert (moduleFolder != File::nonexistent); return moduleFolder; } | |||||
File getFolder() const { jassert (moduleFolder != File()); return moduleFolder; } | |||||
File getHeader() const; | File getHeader() const; | ||||
bool isPluginClient() const { return getID() == "juce_audio_plugin_client"; } | bool isPluginClient() const { return getID() == "juce_audio_plugin_client"; } | ||||
@@ -928,9 +928,13 @@ static bool isGroupSorted (const ValueTree& state, bool keepGroupsAtStart) | |||||
return stateCopy.isEquivalentTo (state); | return stateCopy.isEquivalentTo (state); | ||||
} | } | ||||
void Project::Item::sortAlphabetically (bool keepGroupsAtStart) | |||||
void Project::Item::sortAlphabetically (bool keepGroupsAtStart, bool recursive) | |||||
{ | { | ||||
sortGroup (state, keepGroupsAtStart, getUndoManager()); | sortGroup (state, keepGroupsAtStart, getUndoManager()); | ||||
if (recursive) | |||||
for (int i = getNumChildren(); --i >= 0;) | |||||
getChild(i).sortAlphabetically (keepGroupsAtStart, true); | |||||
} | } | ||||
Project::Item Project::Item::getOrCreateSubGroup (const String& name) | Project::Item Project::Item::getOrCreateSubGroup (const String& name) | ||||
@@ -995,7 +999,7 @@ bool Project::Item::addFileRetainingSortOrder (const File& file, bool shouldComp | |||||
return false; | return false; | ||||
if (wasSortedGroupsNotFirst || wasSortedGroupsFirst) | if (wasSortedGroupsNotFirst || wasSortedGroupsFirst) | ||||
sortAlphabetically (wasSortedGroupsFirst); | |||||
sortAlphabetically (wasSortedGroupsFirst, false); | |||||
return true; | return true; | ||||
} | } | ||||
@@ -226,7 +226,7 @@ public: | |||||
void addFileUnchecked (const File& file, int insertIndex, bool shouldCompile); | void addFileUnchecked (const File& file, int insertIndex, bool shouldCompile); | ||||
bool addRelativeFile (const RelativePath& file, int insertIndex, bool shouldCompile); | bool addRelativeFile (const RelativePath& file, int insertIndex, bool shouldCompile); | ||||
void removeItemFromProject(); | void removeItemFromProject(); | ||||
void sortAlphabetically (bool keepGroupsAtStart); | |||||
void sortAlphabetically (bool keepGroupsAtStart, bool recursive); | |||||
Item findItemForFile (const File& file) const; | Item findItemForFile (const File& file) const; | ||||
bool containsChildForFile (const RelativePath& file) const; | bool containsChildForFile (const RelativePath& file) const; | ||||
@@ -146,8 +146,8 @@ public: | |||||
case 2: openOrCloseAllSubGroups (*this, true); break; | case 2: openOrCloseAllSubGroups (*this, true); break; | ||||
case 3: setFilesToCompile (item, true); break; | case 3: setFilesToCompile (item, true); break; | ||||
case 4: setFilesToCompile (item, false); break; | case 4: setFilesToCompile (item, false); break; | ||||
case 5: item.sortAlphabetically (false); break; | |||||
case 6: item.sortAlphabetically (true); break; | |||||
case 5: item.sortAlphabetically (false, false); break; | |||||
case 6: item.sortAlphabetically (true, false); break; | |||||
case 7: triggerAsyncRename (item); break; | case 7: triggerAsyncRename (item); break; | ||||
case 8: deleteAllSelectedItems(); break; | case 8: deleteAllSelectedItems(); break; | ||||
default: processCreateFileMenuItem (resultCode); break; | default: processCreateFileMenuItem (resultCode); break; | ||||
@@ -61,6 +61,7 @@ const char* const cppFileExtensions = "cpp;cc;cxx"; | |||||
const char* const objCFileExtensions = "mm;m"; | const char* const objCFileExtensions = "mm;m"; | ||||
const char* const asmFileExtensions = "s;S;asm"; | const char* const asmFileExtensions = "s;S;asm"; | ||||
const char* const sourceOrHeaderFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;S;asm;h;hpp;hxx;hh;inl"; | const char* const sourceOrHeaderFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;S;asm;h;hpp;hxx;hh;inl"; | ||||
const char* const browseableFileExtensions = "cpp;mm;m;c;cc;cxx;swift;s;S;asm;h;hpp;hxx;hh;inl;txt;md;rtf"; | |||||
const char* const fileTypesToCompileByDefault = "cpp;mm;c;m;cc;cxx;swift;s;S;asm;r"; | const char* const fileTypesToCompileByDefault = "cpp;mm;c;m;cc;cxx;swift;s;S;asm;r"; | ||||
//============================================================================== | //============================================================================== | ||||