summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-01-02 19:01:09 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-01-02 19:01:09 (GMT)
commit98434b24bacacd03a11b5688db780e04ee720b5e (patch)
treefd4c631cb959d6ffc3458d062425fb295e9dcd2a
parentf3dfa40be43c0a835445e74dcf7b5fb03a9d843c (diff)
parent9433c13f61452b3f9b3978e8c630d7754d36108c (diff)
downloadDoxygen-98434b24bacacd03a11b5688db780e04ee720b5e.zip
Doxygen-98434b24bacacd03a11b5688db780e04ee720b5e.tar.gz
Doxygen-98434b24bacacd03a11b5688db780e04ee720b5e.tar.bz2
Merge branch 'dhebbeker-feature/move_dependees_into_parent_directory'
-rw-r--r--src/dotdirdeps.cpp82
1 files changed, 51 insertions, 31 deletions
diff --git a/src/dotdirdeps.cpp b/src/dotdirdeps.cpp
index a670d68..400ffaa 100644
--- a/src/dotdirdeps.cpp
+++ b/src/dotdirdeps.cpp
@@ -20,6 +20,30 @@
#include "doxygen.h"
#include "config.h"
+/**
+ * Puts DOT code for drawing directory to stream and adds it to the list.
+ * @param[in,out] outStream stream to which the DOT code is written to
+ * @param[in] directory will be mapped to a node in DOT code
+ * @param[in] fillBackground if the node shall be explicitly filled
+ * @param[in,out] directoriesInGraph lists the directories which have been written to the output stream
+ */
+static void drawDirectory(FTextStream &outStream, const DirDef *const directory, const bool fillBackground,
+ QDict<DirDef> &directoriesInGraph)
+{
+ outStream << " " << directory->getOutputFileBase() << " [shape=box "
+ "label=\"" << directory->shortName() << "\" ";
+ if (fillBackground)
+ {
+ outStream << "fillcolor=\"white\" style=\"filled\" ";
+ }
+ if (directory->isCluster())
+ {
+ outStream << "color=\"red\" ";
+ }
+ outStream << "URL=\"" << directory->getOutputFileBase() << Doxygen::htmlFileExtension << "\"];\n";
+ directoriesInGraph.insert(directory->getOutputFileBase(), directory);
+}
+
void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
{
int fontSize = Config_getInt(DOT_FONTSIZE);
@@ -36,7 +60,15 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
QDict<DirDef> dirsInGraph(257);
dirsInGraph.insert(dd->getOutputFileBase(),dd);
- if (dd->parent())
+
+ std::vector<const DirDef *> usedDirsNotDrawn;
+ for(const auto& usedDir : dd->usedDirs())
+ {
+ usedDirsNotDrawn.push_back(usedDir->dir());
+ }
+
+ const auto parent = dd->parent();
+ if (parent)
{
t << " subgraph cluster" << dd->parent()->getOutputFileBase() << " {\n";
t << " graph [ bgcolor=\"#ddddee\", pencolor=\"black\", label=\""
@@ -44,6 +76,21 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
<< "\" fontname=\"" << fontName << "\", fontsize=\"" << fontSize << "\", URL=\"";
t << dd->parent()->getOutputFileBase() << Doxygen::htmlFileExtension;
t << "\"]\n";
+
+ {
+ // draw all directories which have `dd->parent()` as parent and `dd` as dependent
+ const auto newEnd = std::remove_if(usedDirsNotDrawn.begin(), usedDirsNotDrawn.end(), [&](const DirDef *const usedDir)
+ {
+ if (dd!=usedDir && dd->parent()==usedDir->parent() && !usedDir->isParentOf(dd))
+ {
+ drawDirectory(t, usedDir, usedDir->isCluster() && !Config_getBool(DOT_TRANSPARENT), dirsInGraph);
+ return true;
+ }
+ return false;
+ }
+ );
+ usedDirsNotDrawn.erase(newEnd, usedDirsNotDrawn.end());
+ }
}
if (dd->isCluster())
{
@@ -57,21 +104,7 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
// add nodes for sub directories
for(const auto sdir : dd->subDirs())
{
- t << " " << sdir->getOutputFileBase() << " [shape=box label=\""
- << sdir->shortName() << "\"";
- if (sdir->isCluster())
- {
- t << " color=\"red\"";
- }
- else
- {
- t << " color=\"black\"";
- }
- t << " fillcolor=\"white\" style=\"filled\"";
- t << " URL=\"" << sdir->getOutputFileBase()
- << Doxygen::htmlFileExtension << "\"";
- t << "];\n";
- dirsInGraph.insert(sdir->getOutputFileBase(),sdir);
+ drawDirectory(t, sdir, true, dirsInGraph);
}
t << " }\n";
}
@@ -90,10 +123,9 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
// add nodes for other used directories
{
//printf("*** For dir %s\n",shortName().data());
- for (const auto &udir : dd->usedDirs())
+ for (const auto &usedDir : usedDirsNotDrawn)
// for each used dir (=directly used or a parent of a directly used dir)
{
- const DirDef *usedDir = udir->dir();
const DirDef *dir=dd;
while (dir)
{
@@ -108,19 +140,7 @@ void writeDotDirDepGraph(FTextStream &t,const DirDef *dd,bool linkRelations)
!usedDir->isParentOf(dd))
// include if both have the same parent (or no parent)
{
- t << " " << usedDir->getOutputFileBase() << " [shape=box label=\""
- << usedDir->shortName() << "\"";
- if (usedDir->isCluster())
- {
- if (!Config_getBool(DOT_TRANSPARENT))
- {
- t << " fillcolor=\"white\" style=\"filled\"";
- }
- t << " color=\"red\"";
- }
- t << " URL=\"" << usedDir->getOutputFileBase()
- << Doxygen::htmlFileExtension << "\"];\n";
- dirsInGraph.insert(usedDir->getOutputFileBase(),usedDir);
+ drawDirectory(t, usedDir, usedDir->isCluster() && !Config_getBool(DOT_TRANSPARENT), dirsInGraph);
break;
}
dir=dir->parent();