void FTVHelp::generateTreeView(QString* OutString) { QCString fileName; QFile f; static bool searchEngine = Config_getBool("SEARCHENGINE"); generateTreeViewImages(); // If top level index, generate alternative index.html as a frame if (m_topLevelIndex) { fileName=Config_getString("HTML_OUTPUT")+"/index"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); #if QT_VERSION >= 200 t.setEncoding(QTextStream::UnicodeUTF8); #endif //t << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">\n"; t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"; t << "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\"/>\n"; t << "<title>"; if (Config_getString("PROJECT_NAME").isEmpty()) { t << "Doxygen Documentation"; } else { t << Config_getString("PROJECT_NAME"); } t << "</title>\n</head>" << endl; t << "<frameset cols=\"" << Config_getInt("TREEVIEW_WIDTH") << ",*\">" << endl; t << " <frame src=\"tree" << Doxygen::htmlFileExtension << "\" name=\"treefrm\"/>" << endl; t << " <frame src=\"main" << Doxygen::htmlFileExtension << "\" name=\"basefrm\"/>" << endl; t << " <noframes>" << endl; t << " <body>" << endl; t << " <a href=\"main" << Doxygen::htmlFileExtension << "\">Frames are disabled. Click here to go to the main page.</a>" << endl; t << " </body>" << endl; t << " </noframes>" << endl; t << "</frameset>" << endl; t << "</html>" << endl; f.close(); } } // Generate tree view if (!OutString) OutString = new QString; QTextOStream t(OutString); t.setEncoding(QTextStream::UnicodeUTF8); if (m_topLevelIndex) { if (searchEngine) { t << "<!-- This comment will put IE 6, 7 and 8 in quirks mode -->" << endl; } t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; t << "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n"; t << " <head>\n"; t << " <meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>\n"; t << " <meta http-equiv=\"Content-Style-Type\" content=\"text/css\" />\n"; t << " <meta http-equiv=\"Content-Language\" content=\"en\" />\n"; if (searchEngine) { t << " <link href=\"search/search.css\" rel=\"stylesheet\" type=\"text/css\"/>" << endl; t << " <script type=\"text/javaScript\" src=\"search/search.js\"></script>" << endl; } t << " <link rel=\"stylesheet\" href=\""; QCString cssname=Config_getString("HTML_STYLESHEET"); if (cssname.isEmpty()) { t << "doxygen.css"; } else { QFileInfo cssfi(cssname); if (!cssfi.exists()) { err("Error: user specified HTML style sheet file does not exist!\n"); } t << cssfi.fileName(); } t << "\"/>" << endl; t << " <title>TreeView</title>\n"; } t << " <script type=\"text/javascript\">\n"; t << " <!-- // Hide script from old browsers\n"; t << " \n"; /* User has clicked on a node (folder or +/-) in the tree */ t << " function toggleFolder(id, imageNode) \n"; t << " {\n"; t << " var folder = document.getElementById(id);\n"; t << " var l = imageNode.src.length;\n"; /* If the user clicks on the book icon, we move left one image so * the code (below) will also adjust the '+' icon. */ t << " if (imageNode.src.substring(l-20,l)==\"" FTV_ICON_FILE(folderclosed) "\" || \n"; t << " imageNode.src.substring(l-18,l)==\"" FTV_ICON_FILE(folderopen) "\")\n"; t << " {\n"; t << " imageNode = imageNode.previousSibling;\n"; t << " l = imageNode.src.length;\n"; t << " }\n"; t << " if (folder == null) \n"; t << " {\n"; t << " } \n"; /* Node controls a open section, we need to close it */ t << " else if (folder.style.display == \"block\") \n"; t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderclosed) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(mnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(pnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(mlastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(plastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"none\";\n"; t << " } \n"; t << " else \n"; /* section is closed, we need to open it */ t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderopen) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(pnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(plastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mlastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"block\";\n"; t << " }\n"; t << " }\n"; t << "\n"; t << " // End script hiding --> \n"; t << " </script>\n"; if (m_topLevelIndex) { t << " </head>\n"; t << "\n"; t << " <body class=\"ftvtree\""; if (searchEngine) { t << " onload='searchBox.OnSelectItem(0);'"; } t << ">\n"; if (searchEngine) { t << " <script type=\"text/javascript\"><!--\n"; t << " var searchBox = new SearchBox(\"searchBox\", \"search\", true);\n"; t << " --></script>\n"; t << " <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n"; t << " <div class=\"MSearchBoxRow\"><span class=\"MSearchBoxLeft\">\n"; t << " <input type=\"text\" id=\"MSearchField\" value=\"Search\" \n"; t << " onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n"; t << " onblur=\"searchBox.OnSearchFieldFocus(false)\" \n"; t << " onkeyup=\"searchBox.OnSearchFieldChange()\"/>\n"; t << " </span><span class=\"MSearchBoxRight\">\n"; t << " <img id=\"MSearchSelect\" src=\"search/search.png\"\n"; t << " onmouseover=\"return searchBox.OnSearchSelectShow()\"\n"; t << " onmouseout=\"return searchBox.OnSearchSelectHide()\"\n"; t << " alt=\"\"/>\n"; t << " </span></div><div class=\"MSearchBoxSpacer\"> </div>\n"; t << " </div>\n"; HtmlGenerator::writeSearchFooter(t,QCString()); } t << " <div class=\"directory\">\n"; t << " <h3 class=\"swap\"><span>"; QCString &projName = Config_getString("PROJECT_NAME"); if (projName.isEmpty()) { t << "Root"; } else { t << projName; } t << "</span></h3>\n"; } else { t << " <div class=\"directory-alt\">\n"; t << " <br/>\n"; } t << " <div style=\"display: block;\">\n"; generateTree(t,m_indentNodes[0],0); t << " </div>\n"; t << " </div>\n"; if (m_topLevelIndex) { t << " </body>\n"; t << "</html>\n"; } if (m_topLevelIndex) { fileName=Config_getString("HTML_OUTPUT")+"/tree"+Doxygen::htmlFileExtension; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); t.setEncoding(QTextStream::UnicodeUTF8); t << *OutString << endl; f.close(); } } }
void FTVHelp::generateScript(FTextStream &t) { t << " <script type=\"text/javascript\">\n"; t << " <!-- // Hide script from old browsers\n"; t << " \n"; /* User has clicked on a node (folder or +/-) in the tree */ t << " function toggleFolder(id, imageNode) \n"; t << " {\n"; t << " var folder = document.getElementById(id);\n"; t << " var l = imageNode.src.length;\n"; /* If the user clicks on the book icon, we move left one image so * the code (below) will also adjust the '+' icon. */ t << " if (imageNode.src.substring(l-20,l)==\"" FTV_ICON_FILE(folderclosed) "\" || \n"; t << " imageNode.src.substring(l-18,l)==\"" FTV_ICON_FILE(folderopen) "\")\n"; t << " {\n"; t << " imageNode = imageNode.previousSibling;\n"; t << " l = imageNode.src.length;\n"; t << " }\n"; t << " if (folder == null) \n"; t << " {\n"; t << " } \n"; /* Node controls a open section, we need to close it */ t << " else if (folder.style.display == \"block\") \n"; t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderclosed) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(mnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(pnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(mlastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(plastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"none\";\n"; t << " } \n"; t << " else \n"; /* section is closed, we need to open it */ t << " {\n"; t << " if (imageNode != null) \n"; t << " {\n"; t << " imageNode.nextSibling.src = \"" FTV_ICON_FILE(folderopen) "\";\n"; t << " if (imageNode.src.substring(l-13,l) == \"" FTV_ICON_FILE(pnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mnode) "\";\n"; t << " }\n"; t << " else if (imageNode.src.substring(l-17,l) == \"" FTV_ICON_FILE(plastnode) "\")\n"; t << " {\n"; t << " imageNode.src = \"" FTV_ICON_FILE(mlastnode) "\";\n"; t << " }\n"; t << " }\n"; t << " folder.style.display = \"block\";\n"; t << " }\n"; t << " }\n"; t << "\n"; t << " // End script hiding --> \n"; t << " </script>\n"; }