Skip to content

Commit

Permalink
Draw sibling directories in parent directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhebbeker committed Jan 1, 2021
1 parent 6e52be8 commit 95ba600
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/dotdirdeps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,37 @@ 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 *> usedDirsToBeDrawn;
for(const auto& usedDir : dd->usedDirs())
{
usedDirsToBeDrawn.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=\""
<< dd->parent()->shortName()
<< "\" 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(usedDirsToBeDrawn.begin(), usedDirsToBeDrawn.end(), [&](const DirDef *const usedDir)
{
if (usedDir->parent() == parent)
{
drawDirectory(t, usedDir, usedDir->isCluster() && !Config_getBool(DOT_TRANSPARENT), dirsInGraph);
return true;
}
return false;
}
);
usedDirsToBeDrawn.erase(newEnd, usedDirsToBeDrawn.end());
}
}
if (dd->isCluster())
{
Expand Down Expand Up @@ -100,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 : usedDirsToBeDrawn)
// 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)
{
Expand Down

0 comments on commit 95ba600

Please sign in to comment.