Orb/Doxygen/src/index.cpp
changeset 4 468f4c8d3d5b
parent 0 42188c7ea2d9
equal deleted inserted replaced
3:d8fccb2cd802 4:468f4c8d3d5b
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  * 
     3  * 
     4  *
     4  *
     5  * Copyright (C) 1997-2008 by Dimitri van Heesch.
     5  * Copyright (C) 1997-2010 by Dimitri van Heesch.
     6  *
     6  *
     7  * Permission to use, copy, modify, and distribute this software and its
     7  * Permission to use, copy, modify, and distribute this software and its
     8  * documentation under the terms of the GNU General Public License is hereby 
     8  * documentation under the terms of the GNU General Public License is hereby 
     9  * granted. No representations are made about the suitability of this software 
     9  * granted. No representations are made about the suitability of this software 
    10  * for any purpose. It is provided "as is" without express or implied warranty.
    10  * for any purpose. It is provided "as is" without express or implied warranty.
    44 #include "vhdldocgen.h"
    44 #include "vhdldocgen.h"
    45 
    45 
    46 #define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
    46 #define MAX_ITEMS_BEFORE_MULTIPAGE_INDEX 200
    47 #define MAX_ITEMS_BEFORE_QUICK_INDEX 30
    47 #define MAX_ITEMS_BEFORE_QUICK_INDEX 30
    48 
    48 
    49 static const char search_styleSheet[] =
       
    50 #include "search_css.h"
       
    51 ;
       
    52 
       
    53 static const char search_script[]=
    49 static const char search_script[]=
    54 #include "search_js.h"
    50 #include "search_js.h"
    55 ;
    51 ;
    56 
    52 
    57 int annotatedClasses;
    53 int annotatedClasses;
   193   return result;
   189   return result;
   194 }
   190 }
   195 
   191 
   196 //----------------------------------------------------------------------------
   192 //----------------------------------------------------------------------------
   197 
   193 
   198 static void startQuickIndexList(OutputList &ol)
   194 static void startQuickIndexList(OutputList &ol,bool letterTabs=FALSE)
   199 {
   195 {
   200   bool fancyTabs = TRUE;
   196   bool fancyTabs = TRUE;
   201   if (fancyTabs)
   197   if (fancyTabs)
   202   {
   198   {
   203     ol.writeString("  <div class=\"tabs\">\n"); 
   199     if (letterTabs)
   204     ol.writeString("    <ul>\n"); 
   200     {
       
   201       ol.writeString("  <div class=\"tabs3\">\n"); 
       
   202     }
       
   203     else
       
   204     {
       
   205       ol.writeString("  <div class=\"tabs2\">\n"); 
       
   206     }
       
   207     ol.writeString("    <ul class=\"tablist\">\n"); 
   205   }
   208   }
   206   else
   209   else
   207   {
   210   {
   208     ol.writeString("  <div class=\"qindex\">"); 
   211     ol.writeString("  <div class=\"qindex\">"); 
   209   }
   212   }
   265 {
   268 {
   266   return substitute(s," ","&nbsp;");
   269   return substitute(s," ","&nbsp;");
   267 }
   270 }
   268 
   271 
   269 
   272 
   270 void startTitle(OutputList &ol,const char *fileName)
   273 void startTitle(OutputList &ol,const char *fileName,Definition *def)
   271 {
   274 {
       
   275   ol.startHeaderSection();
       
   276   if (def) def->writeSummaryLinks(ol);
   272   ol.startTitleHead(fileName);
   277   ol.startTitleHead(fileName);
   273   ol.pushGeneratorState();
   278   ol.pushGeneratorState();
   274   ol.disable(OutputGenerator::Man);
   279   ol.disable(OutputGenerator::Man);
   275 }
   280 }
   276 
   281 
   277 void endTitle(OutputList &ol,const char *fileName,const char *name)
   282 void endTitle(OutputList &ol,const char *fileName,const char *name)
   278 {
   283 {
   279   ol.popGeneratorState();
   284   ol.popGeneratorState();
   280   ol.endTitleHead(fileName,name);
   285   ol.endTitleHead(fileName,name);
       
   286   ol.endHeaderSection();
   281 }
   287 }
   282 
   288 
   283 void startFile(OutputList &ol,const char *name,const char *manName,
   289 void startFile(OutputList &ol,const char *name,const char *manName,
   284                const char *title,HighlightedItem hli,bool additionalIndices)
   290                const char *title,HighlightedItem hli,bool additionalIndices)
   285 {
   291 {
   289     ol.startQuickIndices();
   295     ol.startQuickIndices();
   290     ol.writeQuickLinks(TRUE,hli);
   296     ol.writeQuickLinks(TRUE,hli);
   291     if (!additionalIndices)
   297     if (!additionalIndices)
   292     {
   298     {
   293       ol.endQuickIndices();
   299       ol.endQuickIndices();
   294       ol.startContents();
   300       //ol.startContents();
   295     }
   301     }
   296   }
   302   }
   297   else
   303   else
   298   {
   304   {
   299     if (!additionalIndices)
   305     if (!additionalIndices)
   300     {
   306     {
   301       ol.startContents();
   307     //  ol.startContents();
   302     }
   308     }
   303   }
   309   }
   304 }
   310 }
   305 
   311 
   306 void endFile(OutputList &ol,bool)
   312 void endFile(OutputList &ol,bool)
   315 
   321 
   316 //----------------------------------------------------------------------------
   322 //----------------------------------------------------------------------------
   317 
   323 
   318 static bool classHasVisibleChildren(ClassDef *cd)
   324 static bool classHasVisibleChildren(ClassDef *cd)
   319 {
   325 {
   320   if (cd->subClasses()==0) return FALSE;
   326  bool vhdl=Config_getBool("OPTIMIZE_OUTPUT_VHDL");
   321   BaseClassList *bcl=cd->subClasses();
   327 
       
   328   BaseClassList *bcl;
       
   329 
       
   330   if (vhdl) // reverse baseClass/subClass relation
       
   331   {
       
   332     if (cd->baseClasses()==0) return FALSE;
       
   333     bcl=cd->baseClasses();
       
   334   }
       
   335   else 
       
   336   {
       
   337     if (cd->subClasses()==0) return FALSE;
       
   338     bcl=cd->subClasses();
       
   339   }
       
   340 
   322   BaseClassListIterator bcli(*bcl);
   341   BaseClassListIterator bcli(*bcl);
   323   for ( ; bcli.current() ; ++bcli)
   342   for ( ; bcli.current() ; ++bcli)
   324   {
   343   {
   325     if (bcli.current()->classDef->isVisibleInHierarchy())
   344     if (bcli.current()->classDef->isVisibleInHierarchy())
   326     {
   345     {
   330   return FALSE;
   349   return FALSE;
   331 }
   350 }
   332 
   351 
   333 void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level,FTVHelp* ftv)
   352 void writeClassTree(OutputList &ol,BaseClassList *bcl,bool hideSuper,int level,FTVHelp* ftv)
   334 {
   353 {
       
   354   static bool vhdl=Config_getBool("OPTIMIZE_OUTPUT_VHDL");
       
   355 
   335   if (bcl==0) return;
   356   if (bcl==0) return;
   336   BaseClassListIterator bcli(*bcl);
   357   BaseClassListIterator bcli(*bcl);
   337   bool started=FALSE;
   358   bool started=FALSE;
   338   for ( ; bcli.current() ; ++bcli)
   359   for ( ; bcli.current() ; ++bcli)
   339   {
   360   {
   340     ClassDef *cd=bcli.current()->classDef;
   361     ClassDef *cd=bcli.current()->classDef;
   341     if (cd->isVisibleInHierarchy() && hasVisibleRoot(cd->baseClasses()))
   362     bool b;
       
   363     if (vhdl)
       
   364     {
       
   365       b=hasVisibleRoot(cd->subClasses());
       
   366     }
       
   367     else
       
   368     {
       
   369       b=hasVisibleRoot(cd->baseClasses());
       
   370     }
       
   371 
       
   372     if (cd->isVisibleInHierarchy() && b) // hasVisibleRoot(cd->baseClasses()))
   342     {
   373     {
   343       if (!started)
   374       if (!started)
   344       {
   375       {
   345         startIndexHierarchy(ol,level);
   376         startIndexHierarchy(ol,level);
   346         Doxygen::indexList.incContentsDepth();
   377         Doxygen::indexList.incContentsDepth();
   380       if (hasChildren)
   411       if (hasChildren)
   381       {
   412       {
   382         //printf("Class %s at %p visited=%d\n",cd->name().data(),cd,cd->visited);
   413         //printf("Class %s at %p visited=%d\n",cd->name().data(),cd,cd->visited);
   383         bool wasVisited=cd->visited;
   414         bool wasVisited=cd->visited;
   384         cd->visited=TRUE;
   415         cd->visited=TRUE;
   385         writeClassTree(ol,cd->subClasses(),wasVisited,level+1,ftv);
   416         if (vhdl)	
       
   417         {
       
   418           writeClassTree(ol,cd->baseClasses(),wasVisited,level+1,ftv);
       
   419         }
       
   420         else       
       
   421         {
       
   422           writeClassTree(ol,cd->subClasses(),wasVisited,level+1,ftv);
       
   423         }
   386       }
   424       }
   387       ol.endIndexListItem();
   425       ol.endIndexListItem();
   388     }
   426     }
   389   }
   427   }
   390   if (started) 
   428   if (started) 
   439 /*! Generates HTML Help tree of classes */
   477 /*! Generates HTML Help tree of classes */
   440 
   478 
   441 void writeClassTreeNode(ClassDef *cd,bool &started,int level)
   479 void writeClassTreeNode(ClassDef *cd,bool &started,int level)
   442 {
   480 {
   443   //printf("writeClassTreeNode(%s) visited=%d\n",cd->name().data(),cd->visited);
   481   //printf("writeClassTreeNode(%s) visited=%d\n",cd->name().data(),cd->visited);
       
   482   static bool vhdl=Config_getBool("OPTIMIZE_OUTPUT_VHDL");
       
   483 
   444   if (cd->isVisibleInHierarchy() && !cd->visited)
   484   if (cd->isVisibleInHierarchy() && !cd->visited)
   445   {
   485   {
   446     if (!started)
   486     if (!started)
   447     {
   487     {
   448       started=TRUE;
   488       started=TRUE;
   453     {
   493     {
   454       Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
   494       Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),0);
   455     }
   495     }
   456     if (hasChildren)
   496     if (hasChildren)
   457     {
   497     {
   458       writeClassTree(cd->subClasses(),level+1);
   498       if (vhdl)
       
   499       {
       
   500         writeClassTree(cd->baseClasses(),level+1);
       
   501       }
       
   502       else
       
   503       {
       
   504         writeClassTree(cd->subClasses(),level+1);
       
   505       }
   459     }
   506     }
   460     cd->visited=TRUE;
   507     cd->visited=TRUE;
   461   }
   508   }
   462 }
   509 }
   463 
   510 
   493 
   540 
   494 //----------------------------------------------------------------------------
   541 //----------------------------------------------------------------------------
   495 
   542 
   496 static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FTVHelp* ftv)
   543 static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FTVHelp* ftv)
   497 {
   544 {
       
   545   static bool vhdl=Config_getBool("OPTIMIZE_OUTPUT_VHDL");
   498   ClassSDict::Iterator cli(*cl);
   546   ClassSDict::Iterator cli(*cl);
   499   for (;cli.current(); ++cli)
   547   for (;cli.current(); ++cli)
   500   {
   548   {
   501     ClassDef *cd=cli.current();
   549     ClassDef *cd=cli.current();
   502     //printf("class %s hasVisibleRoot=%d isVisibleInHierarchy=%d\n",
   550     //printf("class %s hasVisibleRoot=%d isVisibleInHierarchy=%d\n",
   503     //             cd->name().data(),
   551     //             cd->name().data(),
   504     //              hasVisibleRoot(cd->baseClasses()),
   552     //              hasVisibleRoot(cd->baseClasses()),
   505     //              cd->isVisibleInHierarchy()
   553     //              cd->isVisibleInHierarchy()
   506     //      );
   554     //      );
   507     if (!hasVisibleRoot(cd->baseClasses())) // filter on root classes
   555     bool b;
       
   556     if (vhdl)
       
   557     {
       
   558       if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS || 
       
   559           (VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKBODYCLASS)
       
   560       {
       
   561         continue;
       
   562       }
       
   563       b=!hasVisibleRoot(cd->subClasses());
       
   564     }
       
   565     else
       
   566     {
       
   567       b=!hasVisibleRoot(cd->baseClasses());
       
   568     }
       
   569 
       
   570     if (b)  //filter on root classes
   508     {
   571     {
   509       if (cd->isVisibleInHierarchy()) // should it be visible
   572       if (cd->isVisibleInHierarchy()) // should it be visible
   510       {
   573       {
   511         if (!started)
   574         if (!started)
   512         {
   575         {
   541           ol.endIndexItem(0,0);
   604           ol.endIndexItem(0,0);
   542           Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),0,0,0);
   605           Doxygen::indexList.addContentsItem(hasChildren,cd->displayName(),0,0,0);
   543           if (ftv)
   606           if (ftv)
   544             ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0); 
   607             ftv->addContentsItem(hasChildren,cd->displayName(),0,0,0); 
   545         }
   608         }
   546         if (hasChildren) 
   609         if (vhdl && hasChildren) 
       
   610         {
       
   611           writeClassTree(ol,cd->baseClasses(),cd->visited,1,ftv);
       
   612           cd->visited=TRUE;
       
   613         }
       
   614         else if (hasChildren)
   547         {
   615         {
   548           writeClassTree(ol,cd->subClasses(),cd->visited,1,ftv);
   616           writeClassTree(ol,cd->subClasses(),cd->visited,1,ftv);
   549           cd->visited=TRUE;
   617           cd->visited=TRUE;
   550         }
   618         }
   551         ol.endIndexListItem();
   619         ol.endIndexListItem();
   625   //{
   693   //{
   626   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   694   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   627   //}
   695   //}
   628   ol.parseText(title);
   696   ol.parseText(title);
   629   endTitle(ol,0,0);
   697   endTitle(ol,0,0);
       
   698   ol.startContents();
   630   ol.startTextBlock();
   699   ol.startTextBlock();
   631   Doxygen::indexList.addContentsItem(TRUE,title,0,"hierarchy",0); 
   700   Doxygen::indexList.addContentsItem(TRUE,title,0,"hierarchy",0); 
   632   if (Config_getBool("HAVE_DOT") && Config_getBool("GRAPHICAL_HIERARCHY"))
   701   if (Config_getBool("HAVE_DOT") && Config_getBool("GRAPHICAL_HIERARCHY"))
   633   {
   702   {
   634     ol.disable(OutputGenerator::Latex);
   703     ol.disable(OutputGenerator::Latex);
   678   //{
   747   //{
   679   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   748   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   680   //}
   749   //}
   681   ol.parseText(title);
   750   ol.parseText(title);
   682   endTitle(ol,0,0);
   751   endTitle(ol,0,0);
       
   752   ol.startContents();
   683   ol.startTextBlock();
   753   ol.startTextBlock();
   684   Doxygen::indexList.addContentsItem(FALSE,theTranslator->trGraphicalHierarchy(),0,"inherits",0); 
   754   Doxygen::indexList.addContentsItem(FALSE,theTranslator->trGraphicalHierarchy(),0,"inherits",0); 
   685   ol.startParagraph();
   755   ol.startParagraph();
   686   ol.startTextLink("hierarchy",0);
   756   ol.startTextLink("hierarchy",0);
   687   ol.parseText(theTranslator->trGotoTextualHierarchy());
   757   ol.parseText(theTranslator->trGotoTextualHierarchy());
   743   //{
   813   //{
   744   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   814   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
   745   //}
   815   //}
   746   ol.parseText(title);
   816   ol.parseText(title);
   747   endTitle(ol,0,0);
   817   endTitle(ol,0,0);
       
   818   ol.startContents();
   748   ol.startTextBlock();
   819   ol.startTextBlock();
   749   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trFileList(),0,"files",0); 
   820   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trFileList(),0,"files",0); 
   750   Doxygen::indexList.incContentsDepth();
   821   Doxygen::indexList.incContentsDepth();
   751   ol.parseText(theTranslator->trFileListDescription(Config_getBool("EXTRACT_ALL")));
   822   ol.parseText(theTranslator->trFileListDescription(Config_getBool("EXTRACT_ALL")));
   752   ol.endTextBlock();
   823   ol.endTextBlock();
   928   //{
   999   //{
   929   //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
  1000   //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
   930   //}
  1001   //}
   931   ol.parseText(longTitle);
  1002   ol.parseText(longTitle);
   932   endTitle(ol,0,0);
  1003   endTitle(ol,0,0);
       
  1004   ol.startContents();
   933   ol.startTextBlock();
  1005   ol.startTextBlock();
   934   Doxygen::indexList.addContentsItem(TRUE,title,0,"namespaces",0); 
  1006   Doxygen::indexList.addContentsItem(TRUE,title,0,"namespaces",0); 
   935   Doxygen::indexList.incContentsDepth();
  1007   Doxygen::indexList.incContentsDepth();
   936   //ol.newParagraph();
  1008   //ol.newParagraph();
   937   if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
  1009   if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
  1071   {
  1143   {
  1072     if (cd->isLinkableInProject() && cd->templateMaster()==0)
  1144     if (cd->isLinkableInProject() && cd->templateMaster()==0)
  1073     {
  1145     {
  1074       QCString type=cd->compoundTypeString();
  1146       QCString type=cd->compoundTypeString();
  1075       ol.startIndexKey();
  1147       ol.startIndexKey();
       
  1148       static bool vhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
       
  1149       if (vhdl)
       
  1150       {
       
  1151         QCString prot= VhdlDocGen::getProtectionName((VhdlDocGen::VhdlClasses)cd->protection());
       
  1152         ol.docify(prot.data());
       
  1153         ol.insertMemberAlign();
       
  1154       }
  1076       ol.writeObjectLink(0,cd->getOutputFileBase(),0,cd->displayName());
  1155       ol.writeObjectLink(0,cd->getOutputFileBase(),0,cd->displayName());
  1077       ol.endIndexKey();
  1156       ol.endIndexKey();
  1078       bool hasBrief = !cd->briefDescription().isEmpty();
  1157       bool hasBrief = !cd->briefDescription().isEmpty();
  1079       ol.startIndexValue(hasBrief);
  1158       ol.startIndexValue(hasBrief);
  1080       if (hasBrief)
  1159       if (hasBrief)
  1201   for (cli.toFirst();(cd=cli.current());++cli)
  1280   for (cli.toFirst();(cd=cli.current());++cli)
  1202   {
  1281   {
  1203     if (cd->isLinkableInProject() && cd->templateMaster()==0)
  1282     if (cd->isLinkableInProject() && cd->templateMaster()==0)
  1204     {
  1283     {
  1205       int index = getPrefixIndex(cd->className());
  1284       int index = getPrefixIndex(cd->className());
  1206       startLetter=toupper(cd->className().at(index));
  1285       startLetter=toupper(cd->className().at(index))&0xFF;
  1207       // Do some sorting again, since the classes are sorted by name with 
  1286       // Do some sorting again, since the classes are sorted by name with 
  1208       // prefix, which should be ignored really.
  1287       // prefix, which should be ignored really.
  1209       classesByLetter[startLetter].inSort (cd);
  1288       classesByLetter[startLetter].inSort (cd);
  1210     }
  1289     }
  1211   }
  1290   }
  1362                (fortranOpt ? theTranslator->trCompoundIndexFortran() :
  1441                (fortranOpt ? theTranslator->trCompoundIndexFortran() :
  1363                 vhdlOpt    ? VhdlDocGen::trDesignUnitIndex()             :
  1442                 vhdlOpt    ? VhdlDocGen::trDesignUnitIndex()             :
  1364                              theTranslator->trCompoundIndex()
  1443                              theTranslator->trCompoundIndex()
  1365                ));
  1444                ));
  1366   endTitle(ol,0,0);
  1445   endTitle(ol,0,0);
       
  1446   ol.startContents();
  1367   writeAlphabeticalClassList(ol);
  1447   writeAlphabeticalClassList(ol);
  1368   endFile(ol);
  1448   endFile(ol);
  1369   ol.popGeneratorState();
  1449   ol.popGeneratorState();
  1370 }
  1450 }
  1371 
  1451 
  1389   //{
  1469   //{
  1390   //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
  1470   //  longTitle.prepend(Config_getString("PROJECT_NAME")+" ");
  1391   //}
  1471   //}
  1392   ol.parseText(longTitle);
  1472   ol.parseText(longTitle);
  1393   endTitle(ol,0,0);
  1473   endTitle(ol,0,0);
       
  1474   ol.startContents();
  1394   ol.startTextBlock();
  1475   ol.startTextBlock();
  1395   Doxygen::indexList.addContentsItem(TRUE,title,0,"annotated",0); 
  1476   Doxygen::indexList.addContentsItem(TRUE,title,0,"annotated",0); 
  1396   Doxygen::indexList.incContentsDepth();
  1477   Doxygen::indexList.incContentsDepth();
  1397   QCString desc = fortranOpt ? theTranslator->trCompoundListDescriptionFortran() :
  1478   QCString desc = fortranOpt ? theTranslator->trCompoundListDescriptionFortran() :
  1398                   vhdlOpt    ? VhdlDocGen::trDesignUnitListDescription()             :
  1479                   vhdlOpt    ? VhdlDocGen::trDesignUnitListDescription()             :
  1763     MemberIndexList charUsed[MEMBER_INDEX_ENTRIES],int page,
  1844     MemberIndexList charUsed[MEMBER_INDEX_ENTRIES],int page,
  1764     QCString fullName,bool multiPage)
  1845     QCString fullName,bool multiPage)
  1765 {
  1846 {
  1766   bool first=TRUE;
  1847   bool first=TRUE;
  1767   int i;
  1848   int i;
  1768   startQuickIndexList(ol);
  1849   startQuickIndexList(ol,TRUE);
  1769   for (i=33;i<127;i++)
  1850   for (i=33;i<127;i++)
  1770   {
  1851   {
  1771     char is[2];is[0]=(char)i;is[1]='\0';
  1852     char is[2];is[0]=(char)i;is[1]='\0';
  1772     if (charUsed[i].count()>0)
  1853     if (charUsed[i].count()>0)
  1773     {
  1854     {
  2522         fileName.prepend(searchDirName);
  2603         fileName.prepend(searchDirName);
  2523         QFile outFile(fileName);
  2604         QFile outFile(fileName);
  2524         if (outFile.open(IO_WriteOnly))
  2605         if (outFile.open(IO_WriteOnly))
  2525         {
  2606         {
  2526           QTextStream t(&outFile);
  2607           QTextStream t(&outFile);
       
  2608           t.setEncoding(QTextStream::UnicodeUTF8);
  2527           t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
  2609           t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""
  2528                " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
  2610                " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
  2529           t << "<html><head><title></title>" << endl;
  2611           t << "<html><head><title></title>" << endl;
  2530           t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
  2612           t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
  2531           t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
  2613           t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
  2558                 << "onkeyup=\""
  2640                 << "onkeyup=\""
  2559                 << "return searchResults.Nav(event," << itemCount << ")\" "
  2641                 << "return searchResults.Nav(event," << itemCount << ")\" "
  2560                 << "class=\"SRSymbol\" ";
  2642                 << "class=\"SRSymbol\" ";
  2561               if (!d->getReference().isEmpty())
  2643               if (!d->getReference().isEmpty())
  2562               {
  2644               {
  2563                 QCString *dest;
  2645                 QCString *dest = Doxygen::tagDestinationDict[d->getReference()];
  2564                 t << "doxygen=\"" << d->getReference() << ":../";
  2646                 if (dest && *dest=='.') // relative path (see bug 593679)
  2565                 if ((dest=Doxygen::tagDestinationDict[d->getReference()])) t << *dest << "/";
  2647                 {
  2566                 t << "\" ";
  2648                   t << "doxygen=\"" << d->getReference() << ":../"
  2567                 t << "href=\"../";
  2649                     << *dest << "/\" href=\"../" << *dest << "/";
  2568                 if ((dest=Doxygen::tagDestinationDict[d->getReference()])) t << *dest << "/";
  2650                 }
       
  2651                 else if (dest) // absolute path
       
  2652                 {
       
  2653                   t << "doxygen=\"" << d->getReference() << ":"
       
  2654                     << *dest << "/\" href=\"" << *dest << "/";
       
  2655                 }
  2569               }
  2656               }
  2570               else
  2657               else
  2571               {
  2658               {
  2572                 t << "href=\"../";
  2659                 t << "href=\"../";
  2573               }
  2660               }
  2759   {
  2846   {
  2760     QFile f(searchDirName+"/search.js");
  2847     QFile f(searchDirName+"/search.js");
  2761     if (f.open(IO_WriteOnly))
  2848     if (f.open(IO_WriteOnly))
  2762     {
  2849     {
  2763       QTextStream t(&f);
  2850       QTextStream t(&f);
       
  2851       t.setEncoding(QTextStream::UnicodeUTF8);
  2764       t << "// Search script generated by doxygen" << endl;
  2852       t << "// Search script generated by doxygen" << endl;
  2765       t << "// Copyright (C) 2009 by Dimitri van Heesch." << endl << endl;
  2853       t << "// Copyright (C) 2009 by Dimitri van Heesch." << endl << endl;
  2766       t << "// The code in this file is loosly based on main.js, part of Natural Docs," << endl;
  2854       t << "// The code in this file is loosly based on main.js, part of Natural Docs," << endl;
  2767       t << "// which is Copyright (C) 2003-2008 Greg Valure" << endl;
  2855       t << "// which is Copyright (C) 2003-2008 Greg Valure" << endl;
  2768       t << "// Natural Docs is licensed under the GPL." << endl << endl;
  2856       t << "// Natural Docs is licensed under the GPL." << endl << endl;
  2809   {
  2897   {
  2810     QFile f(searchDirName+"/nomatches.html");
  2898     QFile f(searchDirName+"/nomatches.html");
  2811     if (f.open(IO_WriteOnly))
  2899     if (f.open(IO_WriteOnly))
  2812     {
  2900     {
  2813       QTextStream t(&f);
  2901       QTextStream t(&f);
       
  2902       t.setEncoding(QTextStream::UnicodeUTF8);
  2814       t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
  2903       t << "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
  2815            "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
  2904            "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" << endl;
  2816       t << "<html><head><title></title>" << endl;
  2905       t << "<html><head><title></title>" << endl;
  2817       t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
  2906       t << "<meta http-equiv=\"Content-Type\" content=\"text/xhtml;charset=UTF-8\"/>" << endl;
  2818       t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
  2907       t << "<link rel=\"stylesheet\" type=\"text/css\" href=\"search.css\"/>" << endl;
  2828     }
  2917     }
  2829   }
  2918   }
  2830   Doxygen::indexList.addStyleSheetFile("search/search.js");
  2919   Doxygen::indexList.addStyleSheetFile("search/search.js");
  2831 }
  2920 }
  2832 
  2921 
  2833 void writeSearchStyleSheet()
       
  2834 {
       
  2835   QCString searchDirName = Config_getString("HTML_OUTPUT")+"/search";
       
  2836   QFile f(searchDirName+"/search.css");
       
  2837   if (f.open(IO_WriteOnly))
       
  2838   {
       
  2839     QTextStream t(&f);
       
  2840     t << search_styleSheet;
       
  2841   }
       
  2842   Doxygen::indexList.addStyleSheetFile("search/search.css");
       
  2843 }
       
  2844 
       
  2845 void writeSearchCategories(QTextStream &t)
  2922 void writeSearchCategories(QTextStream &t)
  2846 {
  2923 {
  2847   static SearchIndexCategoryMapping map;
  2924   static SearchIndexCategoryMapping map;
  2848   int i,j=0;
  2925   int i,j=0;
  2849   for (i=0;i<NUM_SEARCH_INDICES;i++)
  2926   for (i=0;i<NUM_SEARCH_INDICES;i++)
  2874   //{
  2951   //{
  2875   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  2952   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  2876   //}
  2953   //}
  2877   ol.parseText(title);
  2954   ol.parseText(title);
  2878   endTitle(ol,0,0);
  2955   endTitle(ol,0,0);
       
  2956   ol.startContents();
  2879   ol.startTextBlock();
  2957   ol.startTextBlock();
  2880   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trExamples(),0,"examples",0); 
  2958   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trExamples(),0,"examples",0); 
  2881   Doxygen::indexList.incContentsDepth();
  2959   Doxygen::indexList.incContentsDepth();
  2882   ol.parseText(theTranslator->trExamplesDescription());
  2960   ol.parseText(theTranslator->trExamplesDescription());
  2883   //ol.newParagraph();
  2961   //ol.newParagraph();
  2971   //{
  3049   //{
  2972   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  3050   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  2973   //}
  3051   //}
  2974   ol.parseText(title);
  3052   ol.parseText(title);
  2975   endTitle(ol,0,0);
  3053   endTitle(ol,0,0);
       
  3054   ol.startContents();
  2976   ol.startTextBlock();
  3055   ol.startTextBlock();
  2977   //Doxygen::indexList.addContentsItem(TRUE,theTranslator->trRelatedPages(),0,"pages",0); 
  3056   //Doxygen::indexList.addContentsItem(TRUE,theTranslator->trRelatedPages(),0,"pages",0); 
  2978   //Doxygen::indexList.incContentsDepth();
  3057   //Doxygen::indexList.incContentsDepth();
  2979   ol.parseText(theTranslator->trRelatedPagesDescription());
  3058   ol.parseText(theTranslator->trRelatedPagesDescription());
  2980   ol.endTextBlock();
  3059   ol.endTextBlock();
  3063   generateGraphLegend(Config_getString("HTML_OUTPUT"));
  3142   generateGraphLegend(Config_getString("HTML_OUTPUT"));
  3064   startFile(ol,"graph_legend",0,theTranslator->trLegendTitle().data());
  3143   startFile(ol,"graph_legend",0,theTranslator->trLegendTitle().data());
  3065   startTitle(ol,0);
  3144   startTitle(ol,0);
  3066   ol.parseText(theTranslator->trLegendTitle());
  3145   ol.parseText(theTranslator->trLegendTitle());
  3067   endTitle(ol,0,0);
  3146   endTitle(ol,0,0);
  3068   bool oldStripCommentsState = Config_getBool("STRIP_CODE_COMMENTS");
  3147   ol.startContents();
       
  3148   bool &stripCommentsStateRef = Config_getBool("STRIP_CODE_COMMENTS");
       
  3149   bool oldStripCommentsState = stripCommentsStateRef;
  3069   // temporarily disable the stripping of comments for our own code example!
  3150   // temporarily disable the stripping of comments for our own code example!
  3070   Config_getBool("STRIP_CODE_COMMENTS") = FALSE;
  3151   stripCommentsStateRef = FALSE;
  3071   ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE,FALSE);
  3152   ol.parseDoc("graph_legend",1,0,0,theTranslator->trLegendDocs(),FALSE,FALSE);
  3072   Config_getBool("STRIP_CODE_COMMENTS") = oldStripCommentsState;
  3153   stripCommentsStateRef = oldStripCommentsState;
  3073   endFile(ol);
  3154   endFile(ol);
  3074   ol.popGeneratorState();
  3155   ol.popGeneratorState();
  3075 }
  3156 }
  3076 
  3157 
  3077 void writeGroupIndexItem(GroupDef *gd,MemberList *ml,const QCString &title)
  3158 void writeGroupIndexItem(GroupDef *gd,MemberList *ml,const QCString &title)
  3171       ol.startTypewriter(); 
  3252       ol.startTypewriter(); 
  3172       ol.docify(" [external]");
  3253       ol.docify(" [external]");
  3173       ol.endTypewriter();
  3254       ol.endTypewriter();
  3174     }
  3255     }
  3175     
  3256     
  3176     //ol.writeStartAnnoItem(0,gd->getOutputFileBase(),0,gd-);
  3257     
  3177     //parseText(ol,gd->groupTitle());
       
  3178     //ol.writeEndAnnoItem(gd->getOutputFileBase());
       
  3179 
       
  3180     // write pages
  3258     // write pages
  3181     PageSDict::Iterator pli(*gd->pageDict);
  3259     PageSDict::Iterator pli(*gd->pageDict);
  3182     PageDef *pd = 0;
  3260     PageDef *pd = 0;
  3183     for (pli.toFirst();(pd=pli.current());++pli)
  3261     for (pli.toFirst();(pd=pli.current());++pli)
  3184     {
  3262     {
  3323   {
  3401   {
  3324     writeGroupTreeNode(ol,gd,0,ftv);
  3402     writeGroupTreeNode(ol,gd,0,ftv);
  3325   }
  3403   }
  3326   endIndexHierarchy(ol,0); 
  3404   endIndexHierarchy(ol,0); 
  3327   if (ftv)
  3405   if (ftv)
       
  3406   {
  3328     ol.popGeneratorState(); 
  3407     ol.popGeneratorState(); 
       
  3408   }
  3329 }
  3409 }
  3330 
  3410 
  3331 //----------------------------------------------------------------------------
  3411 //----------------------------------------------------------------------------
  3332 void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv)
  3412 void writeDirTreeNode(OutputList &ol, DirDef *dd, int level, FTVHelp* ftv)
  3333 {
  3413 {
  3432   //{
  3512   //{
  3433   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  3513   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  3434   //}
  3514   //}
  3435   ol.parseText(title);
  3515   ol.parseText(title);
  3436   endTitle(ol,0,0);
  3516   endTitle(ol,0,0);
       
  3517   ol.startContents();
  3437   ol.startTextBlock();
  3518   ol.startTextBlock();
  3438   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trModules(),0,"modules",0); 
  3519   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trModules(),0,"modules",0); 
  3439   Doxygen::indexList.incContentsDepth();
  3520   Doxygen::indexList.incContentsDepth();
  3440   ol.parseText(theTranslator->trModulesDescription());
  3521   ol.parseText(theTranslator->trModulesDescription());
  3441   ol.endTextBlock();
  3522   ol.endTextBlock();
  3442 
  3523 
  3443   FTVHelp* ftv = 0;
  3524   FTVHelp* ftv = 0;
  3444   bool treeView=Config_getBool("USE_INLINE_TREES");
  3525   bool treeView=Config_getBool("USE_INLINE_TREES");
  3445   if (treeView)
  3526   if (treeView)
       
  3527   {
  3446     ftv = new FTVHelp(false);
  3528     ftv = new FTVHelp(false);
       
  3529   }
  3447 
  3530 
  3448   writeGroupHierarchy(ol,ftv);
  3531   writeGroupHierarchy(ol,ftv);
  3449 
  3532 
  3450   Doxygen::indexList.decContentsDepth();
  3533   Doxygen::indexList.decContentsDepth();
  3451   if (ftv)
  3534   if (ftv)
  3476   //{
  3559   //{
  3477   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  3560   //  title.prepend(Config_getString("PROJECT_NAME")+" ");
  3478   //}
  3561   //}
  3479   ol.parseText(title);
  3562   ol.parseText(title);
  3480   endTitle(ol,0,0);
  3563   endTitle(ol,0,0);
       
  3564   ol.startContents();
  3481   ol.startTextBlock();
  3565   ol.startTextBlock();
  3482   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trDirIndex(),0,"dirs",0); 
  3566   Doxygen::indexList.addContentsItem(TRUE,theTranslator->trDirIndex(),0,"dirs",0); 
  3483   Doxygen::indexList.incContentsDepth();
  3567   Doxygen::indexList.incContentsDepth();
  3484   ol.parseText(theTranslator->trDirDescription());
  3568   ol.parseText(theTranslator->trDirDescription());
  3485   ol.endTextBlock();
  3569   ol.endTextBlock();
  3568   {
  3652   {
  3569     ol.startQuickIndices();
  3653     ol.startQuickIndices();
  3570     ol.writeQuickLinks(TRUE,HLI_Main);
  3654     ol.writeQuickLinks(TRUE,HLI_Main);
  3571     ol.endQuickIndices();
  3655     ol.endQuickIndices();
  3572   }
  3656   }
  3573   ol.startContents();
  3657   bool headerWritten=FALSE;
  3574   ol.startTitleHead(0);
       
  3575   if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty())
  3658   if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty())
  3576   {
  3659   {
  3577     if (Doxygen::mainPage->title().lower()!="notitle")
  3660     if (Doxygen::mainPage->title().lower()!="notitle")
  3578     {
  3661     {
       
  3662       ol.startHeaderSection();
       
  3663       ol.startTitleHead(0);
  3579       ol.parseDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->docLine(),
  3664       ol.parseDoc(Doxygen::mainPage->docFile(),Doxygen::mainPage->docLine(),
  3580                   Doxygen::mainPage,0,Doxygen::mainPage->title(),
  3665                   Doxygen::mainPage,0,Doxygen::mainPage->title(),
  3581                   TRUE,FALSE,0,TRUE,FALSE);
  3666                   TRUE,FALSE,0,TRUE,FALSE);
       
  3667       headerWritten = TRUE;
  3582     }
  3668     }
  3583   }
  3669   }
  3584   else
  3670   else
  3585   {
  3671   {
  3586     if (!Config_getString("PROJECT_NAME").isEmpty())
  3672     if (!Config_getString("PROJECT_NAME").isEmpty())
  3587     {
  3673     {
       
  3674       ol.startHeaderSection();
       
  3675       ol.startTitleHead(0);
  3588       ol.parseText(projPrefix+theTranslator->trDocumentation());
  3676       ol.parseText(projPrefix+theTranslator->trDocumentation());
  3589     }
  3677       headerWritten = TRUE;
  3590   }
  3678     }
  3591   ol.endTitleHead(0,0);
  3679   }
       
  3680   if (headerWritten)
       
  3681   {
       
  3682     ol.endTitleHead(0,0);
       
  3683     ol.endHeaderSection();
       
  3684   }
       
  3685   ol.startContents();
  3592   // ol.newParagraph(); // FIXME:PARA
  3686   // ol.newParagraph(); // FIXME:PARA
  3593   if (!Config_getString("PROJECT_NUMBER").isEmpty())
  3687   if (!Config_getString("PROJECT_NUMBER").isEmpty())
  3594   {
  3688   {
  3595     ol.startProjectNumber();
  3689     ol.startProjectNumber();
  3596     ol.parseDoc(defFileName,defLine,
  3690     ol.parseDoc(defFileName,defLine,
  3810   if (Doxygen::mainPage)
  3904   if (Doxygen::mainPage)
  3811   {
  3905   {
  3812     Doxygen::insideMainPage=TRUE;
  3906     Doxygen::insideMainPage=TRUE;
  3813     ol.disable(OutputGenerator::Man);
  3907     ol.disable(OutputGenerator::Man);
  3814     startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title());
  3908     startFile(ol,Doxygen::mainPage->name(),0,Doxygen::mainPage->title());
       
  3909     ol.startContents();
  3815     ol.startTextBlock();
  3910     ol.startTextBlock();
  3816     ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,
  3911     ol.parseDoc(defFileName,defLine,Doxygen::mainPage,0,
  3817                 Doxygen::mainPage->documentation(),FALSE,FALSE
  3912                 Doxygen::mainPage->documentation(),FALSE,FALSE
  3818                );
  3913                );
  3819     ol.endTextBlock();
  3914     ol.endTextBlock();