]> git.saurik.com Git - wxWidgets.git/commitdiff
Removed wxHTMLHelpControllerBase (putting the
authorJulian Smart <julian@anthemion.co.uk>
Sat, 24 May 2003 11:20:39 +0000 (11:20 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sat, 24 May 2003 11:20:39 +0000 (11:20 +0000)
implementation into wxExtHelpController.
wx/helphtml.h now includes wx/html/helpctrl.h.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20720 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

15 files changed:
distrib/msw/tmake/filelist.txt
include/wx/generic/helpext.h
include/wx/generic/helphtml.h [deleted file]
src/cocoa/files.lst
src/generic/helpext.cpp
src/generic/helphtml.cpp [deleted file]
src/gtk/files.lst
src/gtk1/files.lst
src/mac/carbon/files.lst
src/mac/files.lst
src/mgl/files.lst
src/motif/files.lst
src/msw/files.lst
src/os2/files.lst
src/x11/files.lst

index 829e8214685239ab8ec9e252f3ad798347a0b7d4..13303bd38f14b7ef6c34ec501d678cb99b295b83 100644 (file)
@@ -89,7 +89,6 @@ grid.cpp      Generic
 gridctrl.cpp   Generic
 gridsel.cpp    Generic
 helpext.cpp    Generic Generic
-helphtml.cpp   Generic Generic
 imaglist.cpp   Generic NotWin32
 laywin.cpp     Generic
 listctrl.cpp   Generic NotWin32
@@ -903,7 +902,6 @@ hash.h      WXH     Base
 hashmap.h      WXH     Base
 help.h WXH
 helpbase.h     WXH
-helphtml.h     WXH
 helpwin.h      WXH
 icon.h WXH
 iconbndl.h     WXH
@@ -1586,7 +1584,6 @@ grid.h    GenericH
 gridctrl.h     GenericH
 gridg.h        GenericH
 helpext.h      GenericH
-helphtml.h     GenericH
 imaglist.h     GenericH
 laywin.h       GenericH
 listctrl.h     GenericH        NotWin32
index ac1284f370a2403e26fc5032359ca026e2a24a64..03c66e5fe3a9cac14cb98b94ae1ab29cee244373 100644 (file)
 #   pragma interface "wxexthlp.h"
 #endif
 
-#include "wx/generic/helphtml.h"
+#include "wx/helpbase.h"
+
+/// Path separator.
+#ifdef __WXMSW__
+#define WXEXTHELP_SEPARATOR _T('\\')
+#elif defined(__WXMAC__)
+#define WXEXTHELP_SEPARATOR _T(':')
+#else
+#define WXEXTHELP_SEPARATOR _T('/')
+#endif
+
+class WXDLLEXPORT wxExtHelpMapList;
 
 #ifndef WXEXTHELP_DEFAULTBROWSER
 /// Default browser name.
    Lines starting with ';' will be ignored.
 */
 
-class WXDLLEXPORT wxExtHelpController : public wxHTMLHelpControllerBase
+class WXDLLEXPORT wxExtHelpController : public wxHelpControllerBase
 {      
 DECLARE_CLASS(wxExtHelpController)
    public:
-   wxExtHelpController(void);
+   wxExtHelpController();
+   ~wxExtHelpController();
 
    /** Tell it which browser to use.
        The Netscape support will check whether Netscape is already
@@ -58,19 +70,107 @@ DECLARE_CLASS(wxExtHelpController)
        @param isNetscape Set this to TRUE if the browser is some variant of Netscape.
    */
    // Obsolete form
-   void SetBrowser(wxString const & browsername = WXEXTHELP_DEFAULTBROWSER,
+   void SetBrowser(const wxString & browsername = WXEXTHELP_DEFAULTBROWSER,
                    bool isNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE);
 
   // Set viewer: new name for SetBrowser
   virtual void SetViewer(const wxString& viewer = WXEXTHELP_DEFAULTBROWSER, long flags = wxHELP_NETSCAPE);
 
+   /** This must be called to tell the controller where to find the
+       documentation.
+       If a locale is set, look in file/localename, i.e.
+       If passed "/usr/local/myapp/help" and the current wxLocale is
+       set to be "de", then look in "/usr/local/myapp/help/de/"
+       first and fall back to "/usr/local/myapp/help" if that
+       doesn't exist.
+
+       @param file - NOT a filename, but a directory name.
+       @return true on success
+   */
+   virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
+      { return Initialize(dir); }
+
+   /** This must be called to tell the controller where to find the
+       documentation.
+       If a locale is set, look in file/localename, i.e.
+       If passed "/usr/local/myapp/help" and the current wxLocale is
+       set to be "de", then look in "/usr/local/myapp/help/de/"
+       first and fall back to "/usr/local/myapp/help" if that
+       doesn't exist.
+       @param dir - directory name where to fine the help files
+       @return true on success
+   */
+   virtual bool Initialize(const wxString& dir);
+
+   /** If file is "", reloads file given in Initialize.
+       @file Name of help directory.
+       @return true on success
+   */
+   virtual bool LoadFile(const wxString& file = wxT(""));
+
+   /** Display list of all help entries.
+       @return true on success
+   */
+   virtual bool DisplayContents(void);
+   /** Display help for id sectionNo.
+       @return true on success
+   */
+   virtual bool DisplaySection(int sectionNo);
+   /** Display help for id sectionNo -- identical with DisplaySection().
+       @return true on success
+   */
+   virtual bool DisplaySection(const wxString& section);
+   /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
+       @return true on success
+   */
+   virtual bool DisplayBlock(long blockNo);
+   /** Search comment/documentation fields in map file and present a
+       list to chose from.
+       @key k string to search for, empty string will list all entries
+       @return true on success
+   */
+   virtual bool KeywordSearch(const wxString& k);
+
+   /// does nothing
+   virtual bool Quit(void);
+   /// does nothing
+   virtual void OnQuit(void);
+
+   /// Call the browser using a relative URL.
+   virtual bool DisplayHelp(const wxString &) ;
+
+   /// Allows one to override the default settings for the help frame.
+   virtual void SetFrameParameters(const wxString& WXUNUSED(title),
+                                   const wxSize& WXUNUSED(size),
+                                   const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
+                                   bool WXUNUSED(newFrameEachTime) = FALSE)
+      {
+         // does nothing by default
+      }
+   /// Obtains the latest settings used by the help frame and the help 
+   /// frame.
+   virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
+                                   wxPoint *WXUNUSED(pos) = NULL,
+                                   bool *WXUNUSED(newFrameEachTime) = NULL)
+      {
+         return (wxFrame*) NULL;// does nothing by default
+      }
+
+ protected:
+   /// Filename of currently active map file.
+   wxString         m_MapFile;
+   /// How many entries do we have in the map file?
+   int              m_NumOfEntries;
+   /// A list containing all id,url,documentation triples.
+   wxList          *m_MapList;
+   /// Deletes the list and all objects.
+   void DeleteList(void);
+
  private:
    /// How to call the html viewer.
    wxString         m_BrowserName;
    /// Is the viewer a variant of netscape?
    bool             m_BrowserIsNetscape;
-   /// Call the browser using a relative URL.
-   virtual bool DisplayHelp(const wxString&);
 };
 
 #endif // wxUSE_HELP
diff --git a/include/wx/generic/helphtml.h b/include/wx/generic/helphtml.h
deleted file mode 100644 (file)
index 8e81689..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-*- c++ -*-********************************************************
- * helphtml.h - base class for html based help controllers          *
- *                                                                  *
- * (C) 1999 by Karsten Ballüder (Ballueder@usa.net)                 *
- *                                                                  *
- * $Id$
- *******************************************************************/
-
-#ifndef __WX_HELPHTML_H_
-#define __WX_HELPHTML_H_
-
-#if wxUSE_HELP
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#   pragma interface "helphtml.h"
-#endif
-
-#include "wx/helpbase.h"
-#include "wx/frame.h"
-
-/// Path separator.
-#ifdef __WXMSW__
-#define WXEXTHELP_SEPARATOR _T('\\')
-#elif defined(__WXMAC__)
-#define WXEXTHELP_SEPARATOR _T(':')
-#else
-#define WXEXTHELP_SEPARATOR _T('/')
-#endif
-
-class WXDLLEXPORT wxExtHelpMapList;
-
-
-/**
-   This class is the base class for all html help implementations.
-   It requires the name of a directory containing the documentation
-   and a file mapping numerical Section numbers to relative URLS.
-
-   The map file contains two or three fields per line:
-   numeric_id  relative_URL  [; comment/documentation]
-
-   The numeric_id is the id used to look up the entry in
-   DisplaySection()/DisplayBlock(). The relative_URL is a filename of
-   an html file, relative to the help directory. The optional
-   comment/documentation field (after a ';') is used for keyword
-   searches, so some meaningful text here does not hurt.
-   If the documentation itself contains a ';', only the part before
-   that will be displayed in the listbox, but all of it used for search.
-
-   Lines starting with ';' will be ignored.
-*/
-
-class WXDLLEXPORT wxHTMLHelpControllerBase : public wxHelpControllerBase
-{
-DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase)
-   public:
-   wxHTMLHelpControllerBase(void);
-   virtual ~wxHTMLHelpControllerBase(void);
-
-   /** This must be called to tell the controller where to find the
-       documentation.
-       If a locale is set, look in file/localename, i.e.
-       If passed "/usr/local/myapp/help" and the current wxLocale is
-       set to be "de", then look in "/usr/local/myapp/help/de/"
-       first and fall back to "/usr/local/myapp/help" if that
-       doesn't exist.
-
-       @param file - NOT a filename, but a directory name.
-       @return true on success
-   */
-   virtual bool Initialize(const wxString& dir, int WXUNUSED(server))
-      { return Initialize(dir); }
-
-   /** This must be called to tell the controller where to find the
-       documentation.
-       If a locale is set, look in file/localename, i.e.
-       If passed "/usr/local/myapp/help" and the current wxLocale is
-       set to be "de", then look in "/usr/local/myapp/help/de/"
-       first and fall back to "/usr/local/myapp/help" if that
-       doesn't exist.
-       @param dir - directory name where to fine the help files
-       @return true on success
-   */
-   virtual bool Initialize(const wxString& dir);
-
-   /** If file is "", reloads file given in Initialize.
-       @file Name of help directory.
-       @return true on success
-   */
-   virtual bool LoadFile(const wxString& file = wxT(""));
-
-   /** Display list of all help entries.
-       @return true on success
-   */
-   virtual bool DisplayContents(void);
-   /** Display help for id sectionNo.
-       @return true on success
-   */
-   virtual bool DisplaySection(int sectionNo);
-   /** Display help for id sectionNo -- identical with DisplaySection().
-       @return true on success
-   */
-   virtual bool DisplaySection(const wxString& section);
-   /** Display help for URL (using DisplayHelp) or keyword (using KeywordSearch)
-       @return true on success
-   */
-   virtual bool DisplayBlock(long blockNo);
-   /** Search comment/documentation fields in map file and present a
-       list to chose from.
-       @key k string to search for, empty string will list all entries
-       @return true on success
-   */
-   virtual bool KeywordSearch(const wxString& k);
-
-   /// does nothing
-   virtual bool Quit(void);
-   /// does nothing
-   virtual void OnQuit(void);
-
-   /// Call the browser using a relative URL.
-   virtual bool DisplayHelp(const wxString &) = 0;
-
-   /// Allows one to override the default settings for the help frame.
-   virtual void SetFrameParameters(const wxString& WXUNUSED(title),
-                                   const wxSize& WXUNUSED(size),
-                                   const wxPoint& WXUNUSED(pos) = wxDefaultPosition,
-                                   bool WXUNUSED(newFrameEachTime) = FALSE)
-      {
-         // does nothing by default
-      }
-   /// Obtains the latest settings used by the help frame and the help 
-   /// frame.
-   virtual wxFrame *GetFrameParameters(wxSize *WXUNUSED(size) = NULL,
-                                   wxPoint *WXUNUSED(pos) = NULL,
-                                   bool *WXUNUSED(newFrameEachTime) = NULL)
-      {
-         return (wxFrame*) NULL;// does nothing by default
-      }
-
- protected:
-   /// Filename of currently active map file.
-   wxString         m_MapFile;
-   /// How many entries do we have in the map file?
-   int              m_NumOfEntries;
-   /// A list containing all id,url,documentation triples.
-   wxList          *m_MapList;
-   /// Deletes the list and all objects.
-   void DeleteList(void);
-};
-
-#endif // wxUSE_HELP
-
-#endif // __WX_HELPHTML_H_
index 7541bb7e80b4a04428e20f9fe79cbd1fc2155b30..94cd2e597391beacac2a4f950fe547e7ba672f9c 100644 (file)
@@ -19,7 +19,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -357,7 +356,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -555,7 +553,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -757,7 +754,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index f6e3add7b5afc49dd8035357537d100ac733858e..d8649e494fcfd5461b30742ccb6e3cf0b407c297 100644 (file)
 #include <windows.h>
 #endif
 
-IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
+// ----------------------------------------------------------------------------
+// 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
+
+IMPLEMENT_CLASS(wxExtHelpController, wxHelpControllerBase)
 
 /// Name of environment variable to set help browser.
 #define   WXEXTHELP_ENVVAR_BROWSER   wxT("WX_HELPBROWSER")
@@ -57,8 +70,10 @@ IMPLEMENT_CLASS(wxExtHelpController, wxHTMLHelpControllerBase)
    and a file mapping numerical Section numbers to relative URLS.
 */
 
-wxExtHelpController::wxExtHelpController(void)
+wxExtHelpController::wxExtHelpController()
 {
+   m_MapList = (wxList*) NULL;
+   m_NumOfEntries = 0;
    m_BrowserName = WXEXTHELP_DEFAULTBROWSER;
    m_BrowserIsNetscape = WXEXTHELP_DEFAULTBROWSER_IS_NETSCAPE;
 
@@ -71,8 +86,12 @@ wxExtHelpController::wxExtHelpController(void)
    }
 }
 
+wxExtHelpController::~wxExtHelpController()
+{
+   DeleteList();
+}
 
-void wxExtHelpController::SetBrowser(wxString const & browsername, bool isNetscape)
+void wxExtHelpController::SetBrowser(const wxString& browsername, bool isNetscape)
 {
    m_BrowserName = browsername;
    m_BrowserIsNetscape = isNetscape;
@@ -163,5 +182,283 @@ wxExtHelpController::DisplayHelp(const wxString &relativeURL)
 #endif
 }
 
+class wxExtHelpMapEntry : public wxObject
+{
+public:
+   int      id;
+   wxString url;
+   wxString doc;
+   wxExtHelpMapEntry(int iid, wxString const &iurl, wxString const &idoc)
+      { id = iid; url = iurl; doc = idoc; }
+};
+
+void wxExtHelpController::DeleteList()
+{
+   if(m_MapList)
+   {
+      wxNode *node = m_MapList->GetFirst();
+      while (node)
+      {
+         delete (wxExtHelpMapEntry *)node->GetData();
+         delete node;
+         node = m_MapList->GetFirst();
+      }
+      delete m_MapList;
+      m_MapList = (wxList*) NULL;
+   }
+}
+
+/** This must be called to tell the controller where to find the
+    documentation.
+    @param file - NOT a filename, but a directory name.
+    @return true on success
+*/
+bool
+wxExtHelpController::Initialize(const wxString& file)
+{
+   return LoadFile(file);
+}
+
+
+// ifile is the name of the base help directory
+bool wxExtHelpController::LoadFile(const wxString& ifile)
+{
+   wxString mapFile, file, url, doc;
+   int id,i,len;
+   char buffer[WXEXTHELP_BUFLEN];
+
+   wxBusyCursor b; // display a busy cursor
+
+   if(! ifile.IsEmpty())
+   {
+      file = ifile;
+      if(! wxIsAbsolutePath(file))
+      {
+         wxChar* f = wxGetWorkingDirectory();
+         file = f;
+         delete[] f; // wxGetWorkingDirectory returns new memory
+#ifdef __WXMAC__
+         file << ifile;
+#else
+         file << WXEXTHELP_SEPARATOR << ifile;
+#endif
+      }
+      else
+         file = ifile;
+
+#if wxUSE_INTL
+      // If a locale is set, look in file/localename, i.e.
+      // If passed "/usr/local/myapp/help" and the current wxLocale is
+      // set to be "de", then look in "/usr/local/myapp/help/de/"
+      // first and fall back to "/usr/local/myapp/help" if that
+      // doesn't exist.
+      if(wxGetLocale() && !wxGetLocale()->GetName().IsEmpty())
+      {
+         wxString newfile;
+         newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
+         if(wxDirExists(newfile))
+            file = newfile;
+         else
+         {
+            newfile = WXEXTHELP_SEPARATOR;
+            const wxChar *cptr = wxGetLocale()->GetName().c_str();
+            while(*cptr && *cptr != wxT('_'))
+               newfile << *(cptr++);
+            if(wxDirExists(newfile))
+               file = newfile;
+         }
+      }
+#endif
+
+      if(! wxDirExists(file))
+         return FALSE;
+
+      mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
+   }
+   else // try to reload old file
+      mapFile = m_MapFile;
+
+   if(! wxFileExists(mapFile))
+      return FALSE;
+
+   DeleteList();
+   m_MapList = new wxList;
+   m_NumOfEntries = 0;
+
+   FILE *input = wxFopen(mapFile,wxT("rt"));
+   if(! input)
+      return FALSE;
+   do
+   {
+      if(fgets(buffer,WXEXTHELP_BUFLEN,input) && *buffer != WXEXTHELP_COMMENTCHAR)
+      {
+         len = strlen(buffer);
+         if(buffer[len-1] == '\n')
+            buffer[len-1] = '\0'; // cut of trailing newline
+         if(sscanf(buffer,"%d", &id) != 1)
+            break; // error
+         for(i=0; isdigit(buffer[i])||isspace(buffer[i])||buffer[i]=='-'; i++)
+            ; // find begin of URL
+         url = wxT("");
+         while(buffer[i] && ! isspace(buffer[i]) && buffer[i] !=
+               WXEXTHELP_COMMENTCHAR)
+            url << (wxChar) buffer[i++];
+         while(buffer[i] && buffer[i] != WXEXTHELP_COMMENTCHAR)
+            i++;
+         doc = wxT("");
+         if(buffer[i])
+            doc = wxString::FromAscii( (buffer + i + 1) ); // skip the comment character
+         m_MapList->Append(new wxExtHelpMapEntry(id,url,doc));
+         m_NumOfEntries++;
+      }
+   }while(! feof(input));
+   fclose(input);
+
+   m_MapFile = file; // now it's valid
+   return TRUE;
+}
+
+
+bool
+wxExtHelpController::DisplayContents()
+{
+   if(! m_NumOfEntries)
+      return FALSE;
+
+   wxString contents;
+   wxNode *node = m_MapList->GetFirst();
+   wxExtHelpMapEntry *entry;
+   while(node)
+   {
+      entry = (wxExtHelpMapEntry *)node->GetData();
+      if(entry->id == CONTENTS_ID)
+      {
+         contents = entry->url;
+         break;
+      }
+      node = node->GetNext();
+   }
+
+   bool rc = FALSE;
+   wxString file;
+   file << m_MapFile << WXEXTHELP_SEPARATOR << contents;
+   if(file.Contains(wxT('#')))
+      file = file.BeforeLast(wxT('#'));
+   if(contents.Length() && wxFileExists(file))
+      rc = DisplaySection(CONTENTS_ID);
+
+   // if not found, open homemade toc:
+   return rc ? TRUE : KeywordSearch(wxT(""));
+}
+
+bool
+wxExtHelpController::DisplaySection(int sectionNo)
+{
+   if(! m_NumOfEntries)
+      return FALSE;
+
+   wxBusyCursor b; // display a busy cursor
+   wxNode *node = m_MapList->GetFirst();
+   wxExtHelpMapEntry *entry;
+   while(node)
+   {
+      entry = (wxExtHelpMapEntry *)node->GetData();
+      if(entry->id == sectionNo)
+         return DisplayHelp(entry->url);
+      node = node->GetNext();
+   }
+   return FALSE;
+}
+
+bool wxExtHelpController::DisplaySection(const wxString& section)
+{
+    bool isFilename = (section.Find(wxT(".htm")) != -1);
+
+    if (isFilename)
+        return DisplayHelp(section);
+    else
+        return KeywordSearch(section);
+}
+
+bool
+wxExtHelpController::DisplayBlock(long blockNo)
+{
+   return DisplaySection((int)blockNo);
+}
+
+bool
+wxExtHelpController::KeywordSearch(const wxString& k)
+{
+   if(! m_NumOfEntries)
+      return FALSE;
+
+   wxString     *choices = new wxString[m_NumOfEntries];
+   wxString     *urls = new wxString[m_NumOfEntries];
+   wxString compA, compB;
+
+   int          idx = 0, j;
+   bool         rc;
+   bool         showAll = k.IsEmpty();
+   wxNode       *node = m_MapList->GetFirst();
+   wxExtHelpMapEntry *entry;
+
+   {
+      wxBusyCursor b; // display a busy cursor
+      compA = k; compA.LowerCase(); // we compare case insensitive
+      while(node)
+      {
+         entry = (wxExtHelpMapEntry *)node->GetData();
+         compB = entry->doc; compB.LowerCase();
+         if((showAll || compB.Contains(k)) && ! compB.IsEmpty())
+         {
+            urls[idx] = entry->url;
+            // doesn't work:
+            // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
+            //if(choices[idx].IsEmpty()) // didn't contain the ';'
+            //   choices[idx] = (**i).doc;
+            choices[idx] = wxT("");
+            for(j=0;entry->doc.c_str()[j]
+                   && entry->doc.c_str()[j] != WXEXTHELP_COMMENTCHAR; j++)
+               choices[idx] << entry->doc.c_str()[j];
+            idx++;
+         }
+         node = node->GetNext();
+      }
+   }
+
+   if(idx == 1)
+      rc = DisplayHelp(urls[0]);
+   else if(idx == 0)
+   {
+      wxMessageBox(_("No entries found."));
+      rc = FALSE;
+   }
+   else
+   {
+      idx = wxGetSingleChoiceIndex(showAll ? _("Help Index") : _("Relevant entries:"),
+                                   showAll ? _("Help Index") : _("Entries found"),
+                                   idx,choices);
+      if(idx != -1)
+         rc = DisplayHelp(urls[idx]);
+      else
+         rc = FALSE;
+   }
+   delete[] urls;
+   delete[] choices;
+
+   return rc;
+}
+
+
+bool wxExtHelpController::Quit()
+{
+   return TRUE;
+}
+
+void wxExtHelpController::OnQuit()
+{
+}
+
+
 #endif // wxUSE_HELP
 
diff --git a/src/generic/helphtml.cpp b/src/generic/helphtml.cpp
deleted file mode 100644 (file)
index 8378a14..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        helphtml.cpp
-// Purpose:     base class for html help systems
-// Author:      Karsten Ballueder
-// Modified by:
-// Created:     04/01/98
-// RCS-ID:      $Id$
-// Copyright:   (c) Karsten Ballueder
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifdef __GNUG__
-#   pragma implementation "helphtml.h"
-#endif
-
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
-    #pragma hdrstop
-#endif
-
-#if wxUSE_HELP
-
-#ifndef WX_PRECOMP
-    #include "wx/setup.h"
-    #include "wx/string.h"
-    #include "wx/utils.h"
-    #include "wx/list.h"
-    #include "wx/intl.h"
-    #include "wx/msgdlg.h"
-    #include "wx/choicdlg.h"
-#endif
-
-#include "wx/helpbase.h"
-#include "wx/generic/helpext.h"
-
-#include <stdio.h>
-#include <ctype.h>
-#ifndef __MWERKS__
-#include <sys/stat.h>
-#endif
-
-#if !defined(__WINDOWS__) && !defined(__OS2__)
-    #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
-{
-public:
-   int      id;
-   wxString url;
-   wxString doc;
-   wxExtHelpMapEntry(int iid, wxString const &iurl, wxString const &idoc)
-      { id = iid; url = iurl; doc = idoc; }
-};
-
-IMPLEMENT_ABSTRACT_CLASS(wxHTMLHelpControllerBase, wxHelpControllerBase)
-
-/**
-   This class implements help via an external browser.
-   It requires the name of a directory containing the documentation
-   and a file mapping numerical Section numbers to relative URLS.
-*/
-
-wxHTMLHelpControllerBase::wxHTMLHelpControllerBase()
-{
-   m_MapList = (wxList*) NULL;
-   m_NumOfEntries = 0;
-}
-
-void
-wxHTMLHelpControllerBase::DeleteList()
-{
-   if(m_MapList)
-   {
-      wxNode *node = m_MapList->GetFirst();
-      while (node)
-      {
-         delete (wxExtHelpMapEntry *)node->GetData();
-         delete node;
-         node = m_MapList->GetFirst();
-      }
-      delete m_MapList;
-      m_MapList = (wxList*) NULL;
-   }
-}
-
-wxHTMLHelpControllerBase::~wxHTMLHelpControllerBase()
-{
-   DeleteList();
-}
-
-/** This must be called to tell the controller where to find the
-    documentation.
-    @param file - NOT a filename, but a directory name.
-    @return true on success
-*/
-bool
-wxHTMLHelpControllerBase::Initialize(const wxString& file)
-{
-   return LoadFile(file);
-}
-
-
-// ifile is the name of the base help directory
-bool
-wxHTMLHelpControllerBase::LoadFile(const wxString& ifile)
-{
-   wxString mapFile, file, url, doc;
-   int id,i,len;
-   char buffer[WXEXTHELP_BUFLEN];
-
-   wxBusyCursor b; // display a busy cursor
-
-   if(! ifile.IsEmpty())
-   {
-      file = ifile;
-      if(! wxIsAbsolutePath(file))
-      {
-         wxChar* f = wxGetWorkingDirectory();
-         file = f;
-         delete[] f; // wxGetWorkingDirectory returns new memory
-#ifdef __WXMAC__
-         file << ifile;
-#else
-         file << WXEXTHELP_SEPARATOR << ifile;
-#endif
-      }
-      else
-         file = ifile;
-
-#if wxUSE_INTL
-      // If a locale is set, look in file/localename, i.e.
-      // If passed "/usr/local/myapp/help" and the current wxLocale is
-      // set to be "de", then look in "/usr/local/myapp/help/de/"
-      // first and fall back to "/usr/local/myapp/help" if that
-      // doesn't exist.
-      if(wxGetLocale() && !wxGetLocale()->GetName().IsEmpty())
-      {
-         wxString newfile;
-         newfile << WXEXTHELP_SEPARATOR << wxGetLocale()->GetName();
-         if(wxDirExists(newfile))
-            file = newfile;
-         else
-         {
-            newfile = WXEXTHELP_SEPARATOR;
-            const wxChar *cptr = wxGetLocale()->GetName().c_str();
-            while(*cptr && *cptr != wxT('_'))
-               newfile << *(cptr++);
-            if(wxDirExists(newfile))
-               file = newfile;
-         }
-      }
-#endif
-
-      if(! wxDirExists(file))
-         return FALSE;
-
-      mapFile << file << WXEXTHELP_SEPARATOR << WXEXTHELP_MAPFILE;
-   }
-   else // try to reload old file
-      mapFile = m_MapFile;
-
-   if(! wxFileExists(mapFile))
-      return FALSE;
-
-   DeleteList();
-   m_MapList = new wxList;
-   m_NumOfEntries = 0;
-
-   FILE *input = wxFopen(mapFile,wxT("rt"));
-   if(! input)
-      return FALSE;
-   do
-   {
-      if(fgets(buffer,WXEXTHELP_BUFLEN,input) && *buffer != WXEXTHELP_COMMENTCHAR)
-      {
-         len = strlen(buffer);
-         if(buffer[len-1] == '\n')
-            buffer[len-1] = '\0'; // cut of trailing newline
-         if(sscanf(buffer,"%d", &id) != 1)
-            break; // error
-         for(i=0; isdigit(buffer[i])||isspace(buffer[i])||buffer[i]=='-'; i++)
-            ; // find begin of URL
-         url = wxT("");
-         while(buffer[i] && ! isspace(buffer[i]) && buffer[i] !=
-               WXEXTHELP_COMMENTCHAR)
-            url << (wxChar) buffer[i++];
-         while(buffer[i] && buffer[i] != WXEXTHELP_COMMENTCHAR)
-            i++;
-         doc = wxT("");
-         if(buffer[i])
-            doc = wxString::FromAscii( (buffer + i + 1) ); // skip the comment character
-         m_MapList->Append(new wxExtHelpMapEntry(id,url,doc));
-         m_NumOfEntries++;
-      }
-   }while(! feof(input));
-   fclose(input);
-
-   m_MapFile = file; // now it's valid
-   return TRUE;
-}
-
-
-bool
-wxHTMLHelpControllerBase::DisplayContents()
-{
-   if(! m_NumOfEntries)
-      return FALSE;
-
-   wxString contents;
-   wxNode *node = m_MapList->GetFirst();
-   wxExtHelpMapEntry *entry;
-   while(node)
-   {
-      entry = (wxExtHelpMapEntry *)node->GetData();
-      if(entry->id == CONTENTS_ID)
-      {
-         contents = entry->url;
-         break;
-      }
-      node = node->GetNext();
-   }
-
-   bool rc = FALSE;
-   wxString file;
-   file << m_MapFile << WXEXTHELP_SEPARATOR << contents;
-   if(file.Contains(wxT('#')))
-      file = file.BeforeLast(wxT('#'));
-   if(contents.Length() && wxFileExists(file))
-      rc = DisplaySection(CONTENTS_ID);
-
-   // if not found, open homemade toc:
-   return rc ? TRUE : KeywordSearch(wxT(""));
-}
-
-bool
-wxHTMLHelpControllerBase::DisplaySection(int sectionNo)
-{
-   if(! m_NumOfEntries)
-      return FALSE;
-
-   wxBusyCursor b; // display a busy cursor
-   wxNode *node = m_MapList->GetFirst();
-   wxExtHelpMapEntry *entry;
-   while(node)
-   {
-      entry = (wxExtHelpMapEntry *)node->GetData();
-      if(entry->id == sectionNo)
-         return DisplayHelp(entry->url);
-      node = node->GetNext();
-   }
-   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)
-{
-   return DisplaySection((int)blockNo);
-}
-
-bool
-wxHTMLHelpControllerBase::KeywordSearch(const wxString& k)
-{
-   if(! m_NumOfEntries)
-      return FALSE;
-
-   wxString     *choices = new wxString[m_NumOfEntries];
-   wxString     *urls = new wxString[m_NumOfEntries];
-   wxString compA, compB;
-
-   int          idx = 0, j;
-   bool         rc;
-   bool         showAll = k.IsEmpty();
-   wxNode       *node = m_MapList->GetFirst();
-   wxExtHelpMapEntry *entry;
-
-   {
-      wxBusyCursor b; // display a busy cursor
-      compA = k; compA.LowerCase(); // we compare case insensitive
-      while(node)
-      {
-         entry = (wxExtHelpMapEntry *)node->GetData();
-         compB = entry->doc; compB.LowerCase();
-         if((showAll || compB.Contains(k)) && ! compB.IsEmpty())
-         {
-            urls[idx] = entry->url;
-            // doesn't work:
-            // choices[idx] = (**i).doc.Contains((**i).doc.Before(WXEXTHELP_COMMENTCHAR));
-            //if(choices[idx].IsEmpty()) // didn't contain the ';'
-            //   choices[idx] = (**i).doc;
-            choices[idx] = wxT("");
-            for(j=0;entry->doc.c_str()[j]
-                   && entry->doc.c_str()[j] != WXEXTHELP_COMMENTCHAR; j++)
-               choices[idx] << entry->doc.c_str()[j];
-            idx++;
-         }
-         node = node->GetNext();
-      }
-   }
-
-   if(idx == 1)
-      rc = DisplayHelp(urls[0]);
-   else if(idx == 0)
-   {
-      wxMessageBox(_("No entries found."));
-      rc = FALSE;
-   }
-   else
-   {
-      idx = wxGetSingleChoiceIndex(showAll ? _("Help Index") : _("Relevant entries:"),
-                                   showAll ? _("Help Index") : _("Entries found"),
-                                   idx,choices);
-      if(idx != -1)
-         rc = DisplayHelp(urls[idx]);
-      else
-         rc = FALSE;
-   }
-   delete[] urls;
-   delete[] choices;
-
-   return rc;
-}
-
-
-bool
-wxHTMLHelpControllerBase::Quit()
-{
-   return TRUE;
-}
-
-void
-wxHTMLHelpControllerBase::OnQuit()
-{
-}
-
-#endif // wxUSE_HELP
index 10b246e187332fa622a297d00031203ede36a5b4..359a021ad48f10f04cae727bb6c2b263c106cae6 100644 (file)
@@ -19,7 +19,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -371,7 +370,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -588,7 +586,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -787,7 +784,6 @@ GUIOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
@@ -895,7 +891,6 @@ GUI_LOWLEVEL_OBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 10b246e187332fa622a297d00031203ede36a5b4..359a021ad48f10f04cae727bb6c2b263c106cae6 100644 (file)
@@ -19,7 +19,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -371,7 +370,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -588,7 +586,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -787,7 +784,6 @@ GUIOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
@@ -895,7 +891,6 @@ GUI_LOWLEVEL_OBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 4851d871fc51472669724c094bed7867e2af72ea..446c67b3482a578f0788e3687fa87ee1ceab3531 100644 (file)
@@ -17,7 +17,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -372,7 +371,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -608,7 +606,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -806,7 +803,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 4851d871fc51472669724c094bed7867e2af72ea..446c67b3482a578f0788e3687fa87ee1ceab3531 100644 (file)
@@ -17,7 +17,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -372,7 +371,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -608,7 +606,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -806,7 +803,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 4415e7ef86a0c132b1d9ed77285e8d1fdc5094d9..144e894db8d205b06590df5fcdac19f528d7f8cb 100644 (file)
@@ -19,7 +19,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -330,7 +329,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -505,7 +503,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -707,7 +704,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 0295655a68600355bd0c00bd59c7f35ad880e485..2bc3205bfdf1108cea08af07249b6fccb6728f65 100644 (file)
@@ -17,7 +17,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -368,7 +367,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -577,7 +575,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -781,7 +778,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index 8e663169b31903cc0774aab55d225791616d894b..67153e59c3d5bfe867cb3f3a2b3f83c79dbefb3e 100644 (file)
@@ -391,7 +391,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -646,7 +645,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
index 999fd35918cb1c87346dcfd0c4375c5b583b0619..5efee17b82335f66c626947b849638b0acba10e6 100644 (file)
@@ -15,7 +15,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -367,7 +366,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -591,7 +589,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -783,7 +780,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \
index ad1bf5cbc3c4b219af3784b1f050bf7db6541174..a7d9c25cf2cd1ec2f3346e209a2400b7b262e456 100644 (file)
@@ -51,7 +51,6 @@ ALL_SOURCES = \
                generic/gridctrl.cpp \
                generic/gridsel.cpp \
                generic/helpext.cpp \
-               generic/helphtml.cpp \
                generic/imaglist.cpp \
                generic/laywin.cpp \
                generic/listctrl.cpp \
@@ -341,7 +340,6 @@ ALL_HEADERS = \
                hashmap.h \
                help.h \
                helpbase.h \
-               helphtml.h \
                helpwin.h \
                icon.h \
                iconbndl.h \
@@ -564,7 +562,6 @@ ALL_HEADERS = \
                generic/gridctrl.h \
                generic/gridg.h \
                generic/helpext.h \
-               generic/helphtml.h \
                generic/imaglist.h \
                generic/laywin.h \
                generic/listctrl.h \
@@ -800,7 +797,6 @@ GENERICOBJS = \
                gridctrl.o \
                gridsel.o \
                helpext.o \
-               helphtml.o \
                imaglist.o \
                laywin.o \
                listctrl.o \