]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/helpdata.cpp
wxMotif compilation fixes for wxDataObject and PROCESS_EVENTS (wxSocket)
[wxWidgets.git] / src / html / helpdata.cpp
index fb87c1af12be0e73055d00a0392ba70b6eac4e23..e558e2fb8a22c60aa6fb7a1874c4dd6669c5ecd8 100644 (file)
@@ -1,17 +1,16 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        helpdata.cpp
 // Purpose:     wxHtmlHelpData
-// Notes:       Based on htmlhelp.cpp, implementing a monolithic 
+// Notes:       Based on htmlhelp.cpp, implementing a monolithic
 //              HTML Help controller class,  by Vaclav Slavik
 // Author:      Harm van der Heijden and Vaclav Slavik
-// Created:
-// RCS-ID:
+// RCS-ID:      $Id$
 // Copyright:   (c) Harm van der Heijden and Vaclav Slavik
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #ifdef __GNUG__
-#pragma implementation "helpdata.h"
+#pragma implementation
 #endif
 
 // For compilers that support precompilation, includes "wx.h".
@@ -33,7 +32,7 @@
 #include "wx/tokenzr.h"
 #include "wx/wfstream.h"
 #include "wx/busyinfo.h"
-#include "wx/html/htmlparser.h"
+#include "wx/html/htmlpars.h"
 #include "wx/html/htmldefs.h"
 
 #include "wx/arrimpl.cpp"
@@ -82,8 +81,8 @@ static int IndexCompareFunc(const void *a, const void *b)
 class HP_Parser : public wxHtmlParser
 {
     public:
-        void AddText(const char* text) {}
-        wxObject* GetProduct() {return NULL;}
+        void AddText(const char* WXUNUSED(text)) { }
+        wxObject* GetProduct() { return NULL; }
 };
 
 
@@ -124,8 +123,8 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
         m_Name = m_Page = wxEmptyString;
         ParseInner(tag);
         if (m_Page != wxEmptyString) {
-            if (m_ItemsCnt % HTML_REALLOC_STEP == 0)
-                m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + HTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
+            if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0)
+                m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
             m_Items[m_ItemsCnt].m_Level = m_Level;
             m_Items[m_ItemsCnt].m_ID = m_ID;
             m_Items[m_ItemsCnt].m_Page = new char[m_Page.Length() + 1];
@@ -141,7 +140,7 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag)
     else { // "PARAM"
         if (m_Name == wxEmptyString && tag.GetParam("NAME") == "Name") m_Name = tag.GetParam("VALUE");
         if (tag.GetParam("NAME") == "Local") m_Page = tag.GetParam("VALUE");
-        if (tag.GetParam("NAME") == "ID") tag.ScanParam("VALUE", "%i", &m_ID); 
+        if (tag.GetParam("NAME") == "ID") tag.ScanParam("VALUE", "%i", &m_ID);
         return FALSE;
     }
 }
@@ -168,7 +167,7 @@ void HP_TagHandler::ReadIn(wxHtmlContentsItem* array, int size)
 
 IMPLEMENT_DYNAMIC_CLASS(wxHtmlHelpData, wxObject)
 
-wxHtmlHelpData::wxHtmlHelpData() 
+wxHtmlHelpData::wxHtmlHelpData()
 {
     m_TempPath = wxEmptyString;
 
@@ -205,7 +204,7 @@ bool wxHtmlHelpData::LoadMSProject(wxHtmlBookRecord *book, wxFileSystem& fsys, c
     char *buf;
     int sz;
     wxString string;
-    
+
     HP_Parser parser;
     HP_TagHandler *handler = new HP_TagHandler(book);
     parser.AddTagHandler(handler);
@@ -249,7 +248,7 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
     f -> Read(&x, sizeof(x));
     st = m_ContentsCnt;
     m_ContentsCnt += x;
-    m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
+    m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
     for (i = st; i < m_ContentsCnt; i++) {
         f -> Read(&x, sizeof(x));
         m_Contents[i].m_Level = x;
@@ -269,7 +268,7 @@ bool wxHtmlHelpData::LoadCachedBook(wxHtmlBookRecord *book, wxInputStream *f)
     f -> Read(&x, sizeof(x));
     st = m_IndexCnt;
     m_IndexCnt += x;
-    m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / HTML_REALLOC_STEP + 1) * HTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
+    m_Index = (wxHtmlContentsItem*) realloc(m_Index, (m_IndexCnt / wxHTML_REALLOC_STEP + 1) * wxHTML_REALLOC_STEP * sizeof(wxHtmlContentsItem));
     for (i = st; i < m_IndexCnt; i++) {
         f -> Read(&x, sizeof(x));
         m_Index[i].m_Name = new char[x];
@@ -338,23 +337,23 @@ void wxHtmlHelpData::SetTempDir(const wxString& path)
 }
 
 
-bool wxHtmlHelpData::AddBookParam(const wxString& title, const wxString& contfile, 
-                                 const wxString& indexfile, const wxString& deftopic, 
+bool wxHtmlHelpData::AddBookParam(const wxString& title, const wxString& contfile,
+                                 const wxString& indexfile, const wxString& deftopic,
                                  const wxString& path)
 {
     wxFileSystem fsys;
     wxFSFile *fi;
     wxHtmlBookRecord *bookr;
     wxString safetitle;
-    
+
     if (! path.IsEmpty())
            // workaround for bug in ChangePathTo(name, TRUE)
            fsys.ChangePathTo(path+"/gaga");
 
     bookr = new wxHtmlBookRecord(path+'/', title, deftopic);
 
-    if (m_ContentsCnt % HTML_REALLOC_STEP == 0)
-        m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + HTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
+    if (m_ContentsCnt % wxHTML_REALLOC_STEP == 0)
+        m_Contents = (wxHtmlContentsItem*) realloc(m_Contents, (m_ContentsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem));
     m_Contents[m_ContentsCnt].m_Level = 0;
     m_Contents[m_ContentsCnt].m_ID = 0;
     m_Contents[m_ContentsCnt].m_Page = new char[deftopic.Length() + 1];
@@ -389,7 +388,7 @@ bool wxHtmlHelpData::AddBookParam(const wxString& title, const wxString& contfil
     m_BookRecords.Add(bookr);
     if (m_IndexCnt > 0)
         qsort(m_Index, m_IndexCnt, sizeof(wxHtmlContentsItem), IndexCompareFunc);
-    
+
     return TRUE;
 }
 
@@ -404,12 +403,12 @@ bool wxHtmlHelpData::AddBook(const wxString& book)
     int sz;
     char *buff, *lineptr;
     char linebuf[300];
-     
+
     wxString title = _("noname"),
              safetitle,
              start = wxEmptyString,
              contents = wxEmptyString, index = wxEmptyString;
-    
+
     if (wxIsAbsolutePath(book)) bookFull = book;
     else bookFull = wxGetCwd() + "/" + book;
 
@@ -494,7 +493,7 @@ wxString wxHtmlHelpData::FindPageByName(const wxString& x)
 }
 
 wxString wxHtmlHelpData::FindPageById(int id)
-{   
+{
     int i;
     wxString url(wxEmptyString);
 
@@ -513,7 +512,7 @@ wxString wxHtmlHelpData::FindPageById(int id)
 //----------------------------------------------------------------------------------
 
 wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& keyword,
-                                      const wxString& book = wxEmptyString)
+                                      const wxString& book)
 {
     m_Data = data;
     m_Keyword = keyword;
@@ -529,7 +528,7 @@ wxHtmlSearchStatus::wxHtmlSearchStatus(wxHtmlHelpData* data, const wxString& key
                break;
            }
        // check; we won't crash if the book doesn't exist, but it's Bad Anyway.
-       wxASSERT(bookr); 
+       wxASSERT(bookr);
     }
     if (! bookr) {
        // no book specified; search all books
@@ -557,7 +556,7 @@ bool wxHtmlSearchStatus::Search()
     m_ContentsItem = NULL;
     m_Name = wxEmptyString;
 
-    file = fsys.OpenFile(m_Data->m_Contents[i].m_Book -> GetBasePath() + 
+    file = fsys.OpenFile(m_Data->m_Contents[i].m_Book -> GetBasePath() +
                         m_Data->m_Contents[i].m_Page);
     if (file) {
        if (m_LastPage != file->GetLocation()) {
@@ -565,7 +564,7 @@ bool wxHtmlSearchStatus::Search()
            if (m_Engine.Scan(file -> GetStream())) {
                m_Name = m_Data->m_Contents[i].m_Name;
                m_ContentsItem = m_Data->m_Contents + i;
-               found = true;
+               found = TRUE;
            }
        }
        delete file;