1999-10-31 17:02:03 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: helpview.cpp
|
|
|
|
// Purpose: wxHtml help browser
|
2002-07-09 06:38:51 -04:00
|
|
|
// Please note: see utils/helpview for a more fully-featured
|
|
|
|
// standalone help browser.
|
1999-10-31 17:02:03 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// For compilers that support precompilation, includes "wx/wx.h".
|
2001-10-30 08:33:34 -05:00
|
|
|
#include "wx/wxprec.h"
|
1999-10-31 17:02:03 -05:00
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// for all others, include the necessary headers (this file is usually all you
|
2004-05-25 07:20:37 -04:00
|
|
|
// need because it includes almost all "standard" wxWidgets headers
|
1999-10-31 17:02:03 -05:00
|
|
|
#ifndef WX_PRECOMP
|
2002-01-13 12:41:56 -05:00
|
|
|
#include "wx/wx.h"
|
1999-10-31 17:02:03 -05:00
|
|
|
#endif
|
|
|
|
|
2002-01-13 12:41:56 -05:00
|
|
|
#include "wx/image.h"
|
|
|
|
#include "wx/wxhtml.h"
|
|
|
|
#include "wx/fs_zip.h"
|
|
|
|
#include "wx/log.h"
|
2002-07-07 17:48:30 -04:00
|
|
|
#include "wx/filedlg.h"
|
|
|
|
|
1999-10-31 17:02:03 -05: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 09:53:39 -05:00
|
|
|
#ifdef __WXMOTIF__
|
|
|
|
delete wxLog::SetActiveTarget(new wxLogStderr); // So dialog boxes aren't used
|
|
|
|
#endif
|
|
|
|
|
1999-10-31 17:02:03 -05:00
|
|
|
wxInitAllImageHandlers();
|
|
|
|
wxFileSystem::AddHandler(new wxZipFSHandler);
|
|
|
|
|
2004-05-25 07:20:37 -04:00
|
|
|
SetVendorName(wxT("wxWidgets"));
|
2002-12-04 09:11:26 -05:00
|
|
|
SetAppName(wxT("wxHTMLHelp"));
|
2000-01-17 12:18:53 -05:00
|
|
|
wxConfig::Get(); // create an instance
|
|
|
|
|
2002-07-09 06:38:51 -04:00
|
|
|
help = new wxHtmlHelpController;
|
|
|
|
|
1999-10-31 17:02:03 -05:00
|
|
|
if (argc < 2) {
|
2001-09-21 16:21:44 -04:00
|
|
|
wxLogError(wxT("Usage : helpview <helpfile> [<more helpfiles>]"));
|
|
|
|
wxLogError(wxT(" helpfile may be .hhp, .zip or .htb"));
|
2004-05-21 07:29:38 -04:00
|
|
|
return false;
|
1999-10-31 17:02:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 1; i < argc; i++)
|
2002-12-08 15:30:56 -05:00
|
|
|
help->AddBook(wxFileName(argv[i]));
|
1999-10-31 17:02:03 -05:00
|
|
|
|
1999-11-08 09:53:39 -05:00
|
|
|
#ifdef __WXMOTIF__
|
|
|
|
delete wxLog::SetActiveTarget(new wxLogGui);
|
|
|
|
#endif
|
|
|
|
|
1999-10-31 17:02:03 -05:00
|
|
|
help -> DisplayContents();
|
|
|
|
|
2004-05-21 07:29:38 -04:00
|
|
|
return true;
|
1999-10-31 17:02:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int MyApp::OnExit()
|
|
|
|
{
|
|
|
|
delete help;
|
2000-01-17 12:18:53 -05:00
|
|
|
delete wxConfig::Set(NULL);
|
1999-10-31 17:02:03 -05:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|