From a94d44b9b75b6559d43668367681172e17552908 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 18 Apr 2000 11:13:16 +0000 Subject: [PATCH] Some updates; simple wxHTML/external HTML controllers now have DisplaySection(const wxString&). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7207 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/generic.rsp | 4 ++++ docs/latex/wx/helpinst.tex | 13 +++++++++---- docs/latex/wx/hthelpct.tex | 2 +- include/wx/generic/helpext.h | 2 +- include/wx/generic/helphtml.h | 6 +++++- include/wx/generic/helpwxht.h | 2 +- samples/help/makefile.vc | 2 +- src/generic/helpext.cpp | 2 +- src/generic/helphtml.cpp | 10 ++++++++++ src/generic/helpwxht.cpp | 2 +- src/msw/helpchm.cpp | 7 +------ 11 files changed, 35 insertions(+), 17 deletions(-) diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 05dcc07734..91194a8388 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -257,6 +257,10 @@ samples/help/*.hlp samples/help/*.cnt samples/help/*.zip samples/help/*.htb +samples/help/*.chm +samples/help/*.hhp +samples/help/*.hhk +samples/help/*.hhc samples/help/*.hpj samples/help/*.tex samples/help/*.ini diff --git a/docs/latex/wx/helpinst.tex b/docs/latex/wx/helpinst.tex index 26e4fe4883..5a103bf529 100644 --- a/docs/latex/wx/helpinst.tex +++ b/docs/latex/wx/helpinst.tex @@ -101,10 +101,14 @@ If the help viewer is not running, runs it and displays the file at the given bl {\it WinHelp:} Refers to the context number. +{\it MS HTML Help:} Refers to the context number. + {\it External HTML help:} the same as for \helpref{wxHelpController::DisplaySection}{wxhelpcontrollerdisplaysection}. {\it wxHtmlHelpController:} {\it sectionNo} is an identifier as specified in the {\tt .hhc} file. See \helpref{Help files format}{helpformat}. +This function is for backward compatibility only, and applications should use \helpref{wxHelpController}{wxhelpcontrollerwxdisplaysection} instead. + \membersection{wxHelpController::DisplayContents}\label{wxhelpcontrollerdisplaycontents} \func{virtual bool}{DisplayContents}{\void} @@ -119,8 +123,9 @@ contents. If the help viewer is not running, runs it and displays the given section. The interpretation of {\it section} differs between help viewers. For most viewers, -this call is equivalent to KeywordSearch. For MS HTML Help, if {\it section} has a .htm -or .html extension, that HTML file within the .chm file will be displayed; otherwise +this call is equivalent to KeywordSearch. For MS HTML Help, external HTML help +and simple wxHTML help, if {\it section} has a .htm +or .html extension, that HTML file will be displayed; otherwise a keyword search is done. \func{virtual bool}{DisplaySection}{\param{int}{ sectionNo}} @@ -129,7 +134,7 @@ If the help viewer is not running, runs it and displays the given section. {\it WinHelp, MS HTML Help:} {\it sectionNo} is a context id. -{\it External HTML help/wxHTML based help:} wxExtHelpController and wxHelpControllerHtml implement {\it sectionNo} as an id in a map file, which is of the form: +{\it External HTML help/simple wxHTML help:} wxExtHelpController and wxHelpControllerHtml implement {\it sectionNo} as an id in a map file, which is of the form: \begin{verbatim} 0 wx.html ; Index @@ -176,7 +181,7 @@ match is found, the file is displayed at this section. {\it WinHelp, MS HTML Help:} If more than one match is found, the first topic is displayed. -{\it External HTML help:} If more than one match is found, +{\it External HTML help, simple wxHTML help:} If more than one match is found, a choice of topics is displayed. {\it wxHtmlHelpController:} see \helpref{wxHtmlHelpController::KeywordSearch}{wxhtmlhelpcontrollerkeywordsearch}. diff --git a/docs/latex/wx/hthelpct.tex b/docs/latex/wx/hthelpct.tex index 255b0456f4..fdc46abd1a 100644 --- a/docs/latex/wx/hthelpct.tex +++ b/docs/latex/wx/hthelpct.tex @@ -145,7 +145,7 @@ Displays help window and focuses index panel. Displays help window, focuses search panel and starts searching. Returns TRUE if the keyword was found. -{\bf Important:} KeywordSearch searches only pages listed in .htc file(s). +{\bf Important:} KeywordSearch searches only pages listed in .hhc file(s). You should list all pages in the contents file. \membersection{wxHtmlHelpController::ReadCustomization}\label{wxhtmlhelpcontrollerreadcustomization} diff --git a/include/wx/generic/helpext.h b/include/wx/generic/helpext.h index 3c0b0c0360..8cdedc4d89 100644 --- a/include/wx/generic/helpext.h +++ b/include/wx/generic/helpext.h @@ -74,7 +74,7 @@ DECLARE_CLASS(wxExtHelpController) /// Is the viewer a variant of netscape? bool m_BrowserIsNetscape; /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &); + virtual bool DisplayHelp(const wxString&); }; #endif // wxUSE_HELP diff --git a/include/wx/generic/helphtml.h b/include/wx/generic/helphtml.h index 6bf25dff3e..44a5cbc4a2 100644 --- a/include/wx/generic/helphtml.h +++ b/include/wx/generic/helphtml.h @@ -103,6 +103,10 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase) /** 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. @@ -117,7 +121,7 @@ DECLARE_ABSTRACT_CLASS(wxHTMLHelpControllerBase) virtual void OnQuit(void); /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &) = 0; + virtual bool DisplayHelp(const wxString &) = 0; /// Allows one to override the default settings for the help frame. virtual void SetFrameParameters(const wxString& WXUNUSED(title), diff --git a/include/wx/generic/helpwxht.h b/include/wx/generic/helpwxht.h index 449c20f085..62d3da59aa 100644 --- a/include/wx/generic/helpwxht.h +++ b/include/wx/generic/helpwxht.h @@ -58,7 +58,7 @@ DECLARE_CLASS(wxHelpControllerHtml) private: /// Call the browser using a relative URL. - virtual bool DisplayHelp(wxString const &); + virtual bool DisplayHelp(const wxString &); protected: friend class wxHelpFrame; class wxHelpFrame *m_Frame; diff --git a/samples/help/makefile.vc b/samples/help/makefile.vc index 2edefc60cc..723b606f7e 100644 --- a/samples/help/makefile.vc +++ b/samples/help/makefile.vc @@ -12,7 +12,7 @@ WXDIR = $(WXWIN) PROGRAM=demo -#EXTRALIBS=htmlhelp.lib +EXTRALIBS=htmlhelp.lib OBJECTS = $(PROGRAM).obj !include $(WXDIR)\src\makeprog.vc diff --git a/src/generic/helpext.cpp b/src/generic/helpext.cpp index 6502d32c97..8f6276fb25 100644 --- a/src/generic/helpext.cpp +++ b/src/generic/helpext.cpp @@ -81,7 +81,7 @@ void wxExtHelpController::SetViewer(const wxString& viewer, long flags) } bool -wxExtHelpController::DisplayHelp(wxString const &relativeURL) +wxExtHelpController::DisplayHelp(const wxString &relativeURL) { wxBusyCursor b; // display a busy cursor diff --git a/src/generic/helphtml.cpp b/src/generic/helphtml.cpp index f8731d8d17..8970ba2416 100644 --- a/src/generic/helphtml.cpp +++ b/src/generic/helphtml.cpp @@ -251,6 +251,16 @@ wxHTMLHelpControllerBase::DisplaySection(int sectionNo) 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) { diff --git a/src/generic/helpwxht.cpp b/src/generic/helpwxht.cpp index 62bc8c21c0..8fbe69fda6 100644 --- a/src/generic/helpwxht.cpp +++ b/src/generic/helpwxht.cpp @@ -266,7 +266,7 @@ wxHelpControllerHtml::~wxHelpControllerHtml(void) #endif bool -wxHelpControllerHtml::DisplayHelp(wxString const &relativeURL) +wxHelpControllerHtml::DisplayHelp(const wxString &relativeURL) { wxBusyCursor b; // display a busy cursor diff --git a/src/msw/helpchm.cpp b/src/msw/helpchm.cpp index a361dad319..fa764212f8 100644 --- a/src/msw/helpchm.cpp +++ b/src/msw/helpchm.cpp @@ -80,13 +80,8 @@ bool wxCHMHelpController::DisplaySection(const wxString& section) wxString str = GetValidFilename(m_helpFile); - bool isFilename = TRUE; - // Is this an HTML file or a keyword? - wxString path, filename, ext; - wxSplitPath(section, & path, & filename, & ext); - if (ext != wxT("htm") && ext != wxT("html")) - isFilename = FALSE; + bool isFilename = (section.Find(wxT(".htm")) != -1); if (isFilename) HtmlHelp(GetSuitableHWND(), (const wxChar*) str, HH_DISPLAY_TOPIC, (DWORD) (const wxChar*) section);