X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..f284605f65f6f957c90452b574f4131079819b53:/utils/helpview/src/helpview.cpp diff --git a/utils/helpview/src/helpview.cpp b/utils/helpview/src/helpview.cpp index d16e92f0ff..22474726a2 100644 --- a/utils/helpview/src/helpview.cpp +++ b/utils/helpview/src/helpview.cpp @@ -27,6 +27,7 @@ #include "wx/wx.h" #endif +#include "wx/filename.h" #include "wx/image.h" #include "wx/wxhtml.h" #include "wx/fs_zip.h" @@ -60,9 +61,12 @@ bool hvApp::OnInit() wxArtProvider::PushProvider(new AlternateArtProvider); - int istyle = wxHF_DEFAULT_STYLE; - - wxArtProvider::PushProvider(new AlternateArtProvider); +#ifdef __WXMAC__ + wxApp::s_macAboutMenuItemId = wxID_ABOUT; + wxFileName::MacRegisterDefaultTypeAndCreator( "htb" , 'HTBD' , 'HTBA' ) ; +#endif + + int istyle = wxHF_DEFAULT_STYLE; wxString service, windowName, book[10], titleFormat, argStr; int bookCount = 0; @@ -71,7 +75,9 @@ bool hvApp::OnInit() bool hasWindowName = FALSE; bool createServer = FALSE; +#if hvUSE_IPC m_server = NULL; +#endif // Help books are recognized by extension ".hhp" ".htb" or ".zip". // Service and window_name can occur anywhere in arguments, @@ -138,7 +144,9 @@ bool hvApp::OnInit() } } - //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 ) { wxString s = wxFileSelector( wxT("Open help file"), @@ -157,7 +165,8 @@ bool hvApp::OnInit() bookCount = 1; } } - +#endif + #if hvUSE_IPC if ( createServer ) { @@ -200,7 +209,8 @@ bool hvApp::OnInit() for( i=0; i < bookCount; i++ ) { - m_helpController->AddBook(book[i]); + wxFileName fileName(book[i]); + m_helpController->AddBook(fileName); } #ifdef __WXMOTIF__ @@ -258,13 +268,26 @@ bool hvApp::OpenBook(wxHtmlHelpController* controller) if (ext == _T(".zip") || ext == _T(".htb") || ext == _T(".hhp")) { wxBusyCursor bcur; - controller->AddBook(s); + wxFileName fileName(s); + controller->AddBook(fileName); return TRUE; } } return FALSE; } +#ifdef __WXMAC__ +/// Respond to Apple Event for opening a document +void hvApp::MacOpenFile(const wxString& filename) +{ + wxBusyCursor bcur; + wxFileName fileName(filename); + m_helpController->AddBook(fileName); + m_helpController->DisplayContents(); +} +#endif + + /* * Art provider class */ @@ -492,4 +515,4 @@ bool hvConnection::OnStartAdvise(const wxString& WXUNUSED(topic), } #endif - // hvUSE_IPC \ No newline at end of file + // hvUSE_IPC