diff --git a/interface/wx/help.h b/interface/wx/help.h index 9b7b3b8400..2c37fe076f 100644 --- a/interface/wx/help.h +++ b/interface/wx/help.h @@ -100,6 +100,7 @@ public: If the help viewer is not running, runs it and displays the given section. - @e WinHelp, MS HTML Help @a sectionNo is a context id. + - @e MS HTML Help: Pass -1 in @a sectionNo to display the index. - @e External HTML help: wxExtHelpController implements @a sectionNo as an id in a map file, which is of the form: - @e wxHtmlHelpController: @a sectionNo is an identifier as specified in @@ -161,6 +162,7 @@ public: - @e WinHelp, MS HTML Help: If more than one match is found, the first topic is displayed. + - @e MS HTML Help: Pass an empty string to display the search page. - @e External HTML help, simple wxHTML help: If more than one match is found, a choice of topics is displayed. - @e wxHtmlHelpController: see wxHtmlHelpController::KeywordSearch. diff --git a/src/msw/helpchm.cpp b/src/msw/helpchm.cpp index f948f56d51..28d86e337f 100644 --- a/src/msw/helpchm.cpp +++ b/src/msw/helpchm.cpp @@ -113,7 +113,7 @@ bool wxCHMHelpController::DisplayContents() if (m_helpFile.IsEmpty()) return false; - return CallHtmlHelp(HH_DISPLAY_TOPIC); + return CallHtmlHelp(HH_DISPLAY_TOC); } // Use topic or HTML filename @@ -138,6 +138,12 @@ bool wxCHMHelpController::DisplaySection(int section) if (m_helpFile.IsEmpty()) return false; + // Treat -1 as a special context number that displays the index + if (section == -1) + { + return CallHtmlHelp(HH_DISPLAY_INDEX); + } + return CallHtmlHelp(HH_HELP_CONTEXT, section); } @@ -197,17 +203,34 @@ bool wxCHMHelpController::KeywordSearch(const wxString& k, if (m_helpFile.IsEmpty()) return false; - HH_AKLINK link; - link.cbStruct = sizeof(HH_AKLINK); - link.fReserved = FALSE; - link.pszKeywords = k.t_str(); - link.pszUrl = NULL; - link.pszMsgText = NULL; - link.pszMsgTitle = NULL; - link.pszWindow = NULL; - link.fIndexOnFail = TRUE; + if (k.IsEmpty()) + { + HH_FTS_QUERY oQuery; + oQuery.cbStruct = sizeof(HH_FTS_QUERY); + oQuery.fStemmedSearch = 0; + oQuery.fTitleOnly = 0; + oQuery.fUniCodeStrings = 0; + oQuery.iProximity = 0; + oQuery.pszSearchQuery = TEXT(""); + oQuery.pszWindow = TEXT(""); + oQuery.fExecute = 1; - return CallHtmlHelp(HH_KEYWORD_LOOKUP, &link); + return CallHtmlHelp(HH_DISPLAY_SEARCH, &oQuery); + } + else + { + HH_AKLINK link; + link.cbStruct = sizeof(HH_AKLINK); + link.fReserved = FALSE; + link.pszKeywords = k.t_str(); + link.pszUrl = NULL; + link.pszMsgText = NULL; + link.pszMsgTitle = NULL; + link.pszWindow = NULL; + link.fIndexOnFail = TRUE; + + return CallHtmlHelp(HH_KEYWORD_LOOKUP, &link); + } } bool wxCHMHelpController::Quit()