]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/tex2rtf/src/htmlutil.cpp
Implement wxBitmapButton::DoGetBestSize() to call wxButtonBase version so
[wxWidgets.git] / utils / tex2rtf / src / htmlutil.cpp
index cc8187395f09bf4d45649477ebb025b76ad8495a..2ef296d460b396cfb4cfbc920cc8dd50a6dfa6f6 100644 (file)
@@ -874,6 +874,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
 
           if ( combineSubSections && !subsectionStarted )
           {
+            fflush(Sections);
+              
             // Read old .con file in at this point
             wxChar buf[256];
             wxStrcpy(buf, CurrentSectionFile);
@@ -885,7 +887,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
                 int ch = getc(fd);
                 while (ch != EOF)
                 {
-                    putc(ch, Sections);
+                    wxPutc(ch, Sections);
                     ch = getc(fd);
                 }
                 fclose(fd);
@@ -910,7 +912,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName);
             SetCurrentOutput(Subsections);
 
-           HTMLHead();
+            HTMLHead();
             TexOutput(_T("<title>"));
             OutputCurrentSection();
             TexOutput(_T("</title></head>\n"));
@@ -991,7 +993,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);
 
             SetCurrentOutput(Subsubsections);
-           HTMLHead();
+            HTMLHead();
             TexOutput(_T("<title>"));
             OutputCurrentSection();
             TexOutput(_T("</title></head>\n"));
@@ -1133,7 +1135,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
         else
           wxSnprintf(buf, sizeof(buf), _T("\n<TD ALIGN=LEFT>"));
         TexOutput(buf);
-               OutputFont();
+        OutputFont();
       }
       else
         TexOutput(_T("&amp;"));
@@ -1182,7 +1184,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
       else
         wxSnprintf(buf, sizeof(buf), _T("<TR>\n<TD ALIGN=LEFT>"));
       TexOutput(buf);
-         OutputFont();
+      OutputFont();
     }
     else
     {
@@ -1649,16 +1651,22 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
   {
     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)
         {
-          putc(ch, Titlepage);
+          wxPutc(ch, Titlepage);
           ch = getc(fd);
         }
         fclose(fd);
+        fflush(Titlepage);
       }
       else
       {
@@ -1971,15 +1979,15 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
             // 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("#"));
-               }
+            }
             else if (refFilename)
-               {
+            {
               TexOutput(ConvertCase(refFilename));
               TexOutput(_T("#"));
-               }
+            }
             TexOutput(refName);
             TexOutput(_T("\">"));
             if (helpRefText)
@@ -2059,7 +2067,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           // If we have found the existing filename, make the inline
           // image point to the original file (could be PS, for example)
           if (originalFilename && (wxStrcmp(inlineFilename, originalFilename) != 0))
-         {
+          {
             TexOutput(_T("<A HREF=\""));
             TexOutput(ConvertCase(originalFilename));
             TexOutput(_T("\">"));
@@ -2068,17 +2076,17 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
             TexOutput(_T("\""));
             TexOutput(alignment); 
             TexOutput(_T("></A>"));
-         }
+          }
           else
 #endif
-         {
+          {
             TexOutput(_T("<img src=\""));
             TexOutput(ConvertCase(wxFileNameFromPath(inlineFilename)));
             TexOutput(_T("\""));
             TexOutput(alignment); 
             TexOutput(_T(">"));
             delete[] inlineFilename;
-         }
+          }
         }
         else
         {
@@ -2195,27 +2203,36 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     {
       if ( start ) {
         // DHS
-       if (TwoColWidthA > -1) {
+        if (TwoColWidthA > -1)
+        {
           wxChar buf[100];
           wxSnprintf(buf, sizeof(buf), _T("\n<TR><TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthA);
           TexOutput(buf);
-        } else
+        }
+        else
+        {
           TexOutput(_T("\n<TR><TD VALIGN=TOP>\n"));
-               OutputFont();
+        }
+        OutputFont();
       }  else
             TexOutput(_T("\n</FONT></TD>\n"));
     }
     if (arg_no == 2)
     {
       // DHS
-      if ( start ) {
-       if (TwoColWidthB > -1) {
+      if ( start )
+      {
+        if (TwoColWidthB > -1)
+        {
           wxChar buf[100];
           wxSnprintf(buf, sizeof(buf), _T("\n<TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthB);
           TexOutput(buf);
-        } else 
-           TexOutput(_T("\n<TD VALIGN=TOP>\n"));
-               OutputFont();
+        }
+        else 
+        {
+          TexOutput(_T("\n<TD VALIGN=TOP>\n"));
+        }
+        OutputFont();
       }  else
            TexOutput(_T("\n</FONT></TD></TR>\n"));
     }
@@ -2701,7 +2718,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         if (compatibilityMode)
         {
           TexOutput(_T("<TR>\n<TD>"));
-                 OutputFont();
+          OutputFont();
 /*
           for (int i = 0; i < noColumns; i++)
           {
@@ -2797,7 +2814,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           {
             wxStrcpy(buf2, _T("#000000"));
             wxChar buf[100];
-                       wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
+            wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
             OnError(buf);
           }
           TexOutput(_T("<FONT COLOR=\""));
@@ -3014,15 +3031,15 @@ bool HTMLGo(void)
       if (DocumentTitle)
       {
         SetCurrentOutput(tmpTitle);
-       HTMLHead();
-        TexOutput(_T("\n<HEAD><TITLE>"));
+        HTMLHead();
+        TexOutput(_T("\n<TITLE>"));
         TraverseChildrenFromChunk(DocumentTitle);
         TexOutput(_T("</TITLE></HEAD>\n"));
       }
       else
       {
         SetCurrentOutput(tmpTitle);
-       HTMLHeadTo(tmpTitle);
+        HTMLHeadTo(tmpTitle);
         if (contentsString)
           wxFprintf(tmpTitle, _T("<TITLE>%s</TITLE></HEAD>\n\n"), contentsString);
         else
@@ -3049,6 +3066,7 @@ bool HTMLGo(void)
 
       // Output <BODY...> to temporary title page
       OutputBodyStart();
+      fflush(tmpTitle);
 
       // Concat titlepage
       FILE *fd = wxFopen(TitlepageName, _T("r"));
@@ -3057,7 +3075,7 @@ bool HTMLGo(void)
         int ch = getc(fd);
         while (ch != EOF)
         {
-          putc(ch, tmpTitle);
+          wxPutc(ch, tmpTitle);
           ch = getc(fd);
         }
         fclose(fd);
@@ -3123,7 +3141,7 @@ void GenerateHTMLIndexFile(wxChar *fname)
     return;
 
   TopicTable.BeginFind();
-  wxNode *node = TopicTable.Next();
+  wxHashTable::Node *node = TopicTable.Next();
   while (node)
   {
     TexTopic *texTopic = (TexTopic *)node->GetData();
@@ -3223,7 +3241,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
       _T("<UL>\n"));
 
   TopicTable.BeginFind();
-  wxNode *node = TopicTable.Next();
+  wxHashTable::Node *node = TopicTable.Next();
   while (node)
   {
     TexTopic *texTopic = (TexTopic *)node->GetData();
@@ -3239,7 +3257,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
             _T("  <param name=\"Local\" value=\"%s#%s\">\n")
             _T("  <param name=\"Name\" value=\"%s\">\n")
             _T("  </OBJECT>\n"),
-           texTopic->filename, topicName, s);
+        texTopic->filename, topicName, s);
         node1 = node1->GetNext();
       }
     }
@@ -3271,10 +3289,10 @@ void HTMLWorkshopAddToContents(int level, wxChar *s, wxChar *file)
             _T(" <LI> <OBJECT type=\"text/sitemap\">\n")
             _T("  <param name=\"Local\" value=\"%s#%s\">\n")
             _T("  <param name=\"Name\" value=\""),
-           file, s);
+            file, s);
   OutputCurrentSection();
   wxFprintf(HTMLWorkshopContents,
-                 _T("\">\n")
+            _T("\">\n")
             _T("  </OBJECT>\n"));
   HTMLWorkshopLastLevel = level;
 }