diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2017-01-10 19:29:35 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2017-01-10 19:29:35 (GMT) |
commit | 1be97720b7820361e85242d08d4cac3e46570bfe (patch) | |
tree | 1c2fed4012d26c715c4b19a9362910892228f5f2 /src/htmlgen.cpp | |
parent | c10af45c61a1f9b25c514f397ace16c94cc7c8df (diff) | |
download | Doxygen-1be97720b7820361e85242d08d4cac3e46570bfe.zip Doxygen-1be97720b7820361e85242d08d4cac3e46570bfe.tar.gz Doxygen-1be97720b7820361e85242d08d4cac3e46570bfe.tar.bz2 |
Bug 776964 - Menu does not work without Javascript
Diffstat (limited to 'src/htmlgen.cpp')
-rw-r--r-- | src/htmlgen.cpp | 75 |
1 files changed, 69 insertions, 6 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 28a363b..12b71e1 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -310,7 +310,7 @@ static QCString substituteHtmlKeywords(const QCString &s, if (!serverBasedSearch) { - if (disableIndex) + if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS)) { searchCssJs += "<script type=\"text/javascript\">\n" " $(document).ready(function() { init_search(); });\n" @@ -319,7 +319,7 @@ static QCString substituteHtmlKeywords(const QCString &s, } else { - if (disableIndex) + if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS)) { searchCssJs += "<script type=\"text/javascript\">\n" " $(document).ready(function() {\n" @@ -730,13 +730,20 @@ void HtmlGenerator::init() createSubDirs(d); ResourceMgr &mgr = ResourceMgr::instance(); - mgr.copyResource("tabs.css",dname); + if (Config_getBool(HTML_DYNAMIC_MENUS)) + { + mgr.copyResourceAs("tabs.css",dname,"tabs.css"); + } + else // stylesheet for the 'old' static tabs + { + mgr.copyResourceAs("fixed_tabs.css",dname,"tabs.css"); + } mgr.copyResource("jquery.js",dname); if (Config_getBool(INTERACTIVE_SVG)) { mgr.copyResource("svgpan.js",dname); } - if (!Config_getBool(DISABLE_INDEX)) + if (!Config_getBool(DISABLE_INDEX) && Config_getBool(HTML_DYNAMIC_MENUS)) { mgr.copyResource("menu.js",dname); } @@ -826,6 +833,10 @@ void HtmlGenerator::writeSearchData(const char *dir) { searchCss = mgr.getAsString("search_nomenu.css"); } + else if (!Config_getBool(HTML_DYNAMIC_MENUS)) + { + searchCss = mgr.getAsString("search_fixedtabs.css"); + } else { searchCss = mgr.getAsString("search.css"); @@ -2149,8 +2160,36 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact, static bool searchEngine = Config_getBool(SEARCHENGINE); static bool externalSearch = Config_getBool(EXTERNAL_SEARCH); LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry(); - - if (compact) + 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 && Config_getBool(HTML_DYNAMIC_MENUS)) { QCString searchPage; if (externalSearch) @@ -2187,6 +2226,30 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact, t << "</script>" << endl; t << "<div id=\"main-nav\"></div>" << endl; } + else if (compact) // && !Config_getBool(HTML_DYNAMIC_MENUS) + { + // 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... + { + highlightParent=TRUE; + hlEntry = root->children().getFirst(); + if (hlEntry==0) + { + return; // argl, empty index! + } + } + if (kind==LayoutNavEntry::UserGroup) + { + LayoutNavEntry *e = hlEntry->children().getFirst(); + if (e) + { + hlEntry = e; + } + } + renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HLI_Search); + } else { renderQuickLinksAsTree(t,relPath,root); |