1999-10-31 22:02:03 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: helpview.cpp
|
|
|
|
// Purpose: wxHtml help browser
|
2002-07-09 10:38:51 +00:00
|
|
|
// Please note: see utils/helpview for a more fully-featured
|
|
|
|
// standalone help browser.
|
1999-10-31 22:02:03 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2002-08-31 22:31:03 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
1999-10-31 22:02:03 +00:00
|
|
|
#pragma implementation "help.cpp"
|
|
|
|
#pragma interface "help.cpp"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
2001-10-30 13:33:34 +00:00
|
|
|
#include "wx/wxprec.h"
|
1999-10-31 22:02:03 +00:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// for all others, include the necessary headers (this file is usually all you
|
|
|
|
// need because it includes almost all "standard" wxWindows headers
|
|
|
|
#ifndef WX_PRECOMP
|
2002-01-13 17:41:56 +00:00
|
|
|
#include "wx/wx.h"
|
1999-10-31 22:02:03 +00:00
|
|
|
#endif
|
|
|
|
|
2002-01-13 17:41:56 +00:00
|
|
|
#include "wx/image.h"
|
|
|
|
#include "wx/wxhtml.h"
|
|
|
|
#include "wx/fs_zip.h"
|
|
|
|
#include "wx/log.h"
|
2002-07-07 21:48:30 +00:00
|
|
|
#include "wx/filedlg.h"
|
|
|
|
|
1999-10-31 22:02:03 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// private classes
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// Define a new application type, each program should derive a class from wxApp
|
|
|
|
class MyApp : public wxApp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// override base class virtuals
|
|
|
|
// ----------------------------
|
|
|
|
|
|
|
|
// this one is called on application startup and is a good place for the app
|
|
|
|
// initialization (doing it here and not in the ctor allows to have an error
|
|
|
|
// return: if OnInit() returns false, the application terminates)
|
|
|
|
|
|
|
|
virtual bool OnInit();
|
|
|
|
virtual int OnExit();
|
|
|
|
|
|
|
|
private:
|
|
|
|
wxHtmlHelpController *help;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_APP(MyApp)
|
|
|
|
|
|
|
|
|
|
|
|
bool MyApp::OnInit()
|
|
|
|
{
|
1999-11-08 14:53:39 +00:00
|
|
|
#ifdef __WXMOTIF__
|
|
|
|
delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
|
|
|
|
#endif
|
|
|
|
|
1999-10-31 22:02:03 +00:00
|
|
|
wxInitAllImageHandlers();
|
|
|
|
wxFileSystem::AddHandler(new wxZipFSHandler);
|
|
|
|
|
2002-12-04 14:11:26 +00:00
|
|
|
SetVendorName(wxT("wxWindows"));
|
|
|
|
SetAppName(wxT("wxHTMLHelp"));
|
2000-01-17 17:18:53 +00:00
|
|
|
wxConfig::Get(); // create an instance
|
|
|
|
|
2002-07-09 10:38:51 +00:00
|
|
|
help = new wxHtmlHelpController;
|
|
|
|
|
1999-10-31 22:02:03 +00:00
|
|
|
if (argc < 2) {
|
2001-09-21 20:21:44 +00:00
|
|
|
wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]"));
|
|
|
|
wxLogError(wxT(" helpfile may be .hhp, .zip or .htb"));
|
2004-05-21 11:29:38 +00:00
|
|
|
return false;
|
1999-10-31 22:02:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; i++)
|
2002-12-08 20:30:56 +00:00
|
|
|
help->AddBook(wxFileName(argv[i]));
|
1999-10-31 22:02:03 +00:00
|
|
|
|
1999-11-08 14:53:39 +00:00
|
|
|
#ifdef __WXMOTIF__
|
|
|
|
delete wxLog::SetActiveTarget(new wxLogGui);
|
|
|
|
#endif
|
|
|
|
|
1999-10-31 22:02:03 +00:00
|
|
|
help -> DisplayContents();
|
|
|
|
|
2004-05-21 11:29:38 +00:00
|
|
|
return true;
|
1999-10-31 22:02:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MyApp::OnExit()
|
|
|
|
{
|
|
|
|
delete help;
|
2000-01-17 17:18:53 +00:00
|
|
|
delete wxConfig::Set(NULL);
|
1999-10-31 22:02:03 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|