summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2016-05-01 08:05:39 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2016-05-05 19:40:39 (GMT)
commit8480d35beef57ed08139b58972bfb83a3b37422c (patch)
tree13d486ed244ee6382a88d5d3312f0ea01b5131be /src
parent33915cdce6b66af7e0f8d3e98d741df6e9cc5e32 (diff)
downloadDoxygen-8480d35beef57ed08139b58972bfb83a3b37422c.zip
Doxygen-8480d35beef57ed08139b58972bfb83a3b37422c.tar.gz
Doxygen-8480d35beef57ed08139b58972bfb83a3b37422c.tar.bz2
Applied responsive design to menu bar using smartmenus
Diffstat (limited to 'src')
-rw-r--r--src/doxygen.cpp2
-rw-r--r--src/htmlgen.cpp107
-rw-r--r--src/index.cpp165
-rw-r--r--src/memberdef.cpp4
4 files changed, 211 insertions, 67 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 0180eec..e1f8440 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -11674,7 +11674,7 @@ void generateOutput()
QString oldDir = QDir::currentDirPath();
QDir::setCurrent(Config_getString(HTML_OUTPUT));
portable_sysTimerStart();
- if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd)))
+ if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1)
{
err("failed to run html help compiler on index.hhp\n");
}
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index 239a9fe..54820ec 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -292,7 +292,6 @@ static QCString substituteHtmlKeywords(const QCString &s,
"<script type=\"text/javascript\" src=\"$relpath^navtree.js\"></script>\n"
"<script type=\"text/javascript\">\n"
" $(document).ready(initResizable);\n"
- " $(window).load(resizeHeight);\n"
"</script>";
}
@@ -305,19 +304,25 @@ static QCString substituteHtmlKeywords(const QCString &s,
}
searchCssJs += "<script type=\"text/javascript\" src=\"$relpath^search/search.js\"></script>\n";
- if (!serverBasedSearch)
+ if (!serverBasedSearch)
{
- searchCssJs += "<script type=\"text/javascript\">\n"
- " $(document).ready(function() { init_search(); });\n"
- "</script>";
+ if (disableIndex)
+ {
+ searchCssJs += "<script type=\"text/javascript\">\n"
+ " $(document).ready(function() { init_search(); });\n"
+ "</script>";
+ }
}
- else
+ else
{
- searchCssJs += "<script type=\"text/javascript\">\n"
- " $(document).ready(function() {\n"
- " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
- " });\n"
- "</script>\n";
+ if (disableIndex)
+ {
+ searchCssJs += "<script type=\"text/javascript\">\n"
+ " $(document).ready(function() {\n"
+ " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
+ " });\n"
+ "</script>\n";
+ }
// OPENSEARCH_PROVIDER {
searchCssJs += "<link rel=\"search\" href=\"" + relPath +
@@ -727,6 +732,10 @@ void HtmlGenerator::init()
{
mgr.copyResource("svgpan.js",dname);
}
+ if (!Config_getBool(DISABLE_INDEX))
+ {
+ mgr.copyResource("menu.js",dname);
+ }
{
QFile f(dname+"/dynsections.js");
@@ -1017,7 +1026,7 @@ void HtmlGenerator::startDoxyAnchor(const char *,const char *,
const char *anchor, const char *,
const char *)
{
- t << "<a class=\"anchor\" id=\"" << anchor << "\"></a>";
+ t << "<a id=\"" << anchor << "\"></a>";
}
void HtmlGenerator::endDoxyAnchor(const char *,const char *)
@@ -1193,7 +1202,7 @@ void HtmlGenerator::startSection(const char *lab,const char *,SectionInfo::Secti
case SectionInfo::Paragraph: t << "\n\n<h5>"; break;
default: ASSERT(0); break;
}
- t << "<a class=\"anchor\" id=\"" << lab << "\"></a>";
+ t << "<a id=\"" << lab << "\"></a>";
}
void HtmlGenerator::endSection(const char *,SectionInfo::SectionType type)
@@ -2070,59 +2079,35 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact,
const char *file,
const QCString &relPath)
{
+ static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
+ static bool searchEngine = Config_getBool(SEARCHENGINE);
LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();
- LayoutNavEntry::Kind kind = (LayoutNavEntry::Kind)-1;
- LayoutNavEntry::Kind altKind = (LayoutNavEntry::Kind)-1; // fall back for the old layout file
- bool highlightParent=FALSE;
- switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
- {
- case HLI_Main: kind = LayoutNavEntry::MainPage; break;
- case HLI_Modules: kind = LayoutNavEntry::Modules; break;
- //case HLI_Directories: kind = LayoutNavEntry::Dirs; break;
- case HLI_Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
- case HLI_Hierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
- case HLI_Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
- case HLI_Annotated: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
- case HLI_Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
- case HLI_NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
- case HLI_Functions: kind = LayoutNavEntry::ClassMembers; break;
- case HLI_Globals: kind = LayoutNavEntry::FileGlobals; break;
- case HLI_Pages: kind = LayoutNavEntry::Pages; break;
- case HLI_Examples: kind = LayoutNavEntry::Examples; break;
- case HLI_UserGroup: kind = LayoutNavEntry::UserGroup; break;
- case HLI_ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
- highlightParent = TRUE; break;
- case HLI_NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
- highlightParent = TRUE; break;
- case HLI_FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
- highlightParent = TRUE; break;
- case HLI_None: break;
- case HLI_Search: break;
- }
-
+
if (compact)
{
- // find highlighted index item
- LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : 0);
- if (!hlEntry && altKind!=(LayoutNavEntry::Kind)-1) { hlEntry=root->find(altKind); kind=altKind; }
- if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
+ t << "<script type=\"text/javascript\" src=\"" << relPath << "menudata.js\"></script>" << endl;
+ t << "<script type=\"text/javascript\" src=\"" << relPath << "menu.js\"></script>" << endl;
+ t << "<script type=\"text/javascript\">" << endl;
+ t << "$(function() {" << endl;
+ t << " initMenu('" << relPath << "',"
+ << (searchEngine?"true":"false") << ",'"
+ << theTranslator->trSearch() << "');" << endl;
+ if (Config_getBool(SEARCHENGINE))
{
- highlightParent=TRUE;
- hlEntry = root->children().getFirst();
- if (hlEntry==0)
+ if (!serverBasedSearch)
{
- return; // argl, empty index!
+ t << " $(document).ready(function() { init_search(); });\n";
}
- }
- if (kind==LayoutNavEntry::UserGroup)
- {
- LayoutNavEntry *e = hlEntry->children().getFirst();
- if (e)
+ else
{
- hlEntry = e;
+ t << " $(document).ready(function() {\n"
+ << " if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }\n"
+ << " });\n";
}
}
- renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HLI_Search);
+ t << "});" << endl;
+ t << "</script>" << endl;
+ t << "<div id=\"main-nav\"></div>" << endl;
}
else
{
@@ -2258,9 +2243,7 @@ void HtmlGenerator::writeSearchPage()
// Write empty navigation path, to make footer connect properly
if (generateTreeView)
{
- t << "</div><!-- doc-contents -->\n";
- //t << "<div id=\"nav-path\" class=\"navpath\">\n";
- //t << " <ul>\n";
+ t << "</div><!-- doc-content -->\n";
}
writePageFooter(t,"Search","","");
@@ -2281,6 +2264,7 @@ void HtmlGenerator::writeSearchPage()
void HtmlGenerator::writeExternalSearchPage()
{
static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
+ static bool disableIndex = Config_getBool(DISABLE_INDEX);
QCString fileName = Config_getString(HTML_OUTPUT)+"/search"+Doxygen::htmlFileExtension;
QFile f(fileName);
if (f.open(IO_WriteOnly))
@@ -2323,10 +2307,11 @@ void HtmlGenerator::writeExternalSearchPage()
if (generateTreeView)
{
- t << "</div><!-- doc-contents -->" << endl;
+ t << "</div><!-- doc-content -->" << endl;
}
writePageFooter(t,"Search","","");
+
}
QCString scriptName = Config_getString(HTML_OUTPUT)+"/search/search.js";
QFile sf(scriptName);
diff --git a/src/index.cpp b/src/index.cpp
index 8c7452e..2e94085 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -2571,6 +2571,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h
if (!disableIndex)
{
ol.writeQuickLinks(TRUE,HLI_Functions,0);
+#if 0
startQuickIndexList(ol);
// index item for global member list
@@ -2601,6 +2602,7 @@ static void writeClassMemberIndexFiltered(OutputList &ol, ClassMemberHighlight h
writeQuickMemberIndex(ol,g_memberIndexLetterUsed[hl],page,
getCmhlInfo(hl)->fname,multiPageIndex);
}
+#endif
}
ol.endQuickIndices();
ol.writeSplitBar(fileName);
@@ -2743,6 +2745,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl)
if (!disableIndex)
{
ol.writeQuickLinks(TRUE,HLI_Globals,0);
+#if 0
startQuickIndexList(ol);
// index item for all file member lists
@@ -2771,6 +2774,7 @@ static void writeFileMemberIndexFiltered(OutputList &ol, FileMemberHighlight hl)
writeQuickMemberIndex(ol,g_fileIndexLetterUsed[hl],page,
getFmhlInfo(hl)->fname,multiPageIndex);
}
+#endif
}
ol.endQuickIndices();
ol.writeSplitBar(fileName);
@@ -2911,6 +2915,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol,
if (!disableIndex)
{
ol.writeQuickLinks(TRUE,HLI_NamespaceMembers,0);
+#if 0
startQuickIndexList(ol);
// index item for all namespace member lists
@@ -2939,7 +2944,7 @@ static void writeNamespaceMemberIndexFiltered(OutputList &ol,
writeQuickMemberIndex(ol,g_namespaceIndexLetterUsed[hl],page,
getNmhlInfo(hl)->fname,multiPageIndex);
}
-
+#endif
}
ol.endQuickIndices();
ol.writeSplitBar(fileName);
@@ -4277,8 +4282,166 @@ static void writeIndexHierarchyEntries(OutputList &ol,const QList<LayoutNavEntry
}
}
+static bool quickLinkVisible(LayoutNavEntry::Kind kind)
+{
+ static bool showFiles = Config_getBool(SHOW_FILES);
+ static bool showNamespaces = Config_getBool(SHOW_NAMESPACES);
+ switch (kind)
+ {
+ case LayoutNavEntry::MainPage: return TRUE;
+ case LayoutNavEntry::User: return TRUE;
+ case LayoutNavEntry::UserGroup: return TRUE;
+ case LayoutNavEntry::Pages: return indexedPages>0;
+ case LayoutNavEntry::Modules: return documentedGroups>0;
+ case LayoutNavEntry::Namespaces: return documentedNamespaces>0 && showNamespaces;
+ case LayoutNavEntry::NamespaceList: return documentedNamespaces>0 && showNamespaces;
+ case LayoutNavEntry::NamespaceMembers: return documentedNamespaceMembers[NMHL_All]>0;
+ case LayoutNavEntry::Classes: return annotatedClasses>0;
+ case LayoutNavEntry::ClassList: return annotatedClasses>0;
+ case LayoutNavEntry::ClassIndex: return annotatedClasses>0;
+ case LayoutNavEntry::ClassHierarchy: return hierarchyClasses>0;
+ case LayoutNavEntry::ClassMembers: return documentedClassMembers[CMHL_All]>0;
+ case LayoutNavEntry::Files: return documentedHtmlFiles>0 && showFiles;
+ case LayoutNavEntry::FileList: return documentedHtmlFiles>0 && showFiles;
+ case LayoutNavEntry::FileGlobals: return documentedFileMembers[FMHL_All]>0;
+ //case LayoutNavEntry::Dirs: return documentedDirs>0;
+ case LayoutNavEntry::Examples: return Doxygen::exampleSDict->count()>0;
+ }
+ return FALSE;
+}
+
+template<class T>
+void renderMemberIndicesAsJs(FTextStream &t,
+ int total,const int *numDocumented,const LetterToIndexMap<MemberIndexList> *memberLists,
+ const T *(*getInfo)(int hl))
+{
+ // index items per category member lists
+ bool firstMember=TRUE;
+ for (int i=0;i<total;i++)
+ {
+ if (numDocumented[i]>0)
+ {
+ t << ",";
+ if (firstMember)
+ {
+ t << "children:[";
+ firstMember=FALSE;
+ }
+ t << endl << "{text:'" << convertToJSString(getInfo(i)->title) << "',url:'"
+ << convertToJSString(getInfo(i)->fname+Doxygen::htmlFileExtension) << "'";
+
+ // Check if we have many members, then add sub entries per letter...
+ // quick alphabetical index
+ bool quickIndex = numDocumented[i]>maxItemsBeforeQuickIndex;
+ if (quickIndex)
+ {
+ bool multiPageIndex=FALSE;
+ if (numDocumented[i]>MAX_ITEMS_BEFORE_MULTIPAGE_INDEX)
+ {
+ multiPageIndex=TRUE;
+ }
+ t << ",children:[" << endl;
+ bool firstLetter=TRUE;
+ SIntDict<MemberIndexList>::Iterator it(memberLists[i]);
+ MemberIndexList *ml;
+ for (it.toFirst();(ml=it.current());++it)
+ {
+ if (!firstLetter) t << "," << endl;
+ uint letter = ml->letter();
+ QCString is = letterToLabel(letter);
+ QCString ci = QString(QChar(letter)).utf8();
+ QCString anchor;
+ QCString extension=Doxygen::htmlFileExtension;
+ QCString fullName = getInfo(i)->fname;
+ if (!multiPageIndex || firstLetter)
+ anchor=fullName+extension+"#index_";
+ else // other pages of multi page index
+ anchor=fullName+"_"+is+extension+"#index_";
+ t << "{text:'" << convertToJSString(ci) << "',url:'"
+ << convertToJSString(anchor+is) << "'}";
+ firstLetter=FALSE;
+ }
+ t << "]";
+ }
+ t << "}";
+ }
+ }
+ if (!firstMember)
+ {
+ t << "]";
+ }
+}
+
+static bool renderQuickLinksAsJs(FTextStream &t,LayoutNavEntry *root,bool first)
+{
+ QListIterator<LayoutNavEntry> li(root->children());
+ LayoutNavEntry *entry;
+ int count=0;
+ for (li.toFirst();(entry=li.current());++li)
+ {
+ if (entry->visible() && quickLinkVisible(entry->kind())) count++;
+ }
+ if (count>0) // at least one item is visible
+ {
+ bool firstChild = TRUE;
+ if (!first) t << ",";
+ t << "children:[" << endl;
+ for (li.toFirst();(entry=li.current());++li)
+ {
+ if (entry->visible() && quickLinkVisible(entry->kind()))
+ {
+ if (!firstChild) t << "," << endl;
+ firstChild=FALSE;
+ QCString url = entry->url();
+ t << "{text:'" << convertToJSString(entry->title()) << "',url:'"
+ << convertToJSString(url) << "'";
+ bool hasChildren=FALSE;
+ if (entry->kind()==LayoutNavEntry::NamespaceMembers)
+ {
+ renderMemberIndicesAsJs(t,NMHL_Total,documentedNamespaceMembers,
+ g_namespaceIndexLetterUsed,getNmhlInfo);
+ }
+ else if (entry->kind()==LayoutNavEntry::ClassMembers)
+ {
+ renderMemberIndicesAsJs(t,CMHL_Total,documentedClassMembers,
+ g_memberIndexLetterUsed,getCmhlInfo);
+ }
+ else if (entry->kind()==LayoutNavEntry::FileGlobals)
+ {
+ renderMemberIndicesAsJs(t,FMHL_Total,documentedFileMembers,
+ g_fileIndexLetterUsed,getFmhlInfo);
+ }
+ else // recursive into child list
+ {
+ hasChildren = renderQuickLinksAsJs(t,entry,FALSE);
+ }
+ if (hasChildren) t << "]";
+ t << "}";
+ }
+ }
+ }
+ return count>0;
+}
+
+static void writeMenuData()
+{
+ if (!Config_getBool(GENERATE_HTML) || Config_getBool(DISABLE_INDEX)) return;
+ QCString outputDir = Config_getBool(HTML_OUTPUT);
+ QFile f(outputDir+"/menudata.js");
+ LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();
+ if (f.open(IO_WriteOnly))
+ {
+ FTextStream t(&f);
+ t << "var menudata={";
+ bool hasChildren = renderQuickLinksAsJs(t,root,TRUE);
+ if (hasChildren) t << "]";
+ t << "}" << endl;
+ }
+}
+
void writeIndexHierarchy(OutputList &ol)
{
+ writeMenuData();
LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry();
if (lne)
{
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index 0f403d1..2c88898 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -2078,9 +2078,7 @@ void MemberDef::_writeCallGraph(OutputList &ol)
msg("Generating call graph for function %s\n",qPrint(qualifiedName()));
ol.disable(OutputGenerator::Man);
ol.startCallGraph();
- ol.startParagraph();
ol.parseText(theTranslator->trCallGraph());
- ol.endParagraph();
ol.endCallGraph(callGraph);
ol.enableAll();
}
@@ -2103,9 +2101,7 @@ void MemberDef::_writeCallerGraph(OutputList &ol)
msg("Generating caller graph for function %s\n",qPrint(qualifiedName()));
ol.disable(OutputGenerator::Man);
ol.startCallGraph();
- ol.startParagraph();
ol.parseText(theTranslator->trCallerGraph());
- ol.endParagraph();
ol.endCallGraph(callerGraph);
ol.enableAll();
}