]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/helphtml.cpp
A few tweaks and cleanups
[wxWidgets.git] / src / generic / helphtml.cpp
index f8731d8d17e625b8289ef6aa2c25b59b1c4f209c..8aa2840806b67fd6d615803337122ee5bfd190c9 100644 (file)
     #include   <unistd.h>
 #endif
 
     #include   <unistd.h>
 #endif
 
+// ----------------------------------------------------------------------------
+// constants
+// ----------------------------------------------------------------------------
+
+/// Name for map file.
+#define WXEXTHELP_MAPFILE   _T("wxhelp.map")
+/// Maximum line length in map file.
+#define WXEXTHELP_BUFLEN 512
+/// Character introducing comments/documentation field in map file.
+#define WXEXTHELP_COMMENTCHAR   ';'
+
 #define CONTENTS_ID   0
 
 class wxExtHelpMapEntry : public wxObject
 #define CONTENTS_ID   0
 
 class wxExtHelpMapEntry : public wxObject
@@ -122,7 +133,11 @@ wxHTMLHelpControllerBase::LoadFile(const wxString& ifile)
          wxChar* f = wxGetWorkingDirectory();
          file = f;
          delete[] f; // wxGetWorkingDirectory returns new memory
          wxChar* f = wxGetWorkingDirectory();
          file = f;
          delete[] f; // wxGetWorkingDirectory returns new memory
+#ifdef __WXMAC__
+         file << ifile;
+#else
          file << WXEXTHELP_SEPARATOR << ifile;
          file << WXEXTHELP_SEPARATOR << ifile;
+#endif
       }
       else
          file = ifile;
       }
       else
          file = ifile;
@@ -166,7 +181,7 @@ wxHTMLHelpControllerBase::LoadFile(const wxString& ifile)
    m_MapList = new wxList;
    m_NumOfEntries = 0;
 
    m_MapList = new wxList;
    m_NumOfEntries = 0;
 
-   FILE *input = fopen(mapFile.fn_str(),"rt");
+   FILE *input = wxFopen(mapFile,wxT("rt"));
    if(! input)
       return FALSE;
    do
    if(! input)
       return FALSE;
    do
@@ -251,6 +266,16 @@ wxHTMLHelpControllerBase::DisplaySection(int sectionNo)
    return FALSE;
 }
 
    return FALSE;
 }
 
+bool wxHTMLHelpControllerBase::DisplaySection(const wxString& section)
+{
+    bool isFilename = (section.Find(wxT(".htm")) != -1);
+
+    if (isFilename)
+        return DisplayHelp(section);
+    else
+        return KeywordSearch(section);
+}
+
 bool
 wxHTMLHelpControllerBase::DisplayBlock(long blockNo)
 {
 bool
 wxHTMLHelpControllerBase::DisplayBlock(long blockNo)
 {