Пример #1
0
Image::Image(int w,int h)
{
  static int hue   = Config_getInt("HTML_COLORSTYLE_HUE");
  static int sat   = Config_getInt("HTML_COLORSTYLE_SAT");
  static int gamma = Config_getInt("HTML_COLORSTYLE_GAMMA");

  double red1,green1,blue1;
  double red2,green2,blue2;

  ColoredImage::hsl2rgb(hue/360.0,                  // hue
                        sat/255.0,                  // saturation
                        pow(235/255.0,gamma/100.0), // luma (gamma corrected)
                        &red1,&green1,&blue1
                       );

  ColoredImage::hsl2rgb(hue/360.0,                  // hue
                        sat/255.0,                  // saturation
                        pow(138/255.0,gamma/100.0), // luma (gamma corrected)
                        &red2,&green2,&blue2
                       );

  palette[2].red   = (int)(red1   * 255.0);
  palette[2].green = (int)(green1 * 255.0);
  palette[2].blue  = (int)(blue1  * 255.0);

  palette[3].red   = (int)(red2   * 255.0);
  palette[3].green = (int)(green2 * 255.0);
  palette[3].blue  = (int)(blue2  * 255.0);

  data = new uchar[w*h];
  memset(data,0,w*h);
  width = w;
  height = h;
}
Пример #2
0
void ManGenerator::codify(const char *str)
{
  //static char spaces[]="        ";
  if (str)
  {
    const char *p=str;
    char c;
    int spacesToNextTabStop;
    while (*p)
    {
      c=*p++;
      switch(c)
      {
        case '.':   t << "\\&."; break; // see  bug652277
        case '\t':  spacesToNextTabStop =
                          Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE"));
                    t << Doxygen::spaces.left(spacesToNextTabStop); 
                    col+=spacesToNextTabStop; 
                    break;
        case '\n':  t << "\n"; firstCol=TRUE; col=0; break;
        case '\\':  t << "\\"; col++; break;
        case '\"':  // no break!
        default:    p=writeUtf8Char(t,p-1); firstCol=FALSE; col++; break;
      }
    }
    //printf("%s",str);fflush(stdout);
  }
  paragraph=FALSE;
}
Пример #3
0
void HtmlGenerator::codify(const char *str)
{
  //docify(str);
  //static char spaces[]="        ";
  if (str)
  { 
    const char *p=str;
    char c;
    int spacesToNextTabStop;
    while (*p)
    {
      c=*p++;
      switch(c)
      {
        case '\t': spacesToNextTabStop = 
                         Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE")); 
                   t << spaces.left(spacesToNextTabStop); 
                   col+=spacesToNextTabStop; 
                   break; 
        case '\n': t << "\n"; col=0; 
                   break;
        //case '\n': t << "<br>"; col=0; 
        //           break;
        case '\r': break;
        case '<':  t << "&lt;"; col++; 
                   break;
        case '>':  t << "&gt;"; col++; 
                   break;
        case '&':  t << "&amp;"; col++; 
                   break;
        //case ' ':  t << "&nbsp;"; col++;
        //           break;
        case '\\':
                   if (*p=='<')
                     { t << "&lt;"; p++; }
                   else if (*p=='>')
                     { t << "&gt;"; p++; }
                   else
                     t << "\\";
                   col++;
                   break;
        default:   t << c;    
                   col++;                    
                   break;
      }
    }
  }
}
Пример #4
0
static QCString detab(const QCString &s)
{
  static int tabSize = Config_getInt(TAB_SIZE);
  GrowBuf out;
  int size = s.length();
  const char *data = s.data();
  int i=0;
  int col=0;
  const int maxIndent=1000000; // value representing infinity
  int minIndent=maxIndent;
  while (i<size)
  {
    char c = data[i++];
    switch(c)
    {
      case '\t': // expand tab
        {
          int stop = tabSize - (col%tabSize);
          //printf("expand at %d stop=%d\n",col,stop);
          col+=stop;
          while (stop--) out.addChar(' '); 
        }
        break;
      case '\n': // reset colomn counter
        out.addChar(c);
        col=0;
        break;
      case ' ': // increment column counter
        out.addChar(c);
        col++;
        break;
      default: // non-whitespace => update minIndent
        out.addChar(c);
        if (c<0 && i<size) // multibyte sequence
        {
          out.addChar(data[i++]); // >= 2 bytes
          if (((uchar)c&0xE0)==0xE0 && i<size)
          {
            out.addChar(data[i++]); // 3 bytes
          }
          if (((uchar)c&0xF0)==0xF0 && i<size)
          {
            out.addChar(data[i++]); // 4 byres
          }
        }
        if (col<minIndent) minIndent=col;
        col++;
    }
  }
  out.addChar(0);
  //printf("detab refIndent=%d\n",refIndent);
  return out.get();
}
SWIGEXPORT jint JNICALL Java_com_omtinez_pocketsphinx_pocketsphinxJNI_Config_1getInt(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
  jint jresult = 0 ;
  Config *arg1 = (Config *) 0 ;
  char *arg2 = (char *) 0 ;
  int result;
  
  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(Config **)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg2, 0);
    if (!arg2) return 0;
  }
  result = (int)Config_getInt(arg1,(char const *)arg2);
  jresult = (jint)result; 
  if (arg2) (*jenv)->ReleaseStringUTFChars(jenv, jarg2, (const char *)arg2);
  return jresult;
}
Пример #6
0
// write tree inside page
void FTVHelp::generateTreeViewInline(FTextStream &t)
{
    int preferredNumEntries = Config_getInt("HTML_INDEX_NUM_ENTRIES");
    t << "<div class=\"directory\">\n";
    QListIterator<FTVNode> li(m_indentNodes[0]);
    FTVNode *n;
    int d=1, depth=1;
    for (; (n=li.current()); ++li)
    {
        if (n->children.count()>0)
        {
            d = n->computeTreeDepth(2);
            if (d>depth) depth=d;
        }
    }
    int preferredDepth = depth;
    // write level selector
    if (depth>1)
    {
        t << "<div class=\"levels\">[";
        t << theTranslator->trDetailLevel();
        t << " ";
        int i;
        for (i=1; i<=depth; i++)
        {
            t << "<span onclick=\"javascript:toggleLevel(" << i << ");\">" << i << "</span>";
        }
        t << "]</div>";

        if (preferredNumEntries>0)
        {
            preferredDepth=1;
            for (int i=1; i<=depth; i++)
            {
                int num=0;
                QListIterator<FTVNode> li(m_indentNodes[0]);
                FTVNode *n;
                for (; (n=li.current()); ++li)
                {
                    num+=n->numNodesAtLevel(0,i);
                }
                if (num<=preferredNumEntries)
                {
                    preferredDepth=i;
                }
                else
                {
                    break;
                }
            }
        }
    }
    //printf("preferred depth=%d\n",preferredDepth);

    t << "<table class=\"directory\">\n";
    int index=0;
    generateTree(t,m_indentNodes[0],0,preferredDepth,index);
    t << "</table>\n";

    t << "</div><!-- directory -->\n";
}
Пример #7
0
void generateDEFForClass(ClassDef *cd,QTextStream &t)
{
  // + brief description
  // + detailed description
  // - template arguments
  // - include files
  // + inheritance diagram
  // + list of direct super classes
  // + list of direct sub classes
  // + collaboration diagram
  // - list of all members
  // + user defined member sections
  // + standard member sections
  // + detailed member documentation
  // - examples

  if (cd->isReference()) return; // skip external references.
  if (cd->name().find('@')!=-1) return; // skip anonymous compounds.
  if (cd->templateMaster()!=0) return; // skip generated template instances.

  t << cd->compoundTypeString() << " = {" << endl;
  t << "  cp-id     = '" << cd->getOutputFileBase() << "';" << endl;
  t << "  cp-name   = '" << cd->name() << "';" << endl;

  if (cd->baseClasses()->count()>0)
  {
    BaseClassListIterator bcli(*cd->baseClasses());
    BaseClassDef *bcd;
    for (bcli.toFirst();(bcd=bcli.current());++bcli)
    {
      t << "  cp-ref     = {" << endl << "    ref-type = base;" << endl;
      t << "    ref-id   = '"
        << bcd->classDef->getOutputFileBase() << "';" << endl;
      t << "    ref-prot = ";
      switch (bcd->prot)
      {
        case Public:    t << "public;"    << endl; break;
        case Package: // package scope is not possible
        case Protected: t << "protected;" << endl; break;
        case Private:   t << "private;"   << endl; break;
      }
      t << "    ref-virt = ";
      switch(bcd->virt)
      {
        case Normal:  t << "non-virtual;";  break;
        case Virtual: t << "virtual;";      break;
        case Pure:    t << "pure-virtual;"; break;
      }
      t << endl << "  };" << endl;
    }
  }

  if (cd->subClasses()->count()>0)
  {
    BaseClassListIterator bcli(*cd->subClasses());
    BaseClassDef *bcd;
    for (bcli.toFirst();(bcd=bcli.current());++bcli)
    {
      t << "  cp-ref     = {" << endl << "    ref-type = derived;" << endl;
      t << "    ref-id   = '"
        << bcd->classDef->getOutputFileBase() << "';" << endl;
      t << "    ref-prot = ";
      switch (bcd->prot)
      {
        case Public:    t << "public;"    << endl; break;
        case Package: // packet scope is not possible!
        case Protected: t << "protected;" << endl; break;
        case Private:   t << "private;"   << endl; break;
      }
      t << "    ref-virt = ";
      switch(bcd->virt)
      {
        case Normal:  t << "non-virtual;";  break;
        case Virtual: t << "virtual;";      break;
        case Pure:    t << "pure-virtual;"; break;
      }
      t << endl << "  };" << endl;
    }
  }

  int numMembers = 
    cd->pubTypes.count()+cd->pubMethods.count()+cd->pubAttribs.count()+
    cd->pubSlots.count()+cd->signals.count()+cd->dcopMethods.count()+
    cd->pubStaticMethods.count()+
    cd->pubStaticAttribs.count()+cd->proTypes.count()+cd->proMethods.count()+
    cd->proAttribs.count()+cd->proSlots.count()+cd->proStaticMethods.count()+
    cd->proStaticAttribs.count()+cd->priTypes.count()+cd->priMethods.count()+
    cd->priAttribs.count()+cd->priSlots.count()+cd->priStaticMethods.count()+
    cd->priStaticAttribs.count()+cd->friends.count()+cd->related.count();
  if (numMembers>0)
  {
    generateDEFClassSection(cd,t,&cd->pubTypes,"public-type");
    generateDEFClassSection(cd,t,&cd->pubMethods,"public-func");
    generateDEFClassSection(cd,t,&cd->pubAttribs,"public-attrib");
    generateDEFClassSection(cd,t,&cd->pubSlots,"public-slot");
    generateDEFClassSection(cd,t,&cd->signals,"signal");
    generateDEFClassSection(cd,t,&cd->dcopMethods,"dcop-func");
    generateDEFClassSection(cd,t,&cd->properties,"property");
    generateDEFClassSection(cd,t,&cd->pubStaticMethods,"public-static-func");
    generateDEFClassSection(cd,t,&cd->pubStaticAttribs,"public-static-attrib");
    generateDEFClassSection(cd,t,&cd->proTypes,"protected-type");
    generateDEFClassSection(cd,t,&cd->proMethods,"protected-func");
    generateDEFClassSection(cd,t,&cd->proAttribs,"protected-attrib");
    generateDEFClassSection(cd,t,&cd->proSlots,"protected-slot");
    generateDEFClassSection(cd,t,&cd->proStaticMethods,"protected-static-func");
    generateDEFClassSection(cd,t,&cd->proStaticAttribs,"protected-static-attrib");
    generateDEFClassSection(cd,t,&cd->priTypes,"private-type");
    generateDEFClassSection(cd,t,&cd->priMethods,"private-func");
    generateDEFClassSection(cd,t,&cd->priAttribs,"private-attrib");
    generateDEFClassSection(cd,t,&cd->priSlots,"private-slot");
    generateDEFClassSection(cd,t,&cd->priStaticMethods,"private-static-func");
    generateDEFClassSection(cd,t,&cd->priStaticAttribs,"private-static-attrib");
    generateDEFClassSection(cd,t,&cd->friends,"signal");
    generateDEFClassSection(cd,t,&cd->related,"related");
  }

  t << "  cp-filename  = '" << cd->getDefFileName() << "';" << endl;
  t << "  cp-fileline  = '" << cd->getDefLine()     << "';" << endl;
  t << "  cp-briefdesc = <<_EnD_oF_dEf_TeXt_" << endl
    << cd->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;

  t << "  cp-documentation = <<_EnD_oF_dEf_TeXt_" << endl
    << cd->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;

  DotClassGraph inheritanceGraph(cd,DotNode::Inheritance,
                                 Config_getInt("MAX_DOT_GRAPH_DEPTH"));
  if (!inheritanceGraph.isTrivial())
  {
    t << "  cp-inheritancegraph = <<_EnD_oF_dEf_TeXt_" << endl;
    inheritanceGraph.writeDEF(t);
    t << endl << "_EnD_oF_dEf_TeXt_;" << endl;
  }
  DotClassGraph collaborationGraph(cd,DotNode::Collaboration,
                                 Config_getInt("MAX_DOT_GRAPH_DEPTH"));
  if (!collaborationGraph.isTrivial())
  {
    t << "  cp-collaborationgraph = <<_EnD_oF_dEf_TeXt_" << endl;
    collaborationGraph.writeDEF(t);
    t << endl << "_EnD_oF_dEf_TeXt_;" << endl;
  }
  t << "}; /* " <<  cd->compoundTypeString() << " */" << endl;
}
Пример #8
0
/*! Reads a fragment of code from file \a fileName starting at 
 * line \a startLine and ending at line \a endLine (inclusive). The fragment is
 * stored in \a result. If FALSE is returned the code fragment could not be
 * found.
 *
 * The file is scanned for a opening bracket ('{') from \a startLine onward
 * The line actually containing the bracket is returned via startLine.
 * The file is scanned for a closing bracket ('}') from \a endLine backward.
 * The line actually containing the bracket is returned via endLine.
 * Note that for VHDL code the bracket search is not done.
 */
static bool readCodeFragment(const char *fileName,
                      int &startLine,int &endLine,QCString &result)
{
  static bool vhdlOpt           = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
  static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES");
  //printf("readCodeFragment(%s,%d,%d)\n",fileName,startLine,endLine);
  if (fileName==0 || fileName[0]==0) return FALSE; // not a valid file name
  QCString filter = getFileFilter(fileName,TRUE);
  FILE *f=0;
  bool usePipe = !filter.isEmpty() && filterSourceFiles;
  if (!usePipe) // no filter given or wanted
  {
    f = portable_fopen(fileName,"r");
  }
  else // use filter
  {
    QCString cmd=filter+" \""+fileName+"\"";
    Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
    f = portable_popen(cmd,"r");
  }
  bool found=vhdlOpt;  // for VHDL no bracket search is possible
  if (f)
  {
    int c=0;
    int col=0;
    int lineNr=1;
    // skip until the startLine has reached
    while (lineNr<startLine && !feof(f))
    {
      while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */;
      lineNr++; 
    }
    if (!feof(f))
    {
      // skip until the opening bracket or lonely : is found
      char cn=0;
      while (lineNr<=endLine && !feof(f) && !found)
      {
        int pc=0;
        while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) 
        {
          //printf("parsing char `%c'\n",c);
          if (c=='\n') 
          {
            lineNr++,col=0; 
          }
          else if (c=='\t') 
          {
            col+=Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE"));
          }
          else if (pc=='/' && c=='/') // skip single line comment
          {
            while ((c=fgetc(f))!='\n' && c!=EOF) pc=c;
            if (c=='\n') lineNr++,col=0;
          }
          else if (pc=='/' && c=='*') // skip C style comment
          {
            while (((c=fgetc(f))!='/' || pc!='*') && c!=EOF) 
            {
              if (c=='\n') lineNr++,col=0;
              pc=c;
            }
          }
          else
          {
            col++;
          }
          pc = c;
        }
        if (c==':')
        {
          cn=fgetc(f);
          if (cn!=':') found=TRUE;
        }
        else if (c=='{')
        {
          found=TRUE;
        }
      }
      //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr);
      if (found) 
      {
        // For code with more than one line,
        // fill the line with spaces until we are at the right column
        // so that the opening brace lines up with the closing brace
        if (endLine!=startLine)
        {
          QCString spaces;
          spaces.fill(' ',col);
          result+=spaces;
        }
        // copy until end of line
        result+=c;
        if (c==':') 
        {
          result+=cn;
          if (cn=='\n') lineNr++;
        }
        startLine=lineNr;
        const int maxLineLength=4096;
        char lineStr[maxLineLength];
        do 
        {
          //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine);
          int size_read;
          do 
          {
            // read up to maxLineLength-1 bytes, the last byte being zero
            char *p = fgets(lineStr, maxLineLength,f);
            //printf("  read %s",p);
            if (p) 
            {
              size_read=qstrlen(p); 
            }
            else  // nothing read
            {
              size_read=-1;
              lineStr[0]='\0';
            }
            result+=lineStr;
          } while (size_read == (maxLineLength-1));

          lineNr++; 
        } while (lineNr<=endLine && !feof(f));

        // strip stuff after closing bracket
        int newLineIndex = result.findRev('\n');
        int braceIndex   = result.findRev('}');
        if (braceIndex > newLineIndex) 
        {
          result.truncate(braceIndex+1);
        }
        endLine=lineNr-1;
      }
    }
    if (usePipe) 
    {
      portable_pclose(f); 
    }
    else 
    {
      fclose(f);
    }
  }
  result = transcodeCharacterStringToUTF8(result);
  return found;
}
Пример #9
0
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\">&nbsp;</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();
    }
  }
}
Пример #10
0
void FTVHelp::generateTreeView()
{
  QCString fileName;
  QFile f;
  static bool searchEngine = Config_getBool("SEARCHENGINE");
  static bool serverBasedSearch = Config_getBool("SERVER_BASED_SEARCH");
  generateTreeViewImages();
  
  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
  {
    FTextStream t(&f);
    //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/xhtml;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
  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
  {
    FTextStream t(&f);

    //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";
    generateScript(t);
    t << "  </head>\n";
    t << "\n";
    t << "  <body class=\"ftvtree\"";
    if (searchEngine && !serverBasedSearch)
    {
      t << " onload='searchBox.OnSelectItem(0);'";
    }
    t << ">\n";
    if (searchEngine)
    {
      t << "      <script type=\"text/javascript\"><!--\n";
      t << "      var searchBox = new SearchBox(\"searchBox\", \"search\", true, '" 
        << theTranslator->trSearch() << "');\n";
      t << "      --></script>\n";
      if (!serverBasedSearch)
      {
        t << "      <div class=\"tabsearch\">\n";
        t << "        <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
        t << "          <span class=\"left\">\n";
        t << "            <a id=\"MSearchClose\" href=\"javascript:searchBox.CloseResultsWindow()\">"
          << "<img id=\"MSearchCloseImg\" border=\"0\" src=\"search/close.png\" alt=\"\"/></a>\n";
        t << "            <input type=\"text\" id=\"MSearchField\" value=\"" 
          << theTranslator->trSearch() << "\" accesskey=\"S\"\n";
        t << "                   onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
        t << "                   onblur=\"searchBox.OnSearchFieldFocus(false)\" \n";
        t << "                   onkeyup=\"searchBox.OnSearchFieldChange(event)\"/>\n";
        t << "          </span><span class=\"right\">\n";
        t << "            <img id=\"MSearchSelect\" src=\"search/mag_sel.png\"\n";
        t << "                 onmouseover=\"return searchBox.OnSearchSelectShow()\"\n";
        t << "                 onmouseout=\"return searchBox.OnSearchSelectHide()\"\n";
        t << "                 alt=\"\"/>\n";
        t << "          </span>\n";
        t << "        </div>\n";
        t << "      </div>\n";
        HtmlGenerator::writeSearchFooter(t,QCString());
      }
      else
      {
        t << "      <div class=\"tabsearch\">\n";
        t << "        <div id=\"MSearchBox\" class=\"MSearchBoxInactive\">\n";
        t << "          <span class=\"left\">\n";
        t << "            <form id=\"FSearchBox\" action=\"search.php\" method=\"get\" target=\"basefrm\">\n";
        t << "              <img id=\"MSearchSelect\" src=\"search/mag.png\" alt=\"\"/>\n";
        t << "              <input type=\"text\" id=\"MSearchField\" name=\"query\" value=\""
          << theTranslator->trSearch() << "\" size=\"20\" accesskey=\"S\" \n";
        t << "                     onfocus=\"searchBox.OnSearchFieldFocus(true)\" \n";
        t << "                     onblur=\"searchBox.OnSearchFieldFocus(false)\"/>\n";
        t << "            </form>\n";
        t << "          </span><span class=\"right\"></span>\n";
        t << "        </div>\n";
        t << "      </div>\n";
      }
    }
    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";
    t << "      <div style=\"display: block;\">\n";

    generateTree(t,m_indentNodes[0],0);

    t << "      </div>\n";
    t << "    </div>\n";
  
    t << "  </body>\n";
    t << "</html>\n";
  
    f.close();
  }
}