]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/helpview/src/helpview.cpp
No changes, just fix a typo in a comment in docview event handling code.
[wxWidgets.git] / utils / helpview / src / helpview.cpp
index d16e92f0ff7e7b0ea57d382fa7c6675f709da1f7..4b445e00651ae96803a0bb53071546aff7e96c0a 100644 (file)
@@ -5,15 +5,10 @@
 // Author:      Vaclav Slavik, Julian Smart
 // Modified by:
 // Created:     2002-07-09
 // Author:      Vaclav Slavik, Julian Smart
 // Modified by:
 // Created:     2002-07-09
-// RCS-ID:      $Id$
 // Copyright:   (c) 2002 Vaclav Slavik, Julian Smart and others
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // Copyright:   (c) 2002 Vaclav Slavik, Julian Smart and others
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "help.cpp"
-#endif
-
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
 // For compilers that support precompilation, includes "wx/wx.h".
 #include "wx/wxprec.h"
 
 #endif
 
 // for all others, include the necessary headers (this file is usually all you
 #endif
 
 // for all others, include the necessary headers (this file is usually all you
-// need because it includes almost all "standard" wxWindows headers
+// need because it includes almost all "standard" wxWidgets headers
 #ifndef WX_PRECOMP
 #include "wx/wx.h"
 #endif
 
 #ifndef WX_PRECOMP
 #include "wx/wx.h"
 #endif
 
+#include "wx/filename.h"
 #include "wx/image.h"
 #include "wx/wxhtml.h"
 #include "wx/fs_zip.h"
 #include "wx/image.h"
 #include "wx/wxhtml.h"
 #include "wx/fs_zip.h"
@@ -47,7 +43,7 @@ IMPLEMENT_APP(hvApp)
 
 hvApp::hvApp()
 {
 
 hvApp::hvApp()
 {
-#if hvUSE_IPC
+#if wxUSE_IPC
     m_server = NULL;
 #endif
 }
     m_server = NULL;
 #endif
 }
@@ -57,27 +53,33 @@ bool hvApp::OnInit()
 #ifdef __WXMOTIF__
     delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
 #endif
 #ifdef __WXMOTIF__
     delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
 #endif
-       
-    wxArtProvider::PushProvider(new AlternateArtProvider);
-       
-       int istyle = wxHF_DEFAULT_STYLE;
-       
-    wxArtProvider::PushProvider(new AlternateArtProvider);
-       
-    wxString service, windowName, book[10], titleFormat, argStr;
+
+    wxArtProvider::Push(new AlternateArtProvider);
+
+#if defined( __WXOSX_MAC__ ) && wxOSX_USE_CARBON
+    wxApp::s_macAboutMenuItemId = wxID_ABOUT;
+    wxFileName::MacRegisterDefaultTypeAndCreator( wxT("htb") , 'HTBD' , 'HTBA' ) ;
+#endif
+
+    int istyle = wxHF_DEFAULT_STYLE;
+
+    wxString service, windowName, titleFormat, argStr;
+    wxString book[10];
     int bookCount = 0;
     int i;
     int bookCount = 0;
     int i;
-    bool hasService = FALSE;
-    bool hasWindowName = FALSE;
-    bool createServer = FALSE;
-       
+    bool hasService = false;
+    bool hasWindowName = false;
+    bool createServer = false;
+
+#if wxUSE_IPC
     m_server = NULL;
     m_server = NULL;
-       
+#endif
+
     // Help books are recognized by extension ".hhp" ".htb" or ".zip".
     // Service and window_name can occur anywhere in arguments,
     // but service must be first
     // Other arguments (topic?) could be added
     // Help books are recognized by extension ".hhp" ".htb" or ".zip".
     // Service and window_name can occur anywhere in arguments,
     // but service must be first
     // Other arguments (topic?) could be added
-       
+
     //  modes of operation:
     //  1) no arguments - stand alone, prompt user for book
     //  2) books only - stand alone, open books
     //  modes of operation:
     //  1) no arguments - stand alone, prompt user for book
     //  2) books only - stand alone, open books
@@ -86,157 +88,164 @@ bool hvApp::OnInit()
     //  4) at least one argument which is not book, and not "--server" - take first
     //     such argument as service, second (if present) as window name,
     //     start service, open any books
     //  4) at least one argument which is not book, and not "--server" - take first
     //     such argument as service, second (if present) as window name,
     //     start service, open any books
-       
-    for( i=1; i < argc; i++ )
+
+    for( i=1; i<argc; i++ )
     {
     {
-               argStr = argv[i];
-               
-               if ( argStr.Find( wxT(".hhp") ) >= 0 ||
-                       argStr.Find( wxT(".htb") ) >= 0 ||
-                       argStr.Find( wxT(".zip") ) >= 0 ) {
-                       book[bookCount] = argStr;
-                       bookCount++; 
-               }
-               else if ( argStr == wxT("--server") )
-               {
-                       createServer = TRUE;
+        argStr = argv[i];
+
+        if ( argStr.Find( wxT(".hhp") ) >= 0
+            || argStr.Find( wxT(".htb") ) >= 0
+            || argStr.Find( wxT(".zip") ) >= 0 )
+        {
+            book[bookCount] = argStr;
+            bookCount++;
+        }
+        else if ( argStr == wxT("--server") )
+        {
+            createServer = true;
 #if defined(__WXMSW__)
 #if defined(__WXMSW__)
-                       service = wxT("generic_helpservice");
+            service = wxT("generic_helpservice");
 #elif defined(__UNIX__)
 #elif defined(__UNIX__)
-                       service = wxT("/tmp/") + wxString(wxT("generic_helpservice"));
+            service = wxT("/tmp/") + wxString(wxT("generic_helpservice"));
 #else
 #else
-                       service = wxT("4242");
+            service = wxT("4242");
 #endif
 #endif
-               }
-               else if ( !hasService )
-               {
-                       service = argStr;
-                       hasService = TRUE;
-                       createServer = TRUE;
-               }
-               else if ( !hasWindowName )
-               {
-                       windowName = argStr;
-                       hasWindowName = TRUE;
-               }
-               else if ( argStr.Find( wxT("--Style") )  >= 0 )
-               {
-                       long i;
-                       wxString numb = argStr.AfterLast(wxT('e'));
-                       if ( !(numb.ToLong(&i) ) )
-                       {
-                               wxLogError( wxT("Integer conversion failed for --Style") );
-                       }
-                       else
-                       {
-                               istyle = i;
-                       }
-               }
-               else
-               {
-                       //unknown - could be topic?
-               }
+        }
+        else if ( !hasService )
+        {
+            service = argStr;
+            hasService = true;
+            createServer = true;
+        }
+        else if ( !hasWindowName )
+        {
+            windowName = argStr;
+            hasWindowName = true;
+        }
+        else if ( argStr.Find( wxT("--Style") )  >= 0 )
+        {
+            long i;
+            wxString numb = argStr.AfterLast(wxT('e'));
+            if ( !(numb.ToLong(&i) ) )
+            {
+                wxLogError( wxT("Integer conversion failed for --Style") );
+            }
+            else
+            {
+                istyle = i;
+            }
+        }
+        else
+        {
+            //unknown - could be topic?
+        }
     }
     }
-       
-    //no book - query user
+
+    // No book - query user; but not on Mac, since there
+    // may be an AppleEvent to open a document on the way
+#ifndef __WXMAC__
     if ( bookCount < 1 )
     {
     if ( bookCount < 1 )
     {
-               wxString s = wxFileSelector( wxT("Open help file"),
-                       wxGetCwd(),
-                       wxEmptyString,
-                       wxEmptyString,
-                       wxT(
-                       "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\
-                       HTML Help Project (*.hhp)|*.hhp"),
-                       wxOPEN | wxFILE_MUST_EXIST,
-                       NULL);
-               
-               if (!s.IsEmpty())
-               {
-                       book[0] = s;
-                       bookCount = 1;
-               }
-    } 
-       
-#if hvUSE_IPC
-       
-    if ( createServer ) {
-               // Create a new server
-               m_server = new hvServer;
-               
-               if ( !m_server->Create(service) ) {
-                       wxString wxm = wxT("Server Create failed - service: ");
-                       wxString xxm = wxm << service;
-                       wxLogError( xxm );
-                       //if MSW quits here, probably another copy already exists
-                       return FALSE;
-                       
-               }
-               createServer = FALSE; 
+        wxString s = wxFileSelector( wxT("Open help file"),
+            wxGetCwd(),
+            wxEmptyString,
+            wxEmptyString,
+            wxT("Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|HTML Help Project (*.hhp)|*.hhp"),
+            wxFD_OPEN | wxFD_FILE_MUST_EXIST,
+            NULL);
+
+        if (!s.empty())
+        {
+            book[0] = s;
+            bookCount = 1;
+        }
     }
     }
-       
-#endif  // hvUSE_IPC
-       
+#endif
+
+#if wxUSE_IPC
+
+    if ( createServer )
+    {
+        // Create a new server
+        m_server = new hvServer;
+
+        if ( !m_server->Create(service) )
+        {
+            wxString wxm = wxT("Server Create failed - service: ");
+            wxString xxm = wxm << service;
+            wxLogError( xxm );
+            //if MSW quits here, probably another copy already exists
+            return false;
+        }
+        createServer = false;
+        wxUnusedVar(createServer);
+    }
+
+#endif  // wxUSE_IPC
+
     //now add help
     wxInitAllImageHandlers();
     //now add help
     wxInitAllImageHandlers();
-    wxFileSystem::AddHandler(new wxZipFSHandler); 
-       
-    SetVendorName(wxT("wxWindows") );
-    SetAppName(wxT("wxHTMLHelpServer") ); 
+    wxFileSystem::AddHandler(new wxZipFSHandler);
+
+    SetVendorName(wxT("wxWidgets") );
+    SetAppName(wxT("wxHTMLHelpServer") );
     wxConfig::Get(); // create an instance
     wxConfig::Get(); // create an instance
-       
+
     m_helpController = new wxHtmlHelpController( istyle );
     m_helpController = new wxHtmlHelpController( istyle );
-       
+
     if ( !hasWindowName )
     if ( !hasWindowName )
+    {
         titleFormat = wxT("Help: %s") ;
         titleFormat = wxT("Help: %s") ;
+    }
     else
     {
     else
     {
-               //remove underscores
-               windowName.Replace( wxT("_"), wxT(" ") );
-               titleFormat = windowName;
+        //remove underscores
+        windowName.Replace( wxT("_"), wxT(" ") );
+        titleFormat = windowName;
     }
     }
-       
+
     m_helpController->SetTitleFormat( titleFormat );
     m_helpController->SetTitleFormat( titleFormat );
-       
-    for( i=0; i < bookCount; i++ )
+
+    for( i=0; i<bookCount; i++ )
     {
     {
-               m_helpController->AddBook(book[i]);
+        wxFileName fileName(book[i]);
+        m_helpController->AddBook(fileName);
     }
     }
-       
+
 #ifdef __WXMOTIF__
     delete wxLog::SetActiveTarget(new wxLogGui);
 #endif
 #ifdef __WXMOTIF__
     delete wxLog::SetActiveTarget(new wxLogGui);
 #endif
-       
-    m_helpController -> DisplayContents();
-       
-    return TRUE;
+
+    m_helpController->DisplayContents();
+
+    return true;
 }
 
 
 int hvApp::OnExit()
 {
 }
 
 
 int hvApp::OnExit()
 {
-#if hvUSE_IPC
-    wxNode* node = m_connections.First();
+#if wxUSE_IPC
+    wxObjectList::compatibility_iterator node = m_connections.GetFirst();
     while (node)
     {
     while (node)
     {
-        wxNode* next = node->Next();
-        hvConnection* connection = (hvConnection*) node->Data();
+        wxObjectList::compatibility_iterator next = node->GetNext();
+        hvConnection* connection = (hvConnection*) node->GetData();
         connection->Disconnect();
         delete connection;
         node = next;
     }
     m_connections.Clear();
         connection->Disconnect();
         delete connection;
         node = next;
     }
     m_connections.Clear();
-       
+
     if (m_server)
     {
         delete m_server;
         m_server = NULL;
     }
 #endif
     if (m_server)
     {
         delete m_server;
         m_server = NULL;
     }
 #endif
-       
+
     delete m_helpController;
     delete wxConfig::Set(NULL);
     delete m_helpController;
     delete wxConfig::Set(NULL);
-       
+
     return 0;
 }
 
     return 0;
 }
 
@@ -247,24 +256,38 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller)
         wxEmptyString,
         wxEmptyString,
         _(
         wxEmptyString,
         wxEmptyString,
         _(
-               "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\
-               HTML Help Project (*.hhp)|*.hhp"),
-               wxOPEN | wxFILE_MUST_EXIST,
-               NULL);
-       
-    if (!s.IsEmpty())
+        "Help books (*.htb)|*.htb|Help books (*.zip)|*.zip|\
+        HTML Help Project (*.hhp)|*.hhp"),
+        wxFD_OPEN | wxFD_FILE_MUST_EXIST,
+        NULL);
+
+    if ( !s.empty() )
     {
         wxString ext = s.Right(4).Lower();
     {
         wxString ext = s.Right(4).Lower();
-        if (ext == _T(".zip") || ext == _T(".htb") || ext == _T(".hhp"))
+        if (ext == wxT(".zip") || ext == wxT(".htb") || ext == wxT(".hhp"))
         {
             wxBusyCursor bcur;
         {
             wxBusyCursor bcur;
-            controller->AddBook(s);
-            return TRUE;
+            wxFileName fileName(s);
+            controller->AddBook(fileName);
+            return true;
         }
     }
         }
     }
-    return FALSE;
+
+    return false;
 }
 
 }
 
+#ifdef __WXMAC__
+/// Respond to Apple Event for opening a document
+void hvApp::MacOpenFiles(const wxArrayString& fileNames)
+{
+    wxBusyCursor bcur;
+    wxFileName fileName(fileNames[0]);
+    m_helpController->AddBook(fileName);
+    m_helpController->DisplayContents();
+}
+#endif
+
+
 /*
 * Art provider class
 */
 /*
 * Art provider class
 */
@@ -277,22 +300,7 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller)
 #define ART(artId, xpmRc) \
 if ( id == artId ) return wxBitmap(xpmRc##_xpm);
 
 #define ART(artId, xpmRc) \
 if ( id == artId ) return wxBitmap(xpmRc##_xpm);
 
-// Compatibility hack to use wxApp::GetStdIcon of overriden by the user
-#if WXWIN_COMPATIBILITY_2_2
-#define GET_STD_ICON_FROM_APP(iconId) \
-       if ( client == wxART_MESSAGE_BOX ) \
-{ \
-       wxIcon icon = wxTheApp->GetStdIcon(iconId); \
-       if ( icon.Ok() ) \
-{ \
-       wxBitmap bmp; \
-       bmp.CopyFromIcon(icon); \
-       return bmp; \
-} \
-}
-#else
 #define GET_STD_ICON_FROM_APP(iconId)
 #define GET_STD_ICON_FROM_APP(iconId)
-#endif
 
 // There are two ways of getting the standard icon: either via XPMs or via
 // wxIcon ctor. This depends on the platform:
 
 // There are two ways of getting the standard icon: either via XPMs or via
 // wxIcon ctor. This depends on the platform:
@@ -303,10 +311,10 @@ if ( id == artId ) return wxBitmap(xpmRc##_xpm);
 #else
 #define CREATE_STD_ICON(iconId, xpmRc) \
 { \
 #else
 #define CREATE_STD_ICON(iconId, xpmRc) \
 { \
-       wxIcon icon(_T(iconId)); \
-       wxBitmap bmp; \
-       bmp.CopyFromIcon(icon); \
-       return bmp; \
+    wxIcon icon(wxT(iconId)); \
+    wxBitmap bmp; \
+    bmp.CopyFromIcon(icon); \
+    return bmp; \
 }
 #endif
 
 }
 #endif
 
@@ -314,8 +322,8 @@ if ( id == artId ) return wxBitmap(xpmRc##_xpm);
 #define ART_MSGBOX(artId, iconId, xpmRc) \
     if ( id == artId ) \
 { \
 #define ART_MSGBOX(artId, iconId, xpmRc) \
     if ( id == artId ) \
 { \
-       GET_STD_ICON_FROM_APP(iconId) \
-       CREATE_STD_ICON(#iconId, xpmRc) \
+    GET_STD_ICON_FROM_APP(iconId) \
+    CREATE_STD_ICON(#iconId, xpmRc) \
 }
 
 // ---------------------------------------------------------------------
 }
 
 // ---------------------------------------------------------------------
@@ -348,32 +356,32 @@ wxBitmap AlternateArtProvider::CreateBitmap(const wxArtID& id,
                                             const wxSize& WXUNUSED(size))
 {
     ART(wxART_HELP_SIDE_PANEL,                     helpsidepanel)
                                             const wxSize& WXUNUSED(size))
 {
     ART(wxART_HELP_SIDE_PANEL,                     helpsidepanel)
-               ART(wxART_HELP_SETTINGS,                       helpoptions)
-               ART(wxART_HELP_BOOK,                           helpbook)
-               ART(wxART_HELP_FOLDER,                         helpbook)
-               ART(wxART_HELP_PAGE,                           helppage)
-               //ART(wxART_ADD_BOOKMARK,                        addbookm)
-               //ART(wxART_DEL_BOOKMARK,                        delbookm)
-               ART(wxART_GO_BACK,                             helpback)
-               ART(wxART_GO_FORWARD,                          helpforward)
-               ART(wxART_GO_UP,                               helpup)
-               ART(wxART_GO_DOWN,                             helpdown)
-               ART(wxART_GO_TO_PARENT,                        helpuplevel)
-               ART(wxART_FILE_OPEN,                           helpopen)
-               if (client == wxART_HELP_BROWSER)
-               {
-                       //ART(wxART_FRAME_ICON,                          helpicon)
-                       ART(wxART_HELP,                          helpicon)
-               }
-               
-               //ART(wxART_GO_HOME,                             home)
-               
-               // Any wxWindows icons not implemented here
-               // will be provided by the default art provider.
-               return wxNullBitmap;
+        ART(wxART_HELP_SETTINGS,                       helpoptions)
+        ART(wxART_HELP_BOOK,                           helpbook)
+        ART(wxART_HELP_FOLDER,                         helpbook)
+        ART(wxART_HELP_PAGE,                           helppage)
+        //ART(wxART_ADD_BOOKMARK,                        addbookm)
+        //ART(wxART_DEL_BOOKMARK,                        delbookm)
+        ART(wxART_GO_BACK,                             helpback)
+        ART(wxART_GO_FORWARD,                          helpforward)
+        ART(wxART_GO_UP,                               helpup)
+        ART(wxART_GO_DOWN,                             helpdown)
+        ART(wxART_GO_TO_PARENT,                        helpuplevel)
+        ART(wxART_FILE_OPEN,                           helpopen)
+        if (client == wxART_HELP_BROWSER)
+        {
+            //ART(wxART_FRAME_ICON,                          helpicon)
+            ART(wxART_HELP,                          helpicon)
+        }
+
+        //ART(wxART_GO_HOME,                             home)
+
+        // Any wxWidgets icons not implemented here
+        // will be provided by the default art provider.
+        return wxNullBitmap;
 }
 
 }
 
-#if hvUSE_IPC
+#if wxUSE_IPC
 
 wxConnectionBase *hvServer::OnAcceptConnection(const wxString& topic)
 {
 
 wxConnectionBase *hvServer::OnAcceptConnection(const wxString& topic)
 {
@@ -398,98 +406,85 @@ hvConnection::~hvConnection()
     wxGetApp().GetConnections().DeleteObject(this);
 }
 
     wxGetApp().GetConnections().DeleteObject(this);
 }
 
-bool hvConnection::OnExecute(const wxString& WXUNUSED(topic),
-                             wxChar *data,
-                             int WXUNUSED(size),
-                             wxIPCFormat WXUNUSED(format))
+bool hvConnection::OnExec(const wxString& WXUNUSED(topic),
+                          const wxString& data)
 {
 {
-       //    wxLogStatus("Execute command: %s", data);
-       
-       if ( !wxStrncmp( data, wxT("--intstring"), 11 ) )
-       {
+    //    wxLogStatus("Execute command: %s", data);
+
+    if ( data == "--intstring" )
+    {
         long i;
         long i;
-               wxString argStr = data;
-               wxString numb = argStr.AfterLast(wxT('g'));
-               if ( !(numb.ToLong(&i) ) ) {
-                       wxLogError( wxT("Integer conversion failed for --intstring") );
-               }
-               else {                           
-                       wxGetApp().GetHelpController()->Display(int(i));
-               }
-       }
-       else
-       {
-               wxGetApp().GetHelpController()->Display(data);
-       }
-    
-    return TRUE;
+        wxString argStr = data;
+        wxString numb = argStr.AfterLast(wxT('g'));
+        if ( !(numb.ToLong(&i) ) )
+        {
+            wxLogError( wxT("Integer conversion failed for --intstring") );
+        }
+        else
+        {
+            wxGetApp().GetHelpController()->Display(int(i));
+        }
+    }
+    else
+    {
+        wxGetApp().GetHelpController()->Display(data);
+    }
+
+    return true;
 }
 
 bool hvConnection::OnPoke(const wxString& WXUNUSED(topic),
                           const wxString& item,
 }
 
 bool hvConnection::OnPoke(const wxString& WXUNUSED(topic),
                           const wxString& item,
-                          wxChar *data,
-                          int WXUNUSED(size),
-                          wxIPCFormat WXUNUSED(format))
+                          const void *buf,
+                          size_t size,
+                          wxIPCFormat format)
 {
 {
-       //    wxLogStatus("Poke command: %s = %s", item.c_str(), data);
-       //topic is not tested
-       
-       if ( wxGetApp().GetHelpController() )
-       {
-               if ( item == wxT("--AddBook") )
-               {
-                       wxGetApp().GetHelpController()->AddBook(data);
-               }
-               else if ( item == wxT("--DisplayContents") )
-               {
-                       wxGetApp().GetHelpController()->DisplayContents();
-               }
-               else if ( item == wxT("--DisplayIndex") )
-               {
-                       wxGetApp().GetHelpController()->DisplayIndex();
-               }
-               else if ( item == wxT("--KeywordSearch") )
-               {
-                       wxGetApp().GetHelpController()->KeywordSearch(data);
-               }
-               else if ( item == wxT("--SetTitleFormat") )
-               {
-                       wxString newname = data; 
-                       newname.Replace( wxT("_"), wxT(" ") );
-                       wxGetApp().GetHelpController()->SetTitleFormat(newname);
-                       //does not redraw title bar?
-                       //wxGetApp().GetHelpController()->ReFresh(); - or something
-               }
-               else if ( item == wxT("--SetTempDir") )
-               {
-                       wxGetApp().GetHelpController()->SetTempDir(data);
-               }
-               else if ( item == wxT("--YouAreDead") )
-               {
-                       // don't really know how to kill app from down here...
-                       // use wxKill from client instead
-                       //wxWindow *win = wxTheApp->GetTopWindow();
-                       //if ( win )
-                       //      win->Destroy();
-               }
-       }
-       
-    return TRUE;
-}
+    const wxString data = GetTextFromData(buf, size, format);
 
 
-wxChar *hvConnection::OnRequest(const wxString& WXUNUSED(topic),
-                                                               const wxString& WXUNUSED(item),
-                                                               int * WXUNUSED(size),
-                                                               wxIPCFormat WXUNUSED(format))
-{
-    return NULL;
-}
+    //    wxLogStatus("Poke command: %s = %s", item.c_str(), data);
+    //topic is not tested
 
 
-bool hvConnection::OnStartAdvise(const wxString& WXUNUSED(topic),
-                                 const wxString& WXUNUSED(item))
-{
-    return TRUE;
+    if ( wxGetApp().GetHelpController() )
+    {
+        if ( item == wxT("--AddBook") )
+        {
+            wxGetApp().GetHelpController()->AddBook(data);
+        }
+        else if ( item == wxT("--DisplayContents") )
+        {
+            wxGetApp().GetHelpController()->DisplayContents();
+        }
+        else if ( item == wxT("--DisplayIndex") )
+        {
+            wxGetApp().GetHelpController()->DisplayIndex();
+        }
+        else if ( item == wxT("--KeywordSearch") )
+        {
+            wxGetApp().GetHelpController()->KeywordSearch(data);
+        }
+        else if ( item == wxT("--SetTitleFormat") )
+        {
+            wxString newname = data;
+            newname.Replace( wxT("_"), wxT(" ") );
+            wxGetApp().GetHelpController()->SetTitleFormat(newname);
+            //does not redraw title bar?
+            //wxGetApp().GetHelpController()->ReFresh(); - or something
+        }
+        else if ( item == wxT("--SetTempDir") )
+        {
+            wxGetApp().GetHelpController()->SetTempDir(data);
+        }
+        else if ( item == wxT("--YouAreDead") )
+        {
+            // don't really know how to kill app from down here...
+            // use wxKill from client instead
+            //wxWindow *win = wxTheApp->GetTopWindow();
+            //if ( win )
+            //    win->Destroy();
+        }
+    }
+
+    return true;
 }
 
 }
 
-#endif
-    // hvUSE_IPC
\ No newline at end of file
+#endif // #if wxUSE_IPC