Beispiel #1
0
void FTVHelp::generateLink(FTextStream &t,FTVNode *n)
{
    //printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
    //    n->ref.data(),n->file.data(),n->anchor.data());
    if (n->file.isEmpty()) // no link
    {
        t << "<b>" << convertToHtml(n->name) << "</b>";
    }
    else // link into other frame
    {
        if (!n->ref.isEmpty()) // link to entity imported via tag file
        {
            t << "<a class=\"elRef\" ";
            t << externalLinkTarget() << externalRef("",n->ref,FALSE);
        }
        else // local link
        {
            t << "<a class=\"el\" ";
        }
        t << "href=\"";
        t << externalRef("",n->ref,TRUE);
        t << node2URL(n);
        if (m_topLevelIndex)
            t << "\" target=\"basefrm\">";
        else
            t << "\" target=\"_self\">";
        t << convertToHtml(n->name);
        t << "</a>";
        if (!n->ref.isEmpty())
        {
            t << "&#160;[external]";
        }
    }
}
Beispiel #2
0
static void generateJSLink(FTextStream &t,FTVNode *n)
{
    if (n->file.isEmpty()) // no link
    {
        t << "\"" << convertToJSString(n->name) << "\", null, ";
    }
    else // link into other page
    {
        t << "\"" << convertToJSString(n->name) << "\", \"";
        t << externalRef("",n->ref,TRUE);
        t << node2URL(n);
        t << "\", ";
    }
}
void FTVHelp::generateLink(QTextStream &t, FTVNode *n)
{
   if (n->file.isEmpty()) { 
      // no link
      t << "<b>" << convertToHtml(n->name) << "</b>";

   } else { 
      // link into other frame

      if (!n->ref.isEmpty()) { 
         // link to entity imported via tag file
         t << "<a class=\"elRef\" ";
         t << externalLinkTarget() << externalRef("", n->ref, false);

      } else { 
         // local link
         t << "<a class=\"el\" ";
      }

      t << "href=\"";
      t << externalRef("", n->ref, true);
      t << node2URL(n);

      if (m_topLevelIndex) {
         t << "\" target=\"basefrm\">";
      } else {
         t << "\" target=\"_self\">";
      }

      t << convertToHtml(n->name);
      t << "</a>";

      if (! n->ref.isEmpty()) {
         t << "&#160;[external]";
      }
   }
}
Beispiel #4
0
static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t,
                           const QList<FTVNode> &nl,int level,bool &first)
{
    static QCString htmlOutput = Config_getString("HTML_OUTPUT");
    QCString indentStr;
    indentStr.fill(' ',level*2);
    bool found=FALSE;
    QListIterator<FTVNode> nli(nl);
    FTVNode *n;
    for (nli.toFirst(); (n=nli.current()); ++nli)
    {
        // terminate previous entry
        if (!first) t << "," << endl;
        first=FALSE;

        // start entry
        if (!found)
        {
            t << "[" << endl;
        }
        found=TRUE;

        if (n->addToNavIndex) // add entry to the navigation index
        {
            if (n->def && n->def->definitionType()==Definition::TypeFile)
            {
                FileDef *fd = (FileDef*)n->def;
                bool doc,src;
                doc = fileVisibleInIndex(fd,src);
                if (doc)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,FALSE),pathToNode(n,n)));
                }
                if (src)
                {
                    navIndex.append(new NavIndexEntry(node2URL(n,TRUE,TRUE),pathToNode(n,n)));
                }
            }
            else
            {
                navIndex.append(new NavIndexEntry(node2URL(n),pathToNode(n,n)));
            }
        }

        if (n->separateIndex) // store items in a separate file for dynamic loading
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            if (n->children.count()>0) // write children to separate file for dynamic loading
            {
                QCString fileId = n->file;
                if (n->anchor)
                {
                    fileId+="_"+n->anchor;
                }
                if (dupOfParent(n))
                {
                    fileId+="_dup";
                }
                QFile f(htmlOutput+"/"+fileId+".js");
                if (f.open(IO_WriteOnly))
                {
                    FTextStream tt(&f);
                    tt << "var " << convertFileId2Var(fileId) << " =" << endl;
                    generateJSTree(navIndex,tt,n->children,1,firstChild);
                    tt << endl << "];";
                }
                t << "\"" << fileId << "\" ]";
            }
            else // no children
            {
                t << "null ]";
            }
        }
        else // show items in this file
        {
            bool firstChild=TRUE;
            t << indentStr << "  [ ";
            generateJSLink(t,n);
            bool emptySection = !generateJSTree(navIndex,t,n->children,level+1,firstChild);
            if (emptySection)
                t << "null ]";
            else
                t << endl << indentStr << "  ] ]";
        }
    }
    return found;
}
static bool generateJSTree(SortedList<NavIndexEntry *> &navIndex, QTextStream &t, const QList<FTVNode *> &nl, int level, bool &omitComma)
{
   static QString htmlOutput   = Config::getString("html-output");   
   static QString mainPageName = Config::getFullName(Config::getString("main-page-name")); 
   static bool mainPageOmit    = Config::getBool("main-page-omit"); 

   QString indentStr;
   indentStr.fill(' ', level * 2);

   bool found = false;

   for (auto node : nl)  {
      // terminate previous entry

      if (! omitComma) {
         t << "," << endl;
      }
      omitComma = false;

      // start entry
      if (! found) {
         t << "[" << endl;
      }
      found = true;

      if (node->addToNavIndex) { 
         // add entry to the navigation index

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();
  
            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {       
               // do not add this file to the navIndex, for \files

            } else {  
                                   
               if (docFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, false), pathToNode(node)));
               }
   
               if (srcFileVisibleInIndex(fd)) {
                  navIndex.inSort(new NavIndexEntry(node2URL(node, true, true), pathToNode(node)));
               }
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 
             
            } else {
               navIndex.inSort(new NavIndexEntry(node2URL(node), pathToNode(node)));
            }
         }
      }

      if (node->separateIndex) { 
         // store some items in a separate file (annotated, modules, namespaces, files)
         bool firstChild   = true;
         bool showMainPage = true;

         if (node->def && node->def->definitionType() == Definition::TypeFile) {            
            QSharedPointer<FileDef> fd = node->def.dynamicCast<FileDef>();

            if (! mainPageName.isEmpty() && fd->getFilePath() == mainPageName) {   
               // do not add this file to the navIndex, for \files

               showMainPage = false;
               omitComma    = true;
            }

         } else { 
                
            if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
               // do not add this file to the navIndex 

               showMainPage = false;
               omitComma    = true;
            }
         }

         if (showMainPage) {         
            t << indentStr << "  [ ";
            generateJSLink(t, node);
   
            if (node->children.count() > 0) { 
               // write children to separate file for dynamic loading
               QString fileId = node->file;
   
               if (! node->anchor.isEmpty()) {
                  fileId += "_" + node->anchor;
               }
   
               if (dupOfParent(node)) {
                  fileId += "_dup";
               }
   
               QFile fi(htmlOutput + "/" + fileId + ".js");
   
               if (fi.open(QIODevice::WriteOnly)) {
                  QTextStream tt(&fi);
   
                  tt << "var " << convertFileId2Var(fileId) << " =" << endl;
                  generateJSTree(navIndex, tt, node->children, 1, firstChild);
                  tt << endl << "];";
               }
   
               t << "\"" << fileId << "\" ]";            

            } else { 
               // no children
               t << "null ]";
            }
         }

      } else {
         bool firstChild = true;

         if (mainPageOmit && node->def == Doxy_Globals::mainPage) { 
            // omit treeview entries for index page
            omitComma = true;

         } else  {
            t << indentStr << "  [ ";
            generateJSLink(t, node);
   
            bool emptySection = ! generateJSTree(navIndex, t, node->children, level + 1, firstChild);
   
            if (emptySection) {
               t << "null ]";
            } else {
               t << endl << indentStr << "  ] ]";
            }
         }
      }
   }

   return found;
}