+
+
+
+
+
+
+
+// output .hpp, .hhc and .hhk files:
+
+
+void GenerateHTMLWorkshopFiles(wxChar *fname)
+{
+ FILE *f;
+ wxChar buf[300];
+
+ /* Generate project file : */
+
+ wxSnprintf(buf, sizeof(buf), _T("%s.hhp"), fname);
+ f = wxFopen(buf, _T("wt"));
+ wxFprintf(f,
+ _T("[OPTIONS]\n")
+ _T("Compatibility=1.1\n")
+ _T("Full-text search=Yes\n")
+ _T("Contents file=%s.hhc\n")
+ _T("Compiled file=%s.chm\n")
+ _T("Default Window=%sHelp\n")
+ _T("Default topic=%s\n")
+ _T("Index file=%s.hhk\n")
+ _T("Title="),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(TitlepageName),
+ wxFileNameFromPath(fname)
+ );
+
+ if (DocumentTitle) {
+ SetCurrentOutput(f);
+ TraverseChildrenFromChunk(DocumentTitle);
+ }
+ else wxFprintf(f, _T("(unknown)"));
+
+ wxFprintf(f, _T("\n\n[WINDOWS]\n")
+ _T("%sHelp=,\"%s.hhc\",\"%s.hhk\",\"%s\",,,,,,0x2420,,0x380e,,,,,0,,,"),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(fname),
+ wxFileNameFromPath(TitlepageName));
+
+
+ wxFprintf(f, _T("\n\n[FILES]\n"));
+ wxFprintf(f, _T("%s\n"), wxFileNameFromPath(TitlepageName));
+ for (int i = 1; i <= fileId; i++) {
+ if (truncateFilenames)
+ wxSnprintf(buf, sizeof(buf), _T("%s%d.htm"), wxFileNameFromPath(FileRoot), i);
+ else
+ wxStrcpy(buf, wxFileNameFromPath(gs_filenames[i].c_str()));
+ wxFprintf(f, _T("%s\n"), buf);
+ }
+ fclose(f);
+
+ /* Generate index file : */
+
+ wxSnprintf(buf, sizeof(buf), _T("%s.hhk"), fname);
+ f = wxFopen(buf, _T("wt"));
+
+ wxFprintf(f,
+ _T("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
+ _T("<HTML>\n"));
+ HTMLHeadTo(f);
+ wxFprintf(f,
+ _T("\n")
+ _T("<meta name=\"GENERATOR\" content=\"tex2rtf\">\n")
+ _T("<!-- Sitemap 1.0 -->\n")
+ _T("</HEAD><BODY>\n")
+ _T("<OBJECT type=\"text/site properties\">\n")
+ _T(" <param name=\"ImageType\" value=\"Folder\">\n")
+ _T("</OBJECT>\n")
+ _T("<UL>\n"));
+
+ TopicTable.BeginFind();
+ wxHashTable::Node *node = TopicTable.Next();
+ while (node)
+ {
+ TexTopic *texTopic = (TexTopic *)node->GetData();
+ const wxChar *topicName = node->GetKeyString();
+ if (texTopic->filename && texTopic->keywords)
+ {
+ wxStringListNode *node1 = texTopic->keywords->GetFirst();
+ while (node1)
+ {
+ wxChar *s = (wxChar *)node1->GetData();
+ wxFprintf(f,
+ _T(" <LI> <OBJECT type=\"text/sitemap\">\n")
+ _T(" <param name=\"Local\" value=\"%s#%s\">\n")
+ _T(" <param name=\"Name\" value=\"%s\">\n")
+ _T(" </OBJECT>\n"),
+ texTopic->filename, topicName, s);
+ node1 = node1->GetNext();
+ }
+ }
+ node = TopicTable.Next();
+ }
+
+ wxFprintf(f, _T("</UL>\n"));
+ fclose(f);
+}
+
+
+
+static FILE *HTMLWorkshopContents = NULL;
+static int HTMLWorkshopLastLevel = 0;
+
+void HTMLWorkshopAddToContents(int level, wxChar *s, wxChar *file)
+{
+ int i;
+
+ if (level > HTMLWorkshopLastLevel)
+ for (i = HTMLWorkshopLastLevel; i < level; i++)
+ wxFprintf(HTMLWorkshopContents, _T("<UL>"));
+ if (level < HTMLWorkshopLastLevel)
+ for (i = level; i < HTMLWorkshopLastLevel; i++)
+ wxFprintf(HTMLWorkshopContents, _T("</UL>"));
+
+ SetCurrentOutput(HTMLWorkshopContents);
+ wxFprintf(HTMLWorkshopContents,
+ _T(" <LI> <OBJECT type=\"text/sitemap\">\n")
+ _T(" <param name=\"Local\" value=\"%s#%s\">\n")
+ _T(" <param name=\"Name\" value=\""),
+ file, s);
+ OutputCurrentSection();
+ wxFprintf(HTMLWorkshopContents,
+ _T("\">\n")
+ _T(" </OBJECT>\n"));
+ HTMLWorkshopLastLevel = level;
+}
+
+
+void HTMLWorkshopStartContents()
+{
+ wxChar buf[300];
+ wxSnprintf(buf, sizeof(buf), _T("%s.hhc"), FileRoot);
+ HTMLWorkshopContents = wxFopen(buf, _T("wt"));
+ HTMLWorkshopLastLevel = 0;
+
+ wxFprintf(HTMLWorkshopContents,
+ _T("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
+ _T("<HTML>\n"));
+ HTMLHeadTo(HTMLWorkshopContents);
+ wxFprintf(HTMLWorkshopContents,
+ _T("\n")
+ _T("<meta name=\"GENERATOR\" content=\"tex2rtf\">\n")
+ _T("<!-- Sitemap 1.0 -->\n")
+ _T("</HEAD><BODY>\n")
+ _T("<OBJECT type=\"text/site properties\">\n")
+ _T(" <param name=\"ImageType\" value=\"Folder\">\n")
+ _T("</OBJECT>\n")
+ _T("<UL>\n")
+ _T("<LI> <OBJECT type=\"text/sitemap\">\n")
+ _T("<param name=\"Local\" value=\"%s\">\n")
+ _T("<param name=\"Name\" value=\"Contents\">\n</OBJECT>\n"),
+ wxFileNameFromPath(TitlepageName)
+ );
+
+}
+
+
+void HTMLWorkshopEndContents()
+{
+ for (int i = HTMLWorkshopLastLevel; i >= 0; i--)
+ wxFprintf(HTMLWorkshopContents, _T("</UL>\n"));
+ fclose(HTMLWorkshopContents);
+}