Skip to content

Commit c3f92e6

Browse files
committed
Added new layout option: full height side bar + navigation tabs
To enable this layout set: - DISABLE_INDEX = NO - GENERATE_TREEVIEW = YES - FULL_SIDEBAR = YES
1 parent bc8099c commit c3f92e6

File tree

9 files changed

+206
-112
lines changed

9 files changed

+206
-112
lines changed

doc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ set(DOC_FILES
115115
install.dox
116116
layout_index_and_notreeview.png
117117
layout_index_and_treeview.png
118+
layout_index_and_sidebar.png
118119
layout_noindex_and_notreeview.png
119120
layout_noindex_and_treeview.png
120121
layout_noindex_and_sidebar.png

doc/customize.dox

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,20 @@ or even have both forms of navigation:
8181

8282
- \ref cfg_disable_index "DISABLE_INDEX" = \c NO
8383
- \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c YES
84+
- \ref cfg_full_sidebar "FULL_SIDEBAR" = \c NO
8485

8586
\image html layout_index_and_treeview.png
8687
\image latex layout_index_and_treeview.png width=8cm
8788

89+
and this also works with the side bar spanning the full height
90+
91+
- \ref cfg_disable_index "DISABLE_INDEX" = \c NO
92+
- \ref cfg_generate_treeview "GENERATE_TREEVIEW" = \c YES
93+
- \ref cfg_full_sidebar "FULL_SIDEBAR" = \c YES
94+
95+
\image html layout_index_and_sidebar.png
96+
\image latex layout_index_and_sidebar.png width=8cm
97+
8898
if you already use an external index (i.e. have one of the following
8999
options enabled
90100
\ref cfg_generate_htmlhelp "GENERATE_HTMLHELP",

doc/layout_index_and_sidebar.png

19.6 KB
Loading

src/htmlgen.cpp

Lines changed: 82 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static void writeServerSearchBox(TextStream &t,const QCString &relPath,bool high
108108
}
109109
t << "\" method=\"get\">\n";
110110
t << " <span id=\"MSearchSelectExt\">&#160;</span>\n";
111-
if (!highlightSearch)
111+
if (!highlightSearch || !Config_getBool(HTML_DYNAMIC_MENUS))
112112
{
113113
t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" placeholder=\""
114114
<< theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n";
@@ -343,7 +343,7 @@ static QCString substituteHtmlKeywords(const QCString &str,
343343
bool hasProjectBrief = !Config_getString(PROJECT_BRIEF).isEmpty();
344344
bool hasProjectLogo = !Config_getString(PROJECT_LOGO).isEmpty();
345345
bool hasProjectIcon = !Config_getString(PROJECT_ICON).isEmpty();
346-
bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && disableIndex && treeView;
346+
bool hasFullSideBar = Config_getBool(FULL_SIDEBAR) && /*disableIndex &&*/ treeView;
347347
bool hasCopyClipboard = Config_getBool(HTML_COPY_CLIPBOARD);
348348
bool hasCookie = treeView || searchEngine || Config_getEnum(HTML_COLORSTYLE)==HTML_COLORSTYLE_t::TOGGLE;
349349
static bool titleArea = (hasProjectName || hasProjectBrief || hasProjectLogo || (disableIndex && searchEngine));
@@ -425,7 +425,7 @@ static QCString substituteHtmlKeywords(const QCString &str,
425425

426426
if (!serverBasedSearch)
427427
{
428-
if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
428+
if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS) || Config_getBool(FULL_SIDEBAR))
429429
{
430430
searchCssJs += "<script type=\"text/javascript\">\n"
431431
"/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
@@ -2818,25 +2818,36 @@ static void renderQuickLinksAsTabs(TextStream &t,const QCString &relPath,
28182818
{
28192819
bool searchEngine = Config_getBool(SEARCHENGINE);
28202820
bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2821+
bool disableIndex = Config_getBool(DISABLE_INDEX);
2822+
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2823+
bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2824+
// case where DISABLE_INDEX=NO & GENERATE_TREEVIEW=YES & FULL_SIDEBAR=YES has search box in the side panel
28212825
if (searchEngine)
28222826
{
28232827
t << " <li>\n";
2824-
if (!serverBasedSearch) // pure client side search
2828+
if (disableIndex || !generateTreeView || !fullSidebar)
28252829
{
2826-
writeClientSearchBox(t,relPath);
2827-
t << " </li>\n";
2828-
}
2829-
else // server based search
2830-
{
2831-
writeServerSearchBox(t,relPath,highlightSearch);
2832-
if (!highlightSearch)
2830+
if (!serverBasedSearch) // pure client side search
28332831
{
2832+
writeClientSearchBox(t,relPath);
28342833
t << " </li>\n";
28352834
}
2835+
else // server based search
2836+
{
2837+
writeServerSearchBox(t,relPath,highlightSearch);
2838+
if (!highlightSearch)
2839+
{
2840+
t << " </li>\n";
2841+
}
2842+
}
2843+
}
2844+
else
2845+
{
2846+
t << " </li>\n";
28362847
}
28372848
}
2838-
if (!highlightSearch) // on the search page the index will be ended by the
2839-
// page itself
2849+
if (!highlightSearch || Config_getBool(FULL_SIDEBAR))
2850+
// on the search page the index will be ended by the page itself if the search box is part of the navigation bar
28402851
{
28412852
endQuickIndexList(t);
28422853
}
@@ -2855,9 +2866,11 @@ static void writeDefaultQuickLinks(TextStream &t,
28552866
const QCString &relPath)
28562867
{
28572868
bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH);
2858-
bool searchEngine = Config_getBool(SEARCHENGINE);
2859-
bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2860-
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2869+
bool searchEngine = Config_getBool(SEARCHENGINE);
2870+
bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
2871+
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
2872+
bool fullSidebar = Config_getBool(FULL_SIDEBAR);
2873+
bool disableIndex = Config_getBool(DISABLE_INDEX);
28612874
LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();
28622875
LayoutNavEntry::Kind kind = LayoutNavEntry::None;
28632876
LayoutNavEntry::Kind altKind = LayoutNavEntry::None; // fall back for the old layout file
@@ -2908,7 +2921,7 @@ static void writeDefaultQuickLinks(TextStream &t,
29082921
case HighlightedItem::Search: break;
29092922
}
29102923

2911-
if (!Config_getBool(DISABLE_INDEX) && Config_getBool(HTML_DYNAMIC_MENUS))
2924+
if (!disableIndex && Config_getBool(HTML_DYNAMIC_MENUS))
29122925
{
29132926
QCString searchPage;
29142927
if (externalSearch)
@@ -2925,7 +2938,7 @@ static void writeDefaultQuickLinks(TextStream &t,
29252938
t << "/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n";
29262939
t << "$(function() {\n";
29272940
t << " initMenu('" << relPath << "',"
2928-
<< (searchEngine?"true":"false") << ","
2941+
<< (searchEngine && !(generateTreeView && fullSidebar)?"true":"false") << ","
29292942
<< (serverBasedSearch?"true":"false") << ",'"
29302943
<< searchPage << "','"
29312944
<< theTranslator->trSearch() << "',"
@@ -2949,7 +2962,7 @@ static void writeDefaultQuickLinks(TextStream &t,
29492962
t << "</script>\n";
29502963
t << "<div id=\"main-nav\"></div>\n";
29512964
}
2952-
else if (!Config_getBool(DISABLE_INDEX)) // && !Config_getBool(HTML_DYNAMIC_MENUS)
2965+
else if (!disableIndex) // && !Config_getBool(HTML_DYNAMIC_MENUS)
29532966
{
29542967
// find highlighted index item
29552968
LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : QCString());
@@ -2971,12 +2984,18 @@ static void writeDefaultQuickLinks(TextStream &t,
29712984
hlEntry = e;
29722985
}
29732986
}
2987+
t << "<div id=\"main-nav\">\n";
29742988
renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HighlightedItem::Search);
2989+
t << "</div>\n";
29752990
}
2976-
else if (!Config_getBool(GENERATE_TREEVIEW))
2991+
else if (!generateTreeView)
29772992
{
29782993
renderQuickLinksAsTree(t,relPath,root);
29792994
}
2995+
if (generateTreeView && !disableIndex && fullSidebar)
2996+
{
2997+
t << "<div id=\"doc-content\">\n";
2998+
}
29802999
}
29813000

29823001
void HtmlGenerator::endQuickIndices()
@@ -2998,12 +3017,12 @@ QCString HtmlGenerator::writeSplitBarAsString(const QCString &name,const QCStrin
29983017
{
29993018
QCString fn = name;
30003019
addHtmlExtensionIfMissing(fn);
3001-
if (!Config_getBool(DISABLE_INDEX) || !Config_getBool(FULL_SIDEBAR))
3020+
if (/*!Config_getBool(DISABLE_INDEX) ||*/ !Config_getBool(FULL_SIDEBAR))
30023021
{
30033022
result += QCString(
30043023
"<div id=\"side-nav\" class=\"ui-resizable side-nav-resizable\">\n");
30053024
}
3006-
result+= QCString(
3025+
result+=
30073026
" <div id=\"nav-tree\">\n"
30083027
" <div id=\"nav-tree-contents\">\n"
30093028
" <div id=\"nav-sync\" class=\"sync\"></div>\n"
@@ -3015,12 +3034,15 @@ QCString HtmlGenerator::writeSplitBarAsString(const QCString &name,const QCStrin
30153034
"</div>\n"
30163035
"<script type=\"text/javascript\">\n"
30173036
"/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */\n"
3018-
"$(function(){initNavTree('") + fn +
3019-
QCString("','") + relpath +
3020-
QCString("'); initResizable(true); });\n"
3037+
"$(function(){initNavTree('" + fn +
3038+
"','" + relpath +
3039+
"'); initResizable(true); });\n"
30213040
"/* @license-end */\n"
3022-
"</script>\n"
3023-
"<div id=\"doc-content\">\n");
3041+
"</script>\n";
3042+
if (Config_getBool(DISABLE_INDEX) || !Config_getBool(FULL_SIDEBAR))
3043+
{
3044+
result+="<div id=\"doc-content\">\n";
3045+
}
30243046
}
30253047
else
30263048
{
@@ -3071,10 +3093,12 @@ void HtmlGenerator::writeQuickLinks(HighlightedItem hli,const QCString &file)
30713093
// PHP based search script
30723094
void HtmlGenerator::writeSearchPage()
30733095
{
3074-
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3075-
bool disableIndex = Config_getBool(DISABLE_INDEX);
3076-
QCString projectName = Config_getString(PROJECT_NAME);
3077-
QCString htmlOutput = Config_getString(HTML_OUTPUT);
3096+
bool disableIndex = Config_getBool(DISABLE_INDEX);
3097+
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3098+
bool fullSidebar = Config_getBool(FULL_SIDEBAR);
3099+
bool quickLinksAfterSplitbar = !disableIndex && generateTreeView && fullSidebar;
3100+
QCString projectName = Config_getString(PROJECT_NAME);
3101+
QCString htmlOutput = Config_getString(HTML_OUTPUT);
30783102

30793103
// OPENSEARCH_PROVIDER {
30803104
QCString configFileName = htmlOutput+"/search_config.php";
@@ -3087,6 +3111,7 @@ void HtmlGenerator::writeSearchPage()
30873111
t << " 'PROJECT_NAME' => \"" << convertToHtml(projectName) << "\",\n";
30883112
t << " 'GENERATE_TREEVIEW' => " << (generateTreeView?"true":"false") << ",\n";
30893113
t << " 'DISABLE_INDEX' => " << (disableIndex?"true":"false") << ",\n";
3114+
t << " 'FULL_SIDEBAR' => " << (fullSidebar?"true":"false") << ",\n";
30903115
t << ");\n\n";
30913116
t << "$translator = array(\n";
30923117
t << " 'search_results_title' => \"" << theTranslator->trSearchResultsTitle() << "\",\n";
@@ -3097,7 +3122,6 @@ void HtmlGenerator::writeSearchPage()
30973122
t << " ),\n";
30983123
t << " 'search_matches' => \"" << theTranslator->trSearchMatches() << "\",\n";
30993124
t << " 'search' => \"" << theTranslator->trSearch() << "\",\n";
3100-
t << " 'split_bar' => \"" << substitute(substitute(writeSplitBarAsString("search",""), "\"","\\\""), "\n","\\n") << "\",\n";
31013125
t << " 'logo' => \"" << substitute(substitute(writeLogoAsString(""), "\"","\\\""), "\n","\\n") << "\",\n";
31023126
t << ");\n\n";
31033127
t << "?>\n";
@@ -3123,14 +3147,21 @@ void HtmlGenerator::writeSearchPage()
31233147
<< "search/\",'" << Doxygen::htmlFileExtension << "');\n";
31243148
t << "/* @license-end */\n";
31253149
t << "</script>\n";
3126-
if (!Config_getBool(DISABLE_INDEX))
3150+
3151+
if (!disableIndex && !quickLinksAfterSplitbar)
31273152
{
31283153
writeDefaultQuickLinks(t,HighlightedItem::Search,QCString(),QCString());
31293154
}
3130-
else
3155+
if (generateTreeView)
31313156
{
3132-
t << "</div>\n";
3157+
t << "</div><!-- top -->\n";
31333158
}
3159+
t << writeSplitBarAsString("search.php",QCString());
3160+
if (quickLinksAfterSplitbar)
3161+
{
3162+
writeDefaultQuickLinks(t,HighlightedItem::Search,QCString(),QCString());
3163+
}
3164+
t << "<!-- generated -->\n";
31343165

31353166
t << "<?php\n";
31363167
t << "require_once \"search_functions.php\";\n";
@@ -3162,9 +3193,12 @@ void HtmlGenerator::writeSearchPage()
31623193

31633194
void HtmlGenerator::writeExternalSearchPage()
31643195
{
3165-
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3166-
QCString dname = Config_getString(HTML_OUTPUT);
3167-
QCString fileName = dname+"/search"+Doxygen::htmlFileExtension;
3196+
bool disableIndex = Config_getBool(DISABLE_INDEX);
3197+
bool generateTreeView = Config_getBool(GENERATE_TREEVIEW);
3198+
bool fullSidebar = Config_getBool(FULL_SIDEBAR);
3199+
bool quickLinksAfterSplitbar = !disableIndex && generateTreeView && fullSidebar;
3200+
QCString dname = Config_getString(HTML_OUTPUT);
3201+
QCString fileName = dname+"/search"+Doxygen::htmlFileExtension;
31683202
std::ofstream f = Portable::openOutputStream(fileName);
31693203
if (f.is_open())
31703204
{
@@ -3179,27 +3213,21 @@ void HtmlGenerator::writeExternalSearchPage()
31793213
<< "search/\",'" << Doxygen::htmlFileExtension << "');\n";
31803214
t << "/* @license-end */\n";
31813215
t << "</script>\n";
3182-
if (!Config_getBool(DISABLE_INDEX))
3216+
3217+
if (!disableIndex && !quickLinksAfterSplitbar)
31833218
{
31843219
writeDefaultQuickLinks(t,HighlightedItem::Search,QCString(),QCString());
3185-
if (!Config_getBool(HTML_DYNAMIC_MENUS)) // for dynamic menus, menu.js creates this part
3186-
{
3187-
t << " <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\"\" placeholder=\"" << theTranslator->trSearch() <<
3188-
"\" size=\"20\" accesskey=\"S\" onfocus=\"searchBox.OnSearchFieldFocus(true)\" onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n";
3189-
}
3190-
t << " </form>\n";
3191-
t << " </div><div class=\"right\"></div>\n";
3192-
t << " </div>\n";
3193-
t << " </li>\n";
3194-
t << " </ul>\n";
3195-
t << " </div>\n";
3196-
t << "</div>\n";
31973220
}
3198-
else
3221+
if (generateTreeView)
31993222
{
3200-
t << "</div>\n";
3223+
t << "</div><!-- top -->\n";
32013224
}
3202-
t << writeSplitBarAsString("search","");
3225+
t << writeSplitBarAsString("search.php",QCString());
3226+
if (quickLinksAfterSplitbar)
3227+
{
3228+
writeDefaultQuickLinks(t,HighlightedItem::Search,QCString(),QCString());
3229+
}
3230+
32033231
t << "<div class=\"header\">\n";
32043232
t << " <div class=\"headertitle\">\n";
32053233
t << " <div class=\"title\">" << theTranslator->trSearchResultsTitle() << "</div>\n";

0 commit comments

Comments
 (0)