Skip to content

Commit

Permalink
Unified display of enum values across output formats and languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Aug 31, 2016
1 parent 59a8f09 commit 9c915b8
Show file tree
Hide file tree
Showing 13 changed files with 293 additions and 118 deletions.
48 changes: 45 additions & 3 deletions src/htmlgen.cpp
Expand Up @@ -1863,6 +1863,46 @@ void HtmlGenerator::writeNonBreakableSpace(int n)
}
}

void HtmlGenerator::startDescTable(const char *title)
{
t << "<table class=\"fieldtable\">" << endl
<< "<tr><th colspan=\"2\">" << title << "</th></tr>";
}
void HtmlGenerator::endDescTable()
{
t << "</table>" << endl;
}

void HtmlGenerator::startDescTableRow()
{
t << "<tr>";
}

void HtmlGenerator::endDescTableRow()
{
t << "</tr>" << endl;
}

void HtmlGenerator::startDescTableTitle()
{
t << "<td class=\"fieldname\">";
}

void HtmlGenerator::endDescTableTitle()
{
t << "&#160;</td>";
}

void HtmlGenerator::startDescTableData()
{
t << "<td class=\"fielddoc\">";
}

void HtmlGenerator::endDescTableData()
{
t << "</td>";
}

void HtmlGenerator::startSimpleSect(SectionTypes,
const char *filename,const char *anchor,
const char *title)
Expand Down Expand Up @@ -2488,14 +2528,16 @@ void HtmlGenerator::endInlineHeader()
t << "</h3></td></tr>" << endl;
}

void HtmlGenerator::startMemberDocSimple()
void HtmlGenerator::startMemberDocSimple(bool isEnum)
{
DBG_HTML(t << "<!-- startMemberDocSimple -->" << endl;)
t << "<table class=\"fieldtable\">" << endl;
t << "<tr><th colspan=\"3\">" << theTranslator->trCompoundMembers() << "</th></tr>" << endl;
t << "<tr><th colspan=\"" << (isEnum?"2":"3") << "\">";
t << (isEnum? theTranslator->trEnumerationValues() :
theTranslator->trCompoundMembers()) << "</th></tr>" << endl;
}

void HtmlGenerator::endMemberDocSimple()
void HtmlGenerator::endMemberDocSimple(bool)
{
DBG_HTML(t << "<!-- endMemberDocSimple -->" << endl;)
t << "</table>" << endl;
Expand Down
33 changes: 12 additions & 21 deletions src/htmlgen.h
Expand Up @@ -272,25 +272,16 @@ class HtmlGenerator : public OutputGenerator
void startContents();
void endContents();
void writeNonBreakableSpace(int);

void startDescTable(const char *title)
//{ t << "<table border=\"0\" cellspacing=\"2\" cellpadding=\"0\">" << endl; }
{ t << "<table class=\"fieldtable\">" << endl
<< "<tr><th colspan=\"2\">" << title << "</th></tr>";
}
void endDescTable()
{ t << "</table>" << endl; }
void startDescTableTitle()
//{ t << "<tr><td valign=\"top\"><em>"; }
{ t << "<tr><td class=\"fieldname\">"; }
void endDescTableTitle()
{ t << "&#160;</td>"; }
void startDescTableData()
//{ t << "<td>" << endl; }
{ t << "<td class=\"fielddoc\">" << endl; }
void endDescTableData()
{ t << "</td></tr>" << endl; }


void startDescTable(const char *title);
void endDescTable();
void startDescTableRow();
void endDescTableRow();
void startDescTableTitle();
void endDescTableTitle();
void startDescTableData();
void endDescTableData();

void startDotGraph();
void endDotGraph(const DotClassGraph &g);
void startInclDepGraph();
Expand Down Expand Up @@ -330,8 +321,8 @@ class HtmlGenerator : public OutputGenerator
void endConstraintDocs();
void endConstraintList();

void startMemberDocSimple();
void endMemberDocSimple();
void startMemberDocSimple(bool);
void endMemberDocSimple(bool);
void startInlineMemberType();
void endInlineMemberType();
void startInlineMemberName();
Expand Down
86 changes: 80 additions & 6 deletions src/latexgen.cpp
Expand Up @@ -1579,7 +1579,7 @@ void LatexGenerator::startMemberDoc(const char *clname,
t << "\\hspace{0.1cm}{\\footnotesize\\ttfamily [" << memCount << "/" << memTotal << "]}";
}
t << "}";
t << "\n{\\ttfamily ";
t << "\n{\\footnotesize\\ttfamily ";
//disableLinks=TRUE;
}

Expand Down Expand Up @@ -1826,6 +1826,65 @@ void LatexGenerator::writeNonBreakableSpace(int)
}
}

// ----------------------------------------------
// nesting of functions below:
// startDescTable()
// - startDescTableRow()
// - startDescTableTitle()
// - endDescTabelTitle()
// - startDescTableData()
// - endDescTableData()
// - endDescTableRow()
// - startDescTableRow()
// - ...
// - endDescTableRow()
// endDescTable()

void LatexGenerator::startDescTable(const char *title)
{
t << "\\begin{DoxyEnumFields}{" << title << "}" << endl;
}

void LatexGenerator::endDescTable()
{
t << "\\end{DoxyEnumFields}" << endl;
}

void LatexGenerator::startDescTableRow()
{
// this is needed to prevent the \hypertarget, \label, and \index commands from messing up
// the row height (based on http://tex.stackexchange.com/a/186102)
t << "\\raisebox{\\heightof{T}}[0pt][0pt]{";
}

void LatexGenerator::endDescTableRow()
{
}

void LatexGenerator::startDescTableTitle()
{
t << "}";
}

void LatexGenerator::endDescTableTitle()
{
}

void LatexGenerator::startDescTableData()
{
t << "&";
}

void LatexGenerator::endDescTableData()
{
t << "\\\\\n\\hline\n" << endl;
}

void LatexGenerator::lastIndexPage()
{
}


void LatexGenerator::startMemberList()
{
if (!insideTabbing)
Expand Down Expand Up @@ -2128,16 +2187,31 @@ void LatexGenerator::lineBreak(const char *)
}
}

void LatexGenerator::startMemberDocSimple()
void LatexGenerator::startMemberDocSimple(bool isEnum)
{
t << "\\begin{DoxyFields}{";
docify(theTranslator->trCompoundMembers());
if (isEnum)
{
t << "\\begin{DoxyEnumFields}{";
docify(theTranslator->trEnumerationValues());
}
else
{
t << "\\begin{DoxyFields}{";
docify(theTranslator->trCompoundMembers());
}
t << "}" << endl;
}

void LatexGenerator::endMemberDocSimple()
void LatexGenerator::endMemberDocSimple(bool isEnum)
{
t << "\\end{DoxyFields}" << endl;
if (isEnum)
{
t << "\\end{DoxyEnumFields}" << endl;
}
else
{
t << "\\end{DoxyFields}" << endl;
}
}

void LatexGenerator::startInlineMemberType()
Expand Down
31 changes: 12 additions & 19 deletions src/latexgen.h
Expand Up @@ -259,23 +259,16 @@ class LatexGenerator : public OutputGenerator
void startContents() {}
void endContents() {}
void writeNonBreakableSpace(int);

void startDescTable(const char *title)
{ startSimpleSect(EnumValues,0,0,title);
startDescForItem();
t << "\\begin{description}" << endl; }
void endDescTable()
{ t << "\\end{description}" << endl;
endDescForItem();
endSimpleSect();
}
void startDescTableTitle()
{ t << "\\item[{\\em " << endl; }
void endDescTableTitle()
{ t << "}]"; }
void startDescTableData() {}
void endDescTableData() {}
void lastIndexPage() {}

void startDescTable(const char *title);
void endDescTable();
void startDescTableRow();
void endDescTableRow();
void startDescTableTitle();
void endDescTableTitle();
void startDescTableData();
void endDescTableData();
void lastIndexPage();

void startDotGraph();
void endDotGraph(const DotClassGraph &);
Expand Down Expand Up @@ -313,8 +306,8 @@ class LatexGenerator : public OutputGenerator
void endConstraintDocs();
void endConstraintList();

void startMemberDocSimple();
void endMemberDocSimple();
void startMemberDocSimple(bool);
void endMemberDocSimple(bool);
void startInlineMemberType();
void endInlineMemberType();
void startInlineMemberName();
Expand Down
13 changes: 10 additions & 3 deletions src/mangen.cpp
Expand Up @@ -762,19 +762,26 @@ void ManGenerator::endInlineHeader()
firstCol = FALSE;
}

void ManGenerator::startMemberDocSimple()
void ManGenerator::startMemberDocSimple(bool isEnum)
{
if (!firstCol)
{
t << endl << ".PP" << endl;
}
t << "\\fB";
docify(theTranslator->trCompoundMembers());
if (isEnum)
{
docify(theTranslator->trEnumerationValues());
}
else
{
docify(theTranslator->trCompoundMembers());
}
t << ":\\fP" << endl;
t << ".RS 4" << endl;
}

void ManGenerator::endMemberDocSimple()
void ManGenerator::endMemberDocSimple(bool)
{
if (!firstCol) t << endl;
t << ".RE" << endl;
Expand Down
6 changes: 4 additions & 2 deletions src/mangen.h
Expand Up @@ -199,6 +199,8 @@ class ManGenerator : public OutputGenerator
void startDescTable(const char *t)
{ startSimpleSect(EnumValues,0,0,t); startDescForItem(); }
void endDescTable() { endDescForItem(); endSimpleSect(); }
void startDescTableRow() {}
void endDescTableRow() {}
void startDescTableTitle() { startItemListItem(); startBold(); startEmphasis(); endItemListItem(); }
void endDescTableTitle() { endEmphasis(); endBold(); }
void startDescTableData() { t << endl; firstCol=TRUE; }
Expand Down Expand Up @@ -244,8 +246,8 @@ class ManGenerator : public OutputGenerator
void endConstraintDocs();
void endConstraintList();

void startMemberDocSimple();
void endMemberDocSimple();
void startMemberDocSimple(bool);
void endMemberDocSimple(bool);
void startInlineMemberType();
void endInlineMemberType();
void startInlineMemberName();
Expand Down

0 comments on commit 9c915b8

Please sign in to comment.