📄 ftvhelp.cpp
字号:
QCString fileName=Config_getString("HTML_OUTPUT")+"/treeview.js"; QFile f(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); t << treeview_data; f.close(); } // Generate alternative index.html as a frame fileName=Config_getString("HTML_OUTPUT")+"/index.html"; 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::Latin1);#endif t << "<html><head>"; t << "<meta http-equiv=\"Content-Type\" content=\"text/html;charset=" << theTranslator->idLanguageCharset() << "\">\n"; t << "<title>"; if (Config_getString("PROJECT_NAME").isEmpty()) { t << "Doxygen Documentation"; } else { t << Config_getString("PROJECT_NAME"); } t << "</title></head>" << endl; t << "<frameset cols=\"" << Config_getInt("TREEVIEW_WIDTH") << ",*\">" << endl; t << " <frame src=\"tree.html\" name=\"treefrm\">" << endl; t << " <frame src=\"main.html\" name=\"basefrm\">" << endl; t << "</frameset>" << endl; t << "</html>" << endl; f.close(); } // Generate tree view frame fileName=Config_getString("HTML_OUTPUT")+"/tree.html"; f.setName(fileName); if (!f.open(IO_WriteOnly)) { err("Cannot open file %s for writing!\n",fileName.data()); return; } else { QTextStream t(&f); t << "<html><head>" << 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 << "<script src=\"treeview.js\"></script>" << endl; t << "<script src=\"tree.js\"></script>" << endl; t << "<script>" << endl; t << "initializeDocument()" << endl; t << "</script>" << endl; t << "</head>" << endl; t << "<body bgcolor=\"#ffffff\">" << endl; t << "</body>" << endl; t << "</html>" << endl; f.close(); } // Generate tree view images ImageInfo *p = image_info; while (p->name) { QCString fileName=Config_getString("HTML_OUTPUT")+"/"+p->name; QFile f(fileName); if (f.open(IO_WriteOnly)) f.writeBlock((char *)p->data,p->len); else { fprintf(stderr,"Warning: Cannot open file %s for writing\n",fileName.data()); } f.close(); p++; }}//----------------------------------------------------------------------------FTVHelp *FTVHelp::m_theInstance = 0;/*! Construm_cts an ftv help object. * The object has to be \link initialize() initialized\endlink before it can * be used. */FTVHelp::FTVHelp(){ /* initial depth */ m_dc = 0; m_cf = 0;}/*! return a reference to the one and only instance of this class. */FTVHelp *FTVHelp::getInstance(){ if (m_theInstance==0) m_theInstance = new FTVHelp; return m_theInstance;}/*! This will create a folder tree view table of contents file (tree.js). * \sa finalize() */void FTVHelp::initialize(){ /* open the contents file */ QCString fName = Config_getString("HTML_OUTPUT") + "/tree.js"; m_cf = new QFile(fName); if (!m_cf->open(IO_WriteOnly)) { err("Could not open file %s for writing\n",fName.data()); exit(1); } /* Write the header of the contents file */ m_cts.setDevice(m_cf);#if QT_VERSION >= 200 m_cts.setEncoding(QTextStream::Latin1);#endif m_cts << "foldersTree = gFld(\"<b>"; if (Config_getString("PROJECT_NAME").isEmpty()) { m_cts << "Root"; } else { m_cts << Config_getString("PROJECT_NAME"); } m_cts << "</b>\", \"\", \"\")\n";}/*! Finalizes the FTV help. This will finish and close the * contents file (index.js). * \sa initialize() */void FTVHelp::finalize(){ m_cts.unsetDevice(); m_cf->close(); delete m_cf; generateFolderTreeViewData();}/*! Increase the level of the contents hierarchy. * This will start a new sublist in contents file. * \sa decContentsDepth() */int FTVHelp::incContentsDepth(){ //int i; for (i=0;i<m_dc+1;i++) m_cts << " "; return ++m_dc;}/*! Decrease the level of the contents hierarchy. * This will end the current sublist. * \sa incContentsDepth() */int FTVHelp::decContentsDepth(){ //int i; for (i=0;i<m_dc;i++) m_cts << " "; return --m_dc;}/*! Add a list item to the contents file. * \param isDir TRUE if the item is a directory, FALSE if it is a text * \param name the name of the item. * \param ref the URL of to the item. */void FTVHelp::addContentsItem(bool isDir, const char *ref, const char *file, const char *anchor, const char *name ){ int i; for (i=0;i<m_dc;i++) m_cts << " "; QCString parent; QCString tagName = ref; QCString tagDir; if (ref) { tagName += ":"; QCString *s = Doxygen::tagDestinationDict[ref]; if (s) { tagDir = *s + "/"; tagName += tagDir; } } if (m_dc==0) parent="foldersTree"; else parent.sprintf("aux%d",m_dc); if (isDir) // directory entry { m_cts << "aux" << m_dc+1 << " = insFld(" << parent << ", gFld(\"" << name << "\", \"" << tagName << "\", "; if (file) // file optional param { m_cts << "\"" << tagDir << file << ".html\"))"; } else { m_cts << "\"\"))"; } } else // text entry { m_cts << " insDoc(" << parent << ", gLnk(\"" << name << "\", \"" << tagName << "\", "; if (file) // ref optional param { m_cts << "\"" << tagDir << file << ".html"; if (anchor) m_cts << "#" << anchor; m_cts << "\"))"; } else { m_cts << "\"\"))"; } } m_cts << "\n";}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -