⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmlutil.cpp

📁 很牛的GUI源码wxWidgets-2.8.0.zip 可在多种平台下运行.
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    }    break;  }  case ltMAKETITLE:  {    if (start && DocumentTitle && DocumentAuthor)    {      // Add a special label for the contents page.//      TexOutput(_T("<CENTER>\n"));      TexOutput(_T("<A NAME=\"contents\">"));      TexOutput(_T("<H2 ALIGN=CENTER>\n"));      TraverseChildrenFromChunk(DocumentTitle);      TexOutput(_T("</H2>"));      TexOutput(_T("<P>"));      TexOutput(_T("</A>\n"));      TexOutput(_T("<P>\n\n"));      TexOutput(_T("<H3 ALIGN=CENTER>"));      TraverseChildrenFromChunk(DocumentAuthor);      TexOutput(_T("</H3><P>\n\n"));      if (DocumentDate)      {        TexOutput(_T("<H3 ALIGN=CENTER>"));        TraverseChildrenFromChunk(DocumentDate);        TexOutput(_T("</H3><P>\n\n"));      }//      TexOutput(_T("\n</CENTER>\n"));      TexOutput(_T("\n<P><HR><P>\n"));/*      // Now do optional frame contents page      if (htmlFrameContents && FrameContents)      {        SetCurrentOutput(FrameContents);        // Add a special label for the contents page.        TexOutput(_T("<CENTER>\n"));        TexOutput(_T("<H3>\n"));        TraverseChildrenFromChunk(DocumentTitle);        TexOutput(_T("</H3>"));        TexOutput(_T("<P>"));        TexOutput(_T("</A>\n"));        TexOutput(_T("<P>\n\n"));        TexOutput(_T("<H3>"));        TraverseChildrenFromChunk(DocumentAuthor);        TexOutput(_T("</H3><P>\n\n"));        if (DocumentDate)        {          TexOutput(_T("<H4>"));          TraverseChildrenFromChunk(DocumentDate);          TexOutput(_T("</H4><P>\n\n"));        }        TexOutput(_T("\n</CENTER>\n"));        TexOutput(_T("<P><HR><P>\n"));        SetCurrentOutput(Titlepage);      }*/    }    break;  }  case ltHELPREF:  case ltHELPREFN:  case ltPOPREF:  case ltURLREF:  {    if (start)    {      helpRefFilename = NULL;      helpRefText = NULL;    }    break;  }  case ltBIBLIOGRAPHY:  {    if (start)    {      DefaultOnMacro(macroId, no_args, start);    }    else    {      DefaultOnMacro(macroId, no_args, start);      TexOutput(_T("</DL>\n"));    }    break;  }  case ltHRULE:  {    if (start)    {      TexOutput(_T("<HR>\n"));    }    break;  }  case ltRULE:  {    if (start)    {      TexOutput(_T("<HR>\n"));    }    break;  }  case ltTABLEOFCONTENTS:  {    if (start)    {      // NB: if this is uncommented, the table of contents      // completely disappears. If left commented, it's in the wrong      // place.      //fflush(Titlepage);      FILE *fd = wxFopen(ContentsName, _T("r"));      if (fd)      {        int ch = getc(fd);        while (ch != EOF)        {          wxPutc(ch, Titlepage);          ch = getc(fd);        }        fclose(fd);        fflush(Titlepage);      }      else      {        TexOutput(_T("RUN TEX2RTF AGAIN FOR CONTENTS PAGE\n"));        OnInform(_T("Run Tex2RTF again to include contents page."));      }    }    break;  }  case ltLANGLEBRA:  {    if (start)      TexOutput(_T("&lt;"));    break;  }  case ltRANGLEBRA:  {    if (start)      TexOutput(_T("&gt;"));    break;  }  case ltQUOTE:  case ltQUOTATION:  {    if (start)      TexOutput(_T("<BLOCKQUOTE>"));    else      TexOutput(_T("</BLOCKQUOTE>"));    break;  }  case ltCAPTION:  case ltCAPTIONSTAR:  {    if (start)    {      if (inTabular)        TexOutput(_T("\n<CAPTION>"));      wxChar figBuf[40];      if ( inFigure )      {          figureNo ++;          if (DocumentStyle != LATEX_ARTICLE)            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), FigureNameString, chapterNo, figureNo);          else            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), FigureNameString, figureNo);      }      else      {          tableNo ++;          if (DocumentStyle != LATEX_ARTICLE)            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d.%d: "), TableNameString, chapterNo, tableNo);          else            wxSnprintf(figBuf, sizeof(figBuf), _T("%s %d: "), TableNameString, tableNo);      }      TexOutput(figBuf);    }    else    {      if (inTabular)        TexOutput(_T("\n</CAPTION>\n"));      wxChar *topicName = FindTopicName(GetNextChunk());      int n = inFigure ? figureNo : tableNo;      AddTexRef(topicName, NULL, NULL,           ((DocumentStyle != LATEX_ARTICLE) ? chapterNo : n),            ((DocumentStyle != LATEX_ARTICLE) ? n : 0));    }    break;  }  case ltSS:  {    if (start) TexOutput(_T("&szlig;"));    break;  }  case ltFIGURE:  {    if (start) inFigure = true;    else inFigure = false;    break;  }  case ltTABLE:  {    if (start) inTable = true;    else inTable = false;    break;  }  default:    DefaultOnMacro(macroId, no_args, start);    break;  }}/*     CheckTypeRef()       should be called at of argument which usually is       type declaration which propably contains name of       documented class       examples:               HTMLOnArgument                       - ltFUNC,                       - ltPARAM                       - ltCPARAM       checks: GetArgData() if contains Type Declaration                               and can be referenced to some file       prints:               before<a href="xxx&yyy">type</a>after       returns:               false   - if no reference was found               true    - if reference was found and HREF printed*/static bool CheckTypeRef(){  wxString typeDecl = GetArgData();  if( !typeDecl.empty() ) {    typeDecl.Replace(wxT("\\"),wxT(""));    wxString label = typeDecl;    label.Replace(wxT("const"),wxT(""));    label.Replace(wxT("virtual"),wxT(""));    label.Replace(wxT("static"),wxT(""));    label.Replace(wxT("extern"),wxT(""));    label = label.BeforeFirst('&');    label = label.BeforeFirst(wxT('*'));    label = label.BeforeFirst(wxT('\\'));    label.Trim(true); label.Trim(false);    wxString typeName = label;    label.MakeLower();    TexRef *texRef = FindReference((wxChar*)label.c_str());    if (texRef && texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0) {      int a = typeDecl.Find(typeName);      wxString before = typeDecl.Mid( 0, a );      wxString after = typeDecl.Mid( a+typeName.Length() );      //wxFprintf(stderr,wxT("%s <%s> %s to ... %s#%s !!!!\n"),       //      before.c_str(),       //      typeName.c_str(),       //      after.c_str(),       //      texRef->refFile,label.c_str());      TexOutput(before);      TexOutput(_T("<A HREF=\""));      TexOutput(texRef->refFile);      TexOutput(_T("#"));      TexOutput(label);      TexOutput(wxT("\">"));      TexOutput(typeName);      TexOutput(wxT("</A>"));      TexOutput(after);      return true;    } else {      //wxFprintf(stderr,wxT("'%s' from (%s) -> label %s NOT FOUND\n"),       //      typeName.c_str(),       //      typeDecl.c_str(),       //      label.c_str());      return false;    }  }  return false;}// Called on start/end of argument examinationbool HTMLOnArgument(int macroId, int arg_no, bool start){  switch (macroId)  {  case ltCHAPTER:  case ltCHAPTERSTAR:  case ltCHAPTERHEADING:  case ltSECTION:  case ltSECTIONSTAR:  case ltSECTIONHEADING:  case ltSUBSECTION:  case ltSUBSECTIONSTAR:  case ltSUBSUBSECTION:  case ltSUBSUBSECTIONSTAR:  case ltGLOSS:  case ltMEMBERSECTION:  case ltFUNCTIONSECTION:  {    if (!start && (arg_no == 1))      currentSection = GetArgChunk();    return false;  }  case ltFUNC:  {    if (start && (arg_no == 1)) {      TexOutput(_T("<B>"));      if( CheckTypeRef() ) {       TexOutput(_T("</B> "));       return false;      }    }    if (!start && (arg_no == 1))      TexOutput(_T("</B> "));    if (start && (arg_no == 2))    {      if (!suppressNameDecoration) TexOutput(_T("<B>"));      currentMember = GetArgChunk();    }    if (!start && (arg_no == 2))    {      if (!suppressNameDecoration) TexOutput(_T("</B>"));    }    if (start && (arg_no == 3))      TexOutput(_T("("));    if (!start && (arg_no == 3))     TexOutput(_T(")"));   break;  }  case ltCLIPSFUNC:  {    if (start && (arg_no == 1))      TexOutput(_T("<B>"));    if (!start && (arg_no == 1))      TexOutput(_T("</B> "));    if (start && (arg_no == 2))    {      if (!suppressNameDecoration) TexOutput(_T("( "));      currentMember = GetArgChunk();    }    if (!start && (arg_no == 2))    {    }    if (!start && (arg_no == 3))     TexOutput(_T(")"));    break;  }  case ltPFUNC:  {    if (!start && (arg_no == 1))      TexOutput(_T(" "));    if (start && (arg_no == 2))      TexOutput(_T("(*"));    if (!start && (arg_no == 2))      TexOutput(_T(")"));    if (start && (arg_no == 2))      currentMember = GetArgChunk();    if (start && (arg_no == 3))      TexOutput(_T("("));    if (!start && (arg_no == 3))      TexOutput(_T(")"));    break;  }  case ltPARAM:  case ltCPARAM:  {    const wxChar* pend = macroId == ltCPARAM ?       _T("</B> ") : _T("</B>");    if( arg_no == 1) {      if( start ) {       TexOutput(_T("<B>"));       if( CheckTypeRef() ) {         TexOutput(pend);         return false;       }      } else {       TexOutput(pend);      }    }    if (start && (arg_no == 2))    {      TexOutput(_T("<I>"));    }    if (!start && (arg_no == 2))    {      TexOutput(_T("</I>"));    }    break;  }  case ltMEMBER:  {    if (!start && (arg_no == 1))      TexOutput(_T(" "));    if (start && (arg_no == 2))      currentMember = GetArgChunk();    break;  }  case ltREF:  {    if (start)    {      wxChar *sec = NULL;      wxChar *refName = GetArgData();      if (refName)      {        TexRef *texRef = FindReference(refName);        if (texRef)        {          sec = texRef->sectionNumber;        }      }      if (sec)      {        TexOutput(sec);      }      return false;    }    break;  }  case ltURLREF:  {    if (IsArgOptional())      return false;    else if ((GetNoArgs() - arg_no) == 1)    {      if (start)        helpRefText = GetArgChunk();      return false;    }    else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional    {      if (start)      {        TexChunk *ref = GetArgChunk();        TexOutput(_T("<A HREF=\""));        inVerbatim = true;        TraverseChildrenFromChunk(ref);        inVerbatim = false;        TexOutput(_T("\">"));        if (helpRefText)          TraverseChildrenFromChunk(helpRefText);        TexOutput(_T("</A>"));      }      return false;    }    break;  }  case ltHELPREF:  case ltHELPREFN:  case ltPOPREF:  {    if (IsArgOptional())    {      if (start)        helpRefFilename = GetArgChunk();      return false;    }    if ((GetNoArgs() - arg_no) == 1)    {      if (start)        helpRefText = GetArgChunk();      return false;    }    else if ((GetNoArgs() - arg_no) == 0) // Arg = 2, or 3 if first is optional    {      if (start)      {        wxChar *refName = GetArgData();        wxChar *refFilename = NULL;        if (refName)        {          TexRef *texRef = FindReference(refName);          if (texRef)          {            if (texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0)              refFilename = texRef->refFile;            TexOutput(_T("<A HREF=\""));            // If a filename is supplied, use it, otherwise try to            // use the filename associated with the reference (from this document).            if (helpRefFilename)            {              TraverseChildrenFromChunk(helpRefFilename);              TexOutput(_T("#"));              TexOutput(refName);            }            else if (refFilename)            {              TexOutput(ConvertCase(refFilename));              if(!PrimaryAnchorOfTheFile(texRef->refFile, refName))              {                TexOutput(_T("#"));                TexOutput(refName);              }            }            TexOutput(_T("\">"));            if (helpRefText)              TraverseChildrenFromChunk(helpRefText);            TexOutput(_T("</A>"));          }          else          {            if (helpRefText)              TraverseChildrenFromChunk(helpRefText);            if (!ignoreBadRefs)              TexOutput(_T(" (REF NOT FOUND)"));            // for launching twice do not warn in preparation pass

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -