Skip to content

Commit 3bd1926

Browse files
committed
representation of inheritance relations in relation to HAVE_DOT setting
Since the issue #7273 and pull request #8663 the setting `HAVE_DOT` was required when one wants to incorporate a "dot" type of graph, though this interferes with the Inheritance usage, especially when one wants to have a textual" list. There were a number of settings etc. involved: - `CLASS_GRAPH` - `CLASS_DIAGRAMS` - `HAVE_DOT` and the layout setting - `<inheritancegraph visible="$CLASS_GRAPH"/>` With this patch the following scheme has been implemented: ``` HAVE_DOT, CLASS_GRAPH, class diagram output ================================================================ NO, NO nothing shown (expected) NO, YES built-in diagram NO, TEXT text link NO, GRAPH built-in diagram (same as YES) YES, NO nothing shown (expected, HAVE_DOT can be used for other diagrams and \dot) YES, YES dot generated diagram YES, TEXT text link YES, GRAPH dot generated diagram (same as YES) ``` The setting `CLASS_DIAGRAMS` is not necessary and has been declared obsolete.
1 parent 51555f3 commit 3bd1926

File tree

6 files changed

+52
-44
lines changed

6 files changed

+52
-44
lines changed

addon/doxywizard/wizard.cpp

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#define STR_PDF_HYPERLINKS QString::fromLatin1("PDF_HYPERLINKS")
6565
#define STR_SEARCHENGINE QString::fromLatin1("SEARCHENGINE")
6666
#define STR_HAVE_DOT QString::fromLatin1("HAVE_DOT")
67-
#define STR_CLASS_DIAGRAMS QString::fromLatin1("CLASS_DIAGRAMS")
6867
#define STR_CLASS_GRAPH QString::fromLatin1("CLASS_GRAPH")
6968
#define STR_COLLABORATION_GRAPH QString::fromLatin1("COLLABORATION_GRAPH")
7069
#define STR_GRAPHICAL_HIERARCHY QString::fromLatin1("GRAPHICAL_HIERARCHY")
@@ -1132,19 +1131,21 @@ Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData)
11321131
QGridLayout *gbox = new QGridLayout( this );
11331132
gbox->addWidget(new QLabel(tr("Diagrams to generate")),0,0);
11341133

1134+
// CLASS_GRAPH = NO, HAVE_DOT = NO
11351135
QRadioButton *rb = new QRadioButton(tr("No diagrams"));
11361136
m_diagramModeGroup->addButton(rb, 0);
11371137
gbox->addWidget(rb,1,0);
1138-
// CLASS_DIAGRAMS = NO, HAVE_DOT = NO
11391138
rb->setChecked(true);
1139+
1140+
// CLASS_GRAPH = YES, HAVE_DOT = NO
11401141
rb = new QRadioButton(tr("Use built-in class diagram generator"));
11411142
m_diagramModeGroup->addButton(rb, 1);
1142-
// CLASS_DIAGRAMS = YES, HAVE_DOT = NO
11431143
gbox->addWidget(rb,2,0);
1144+
1145+
// CLASS_GRAPH = YES, HAVE_DOT = YES
11441146
rb = new QRadioButton(tr("Use dot tool from the GraphViz package"));
11451147
m_diagramModeGroup->addButton(rb, 2);
11461148
gbox->addWidget(rb,3,0);
1147-
// CLASS_DIAGRAMS = NO, HAVE_DOT = YES
11481149

11491150
m_dotGroup = new QGroupBox(tr("Dot graphs to generate"));
11501151
QVBoxLayout *vbox = new QVBoxLayout;
@@ -1202,24 +1203,24 @@ void Step4::diagramModeChanged(int id)
12021203
if (id==0) // no diagrams
12031204
{
12041205
updateBoolOption(m_modelData,STR_HAVE_DOT,false);
1205-
updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);
1206+
updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("NO"));
12061207
}
12071208
else if (id==1) // builtin diagrams
12081209
{
12091210
updateBoolOption(m_modelData,STR_HAVE_DOT,false);
1210-
updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,true);
1211+
updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("YES"));
12111212
}
12121213
else if (id==2) // dot diagrams
12131214
{
12141215
updateBoolOption(m_modelData,STR_HAVE_DOT,true);
1215-
updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);
1216+
updateStringOption(m_modelData,STR_CLASS_GRAPH, QString::fromLatin1("YES"));
12161217
}
12171218
m_dotGroup->setEnabled(id==2);
12181219
}
12191220

12201221
void Step4::setClassGraphEnabled(int state)
12211222
{
1222-
updateBoolOption(m_modelData,STR_CLASS_GRAPH,state==Qt::Checked);
1223+
updateStringOption(m_modelData,STR_CLASS_GRAPH,state==Qt::Checked ? QString::fromLatin1("YES") : QString::fromLatin1("NO"));
12231224
}
12241225

12251226
void Step4::setCollaborationGraphEnabled(int state)
@@ -1257,13 +1258,17 @@ void Step4::init()
12571258
int id = 0;
12581259
if (getBoolOption(m_modelData,STR_HAVE_DOT))
12591260
{
1260-
m_diagramModeGroup->button(2)->setChecked(true); // Dot
1261-
id = 2;
1262-
}
1263-
else if (getBoolOption(m_modelData,STR_CLASS_DIAGRAMS))
1264-
{
1265-
m_diagramModeGroup->button(1)->setChecked(true); // Builtin diagrams
1266-
id = 1;
1261+
QString class_graph = getStringOption(m_modelData,STR_CLASS_GRAPH).toLower();
1262+
if ((class_graph == QString::fromLatin1("yes")) || (class_graph == QString::fromLatin1("graph")))
1263+
{
1264+
m_diagramModeGroup->button(1)->setChecked(true); // Dot
1265+
id = 2;
1266+
}
1267+
else
1268+
{
1269+
m_diagramModeGroup->button(1)->setChecked(true); // Builtin diagrams
1270+
id = 1;
1271+
}
12671272
}
12681273
else
12691274
{

doc/customize.doc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ The class page has the following specific elements:
336336
this class.
337337
<dt>\c inheritancegraph
338338
<dd>Represents the inheritance relations for a class.
339-
Note that the CLASS_DIAGRAM option determines
339+
Note that the \ref cfg_class_graph "CLASS_GRAPH" option determines
340340
if the inheritance relation is a list of base and derived classes or
341341
a graph.
342342
<dt>\c collaborationgraph

src/classdef.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,12 +1605,15 @@ int ClassDefImpl::countInheritanceNodes() const
16051605

16061606
void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
16071607
{
1608+
static bool haveDot = Config_getBool(HAVE_DOT);
1609+
static QCString classGraph = Config_getEnum(CLASS_GRAPH).upper();
1610+
1611+
if (classGraph == "NO") return;
16081612
// count direct inheritance relations
16091613
const int count=countInheritanceNodes();
16101614

16111615
bool renderDiagram = FALSE;
1612-
if (Config_getBool(HAVE_DOT) &&
1613-
(Config_getBool(CLASS_DIAGRAMS) || Config_getBool(CLASS_GRAPH)))
1616+
if (haveDot && (classGraph == "YES" || classGraph =="GRAPH"))
16141617
// write class diagram using dot
16151618
{
16161619
DotClassGraph inheritanceGraph(this,Inheritance);
@@ -1630,7 +1633,7 @@ void ClassDefImpl::writeInheritanceGraph(OutputList &ol) const
16301633
renderDiagram = TRUE;
16311634
}
16321635
}
1633-
else if (Config_getBool(CLASS_DIAGRAMS) && count>0)
1636+
else if ((classGraph == "YES" || classGraph =="GRAPH") && count>0)
16341637
// write class diagram using built-in generator
16351638
{
16361639
ClassDiagram diagram(this); // create a diagram of this class.

src/config.xml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3489,17 +3489,6 @@ where `loc1` and `loc2` can be relative or absolute paths or URLs.
34893489
</option>
34903490
</group>
34913491
<group name='Dot' docs='Configuration options related to the dot tool'>
3492-
<option type='bool' id='CLASS_DIAGRAMS' defval='1'>
3493-
<docs>
3494-
<![CDATA[
3495-
If the \c CLASS_DIAGRAMS tag is set to \c YES, doxygen will
3496-
generate a class diagram (in HTML and \f$\mbox{\LaTeX}\f$) for classes with base or
3497-
super classes. Setting the tag to \c NO turns the diagrams off. Note that
3498-
this option also works with \ref cfg_have_dot "HAVE_DOT" disabled, but it is recommended to
3499-
install and use \c dot, since it yields more powerful graphs.
3500-
]]>
3501-
</docs>
3502-
</option>
35033492
<option type='string' id='DIA_PATH' format='dir' defval=''>
35043493
<docs>
35053494
<![CDATA[
@@ -3570,15 +3559,21 @@ to be found in the default search path.
35703559
]]>
35713560
</docs>
35723561
</option>
3573-
<option type='bool' id='CLASS_GRAPH' defval='1' depends='HAVE_DOT'>
3562+
<option type='enum' id='CLASS_GRAPH' defval='YES'>
35743563
<docs>
35753564
<![CDATA[
3576-
If the \c CLASS_GRAPH tag is set to \c YES then doxygen
3565+
If the \c CLASS_GRAPH tag is set to \c YES (or \c GRAPH) then doxygen
35773566
will generate a graph for each documented class showing the direct and
3578-
indirect inheritance relations. Setting this tag to \c YES will force
3579-
the \ref cfg_class_diagrams "CLASS_DIAGRAMS" tag to \c NO.
3567+
indirect inheritance relations. In case \ref cfg_have_dot "HAVE_DOT" is set as well
3568+
`dot` will be used to draw the graph, otherwise the built-in generator will be used.
3569+
If the \c CLASS_GRAPH tag is set to \c TEXT the direct and indirect inheritance relations
3570+
will be shown as texts / links.
35803571
]]>
35813572
</docs>
3573+
<value name="NO" />
3574+
<value name="YES" />
3575+
<value name="TEXT" />
3576+
<value name="GRAPH" />
35823577
</option>
35833578
<option type='bool' id='COLLABORATION_GRAPH' defval='1' depends='HAVE_DOT'>
35843579
<docs>
@@ -3914,5 +3909,6 @@ This setting is not only used for dot files but also for msc temporary files.
39143909
<option type='obsolete' id='DOCBOOK_PROGRAMLISTING'/>
39153910
<option type='obsolete' id='RTF_SOURCE_CODE'/>
39163911
<option type='obsolete' id='LATEX_SOURCE_CODE'/>
3912+
<option type='obsolete' id='CLASS_DIAGRAM'/>
39173913
</group>
39183914
</doxygenconfig>

src/context.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,15 +1995,15 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
19951995
TemplateVariant hasInheritanceDiagram() const
19961996
{
19971997
bool result=FALSE;
1998-
static bool haveDot = Config_getBool(HAVE_DOT);
1999-
static bool classDiagrams = Config_getBool(CLASS_DIAGRAMS);
2000-
static bool classGraph = Config_getBool(CLASS_GRAPH);
2001-
if (haveDot && (classDiagrams || classGraph))
1998+
static bool haveDot = Config_getBool(HAVE_DOT);
1999+
static QCString classGraph = Config_getEnum(CLASS_GRAPH).upper();
2000+
2001+
if (haveDot && (classGraph == "YES" || classGraph =="GRAPH"))
20022002
{
20032003
DotClassGraph *cg = getClassGraph();
20042004
result = !cg->isTrivial() && !cg->isTooBig();
20052005
}
2006-
else if (classDiagrams)
2006+
else if (classGraph == "YES" || classGraph =="GRAPH")
20072007
{
20082008
result = numInheritanceNodes()>0;
20092009
}
@@ -2012,10 +2012,10 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
20122012
TemplateVariant inheritanceDiagram() const
20132013
{
20142014
TextStream t;
2015-
static bool haveDot = Config_getBool(HAVE_DOT);
2016-
static bool classDiagrams = Config_getBool(CLASS_DIAGRAMS);
2017-
static bool classGraph = Config_getBool(CLASS_GRAPH);
2018-
if (haveDot && (classDiagrams || classGraph))
2015+
static bool haveDot = Config_getBool(HAVE_DOT);
2016+
static QCString classGraph = Config_getEnum(CLASS_GRAPH).upper();
2017+
2018+
if (haveDot && (classGraph == "YES" || classGraph =="GRAPH"))
20192019
{
20202020
DotClassGraph *cg = getClassGraph();
20212021
switch (g_globals.outputFormat)
@@ -2045,7 +2045,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
20452045
}
20462046
g_globals.dynSectionId++;
20472047
}
2048-
else if (classDiagrams)
2048+
else if (classGraph == "YES" || classGraph =="GRAPH")
20492049
{
20502050
ClassDiagram d(m_classDef);
20512051
switch (g_globals.outputFormat)

src/layout.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ static bool elemIsVisible(const XMLHandlers::Attributes &attrib,bool defVal=TRUE
8989
{
9090
return ConfigValues::instance().*(opt->value.b);
9191
}
92+
else if (opt && opt->type==ConfigValues::Info::String)
93+
{
94+
return ConfigValues::instance().*(opt->value.s) != "NO";
95+
}
9296
else if (!opt)
9397
{
9498
err("found unsupported value %s for visible attribute in layout file\n",

0 commit comments

Comments
 (0)