From 5da69e38e61682c256b5e16b422491b34fa6c893 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 9 Mar 2000 23:41:57 +0000 Subject: [PATCH] Help sample should work for .zip help files now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6572 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/help/demo.cpp | 129 ++++++++++++++++-------------------------- samples/help/doc.zip | Bin 5115 -> 5136 bytes src/html/helpdata.cpp | 2 +- 3 files changed, 49 insertions(+), 82 deletions(-) diff --git a/samples/help/demo.cpp b/samples/help/demo.cpp index 1e071f880c..ff02c60120 100644 --- a/samples/help/demo.cpp +++ b/samples/help/demo.cpp @@ -35,7 +35,7 @@ // define this to 1 to use HTML help even under Windows (by default, Windows // version will use WinHelp). -// Please also see samples/html/helpview for a more complex help viewer. +// Please also see samples/html/helpview. #define USE_HTML_HELP 1 @@ -98,6 +98,8 @@ public: void OnHtmlHelp(wxCommandEvent& event); void OnAdvancedHtmlHelp(wxCommandEvent& event); + void ShowHelp(int commandId, wxHelpControllerBase& helpController); + private: wxHelpController m_help; @@ -324,7 +326,26 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnHelp(wxCommandEvent& event) { - switch(event.GetId()) + ShowHelp(event.GetId(), m_help); +} + +void MyFrame::OnHtmlHelp(wxCommandEvent& event) +{ +#if USE_HTML_HELP + ShowHelp(event.GetId(), m_htmlHelp); +#endif +} + +void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent& event) +{ +#if USE_HTML_HELP + ShowHelp(event.GetId(), m_advancedHtmlHelp); +#endif +} + +void MyFrame::ShowHelp(int commandId, wxHelpControllerBase& helpController) +{ + switch(commandId) { // Note: For WinHelp, these ids are specified in the map session, mapping @@ -332,112 +353,58 @@ void MyFrame::OnHelp(wxCommandEvent& event) // For HTML and external help, a wxhelp.map file is used. case HelpDemo_Help_Classes: - m_help.DisplaySection(2); - break; - case HelpDemo_Help_Functions: - m_help.DisplaySection(1); - break; - case HelpDemo_Help_Help: - m_help.DisplaySection(3); - break; - - // These three calls are only used by wxExtHelpController - - case HelpDemo_Help_KDE: - m_help.SetViewer("kdehelp"); - break; - case HelpDemo_Help_GNOME: - m_help.SetViewer("gnome-help-browser"); - break; - case HelpDemo_Help_Netscape: - m_help.SetViewer("netscape", wxHELP_NETSCAPE); - break; - - case HelpDemo_Help_Search: - { - wxString key = wxGetTextFromUser("Search for?", - "Search help for keyword", - "", - this); - if(! key.IsEmpty()) - m_help.KeywordSearch(key); - } - break; - case HelpDemo_Help_Index: - default: - m_help.DisplayContents(); - break; - } -} + case HelpDemo_Html_Help_Classes: + case HelpDemo_Advanced_Html_Help_Classes: + helpController.DisplaySection(2); -void MyFrame::OnHtmlHelp(wxCommandEvent& event) -{ -#if USE_HTML_HELP - switch(event.GetId()) - { + // if (helpController.IsKindOf(CLASSINFO(wxHtmlHelpController))) + // ((wxHtmlHelpController&)helpController).Display("Classes"); // An alternative form for this controller - case HelpDemo_Html_Help_Classes: - m_htmlHelp.DisplaySection(2); break; + case HelpDemo_Help_Functions: case HelpDemo_Html_Help_Functions: - m_htmlHelp.DisplaySection(1); + case HelpDemo_Advanced_Html_Help_Functions: + helpController.DisplaySection(1); break; + case HelpDemo_Help_Help: case HelpDemo_Html_Help_Help: - m_htmlHelp.DisplaySection(3); + case HelpDemo_Advanced_Html_Help_Help: + helpController.DisplaySection(3); break; + case HelpDemo_Help_Search: case HelpDemo_Html_Help_Search: + case HelpDemo_Advanced_Html_Help_Search: { wxString key = wxGetTextFromUser("Search for?", "Search help for keyword", "", this); if(! key.IsEmpty()) - m_htmlHelp.KeywordSearch(key); + helpController.KeywordSearch(key); } break; + + case HelpDemo_Help_Index: case HelpDemo_Html_Help_Index: - default: - m_htmlHelp.DisplayContents(); + case HelpDemo_Advanced_Html_Help_Index: + helpController.DisplayContents(); break; - } -#endif -} -void MyFrame::OnAdvancedHtmlHelp(wxCommandEvent& event) -{ -#if USE_HTML_HELP - switch(event.GetId()) - { + // These three calls are only used by wxExtHelpController - case HelpDemo_Advanced_Html_Help_Classes: - m_advancedHtmlHelp.DisplaySection(2); -// m_advancedHtmlHelp.Display("Classes"); // An alternative form + case HelpDemo_Help_KDE: + helpController.SetViewer("kdehelp"); break; - case HelpDemo_Advanced_Html_Help_Functions: - m_advancedHtmlHelp.DisplaySection(1); -// m_advancedHtmlHelp.Display("Functions"); // An alternative form + case HelpDemo_Help_GNOME: + helpController.SetViewer("gnome-help-browser"); break; - case HelpDemo_Advanced_Html_Help_Help: - m_advancedHtmlHelp.DisplaySection(3); -// m_advancedHtmlHelp.Display("About"); // An alternative form + case HelpDemo_Help_Netscape: + helpController.SetViewer("netscape", wxHELP_NETSCAPE); break; - case HelpDemo_Advanced_Html_Help_Search: - { - wxString key = wxGetTextFromUser("Search for?", - "Search help for keyword", - "", - this); - if(! key.IsEmpty()) - m_advancedHtmlHelp.KeywordSearch(key); - } - break; - case HelpDemo_Advanced_Html_Help_Index: default: - m_advancedHtmlHelp.DisplayContents(); break; } -#endif } diff --git a/samples/help/doc.zip b/samples/help/doc.zip index 3ef6d5e9399e18ba757bcb64c2140d2d73ae59e7..72bec9f9c4825c87aeb88f65ab1509a3d709752a 100644 GIT binary patch delta 458 zcmV;*0X6>nCy*$xXbFGBnrSHaY1A270RRBK1ONaB0001FZ(}ZKXk)dJO>=@U5J2zF z_#ak!#wgkwI-?L5~|;o7Wcg|oT*ZZ>6o9%eIC+ypLoN= z?oK90)V%!eA*X+Oe11fE?l;prRD(ZQ0bKU#E3vyMm4ctZ4+K30ZHiDvJgwQoHr>L< z(mr8K^SmC~1taGy*7VH!ZF&pKfwtThscyzq&)EgAG420{=}?=}S6;|#mXkA3V>mdP zI=a!=@2j!zXeODkuFk#U;1t-{4o}*)TVGI10|XQR006Vl3Zn-N#F}X+_i5A_S^)q6 zy_0|vMgiTE#}YIFGn4!hGXda}FcUQa=aXg=HUaUIofA0%0uYnf6CDQ65C8xG07OsD A1ONa4 delta 428 zcmV;d0aN~vDElX{XbFFij%g^SI*;x}0RR9l1ONaB0001FZ(}ZKXk)FBOLKxS6ovQB z_#duxjj6QVp)(4xr9;KBap5w>SeXIBgiELW_a(t`d{w((ljk}2e93ite&n&$oWcux z3t_&Tgn3(x_G}y86BHRQV9>t@+t#PVRB|VgztY=i@=84h_)`euMpD)mD3mOO!bFt1 z6u1RfJlo|48UGZlHdye*)2cq1%5*K12_;QIy<8gbFc`rfDK(h!92O5{%+r10wT$~) z%+6G^dfbb==J8?WNk04|8sK{PK&Rg&IVyQUenb&y(YlH;k@-%0{1tLNQKl!tc3~b34F8Z7-U1mPhz{CATI$bJ)1NIbP$=hSgBl$; zmw~#Sv)l@-2Mv&pX(*;TkM2bQ001tNl@dk)$dlX>Gyxuy5fd{3%acVDH38C-dlNPR W+>^2sIRfnulkF272D%Uc0001)Zoa_) diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index 4e186d55f0..cb5eb0e862 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -93,7 +93,7 @@ class HP_TagHandler : public wxHtmlTagHandler wxHtmlBookRecord *m_Book; public: - HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; } + HP_TagHandler(wxHtmlBookRecord *b) : wxHtmlTagHandler() {m_Book = b; m_Items = NULL; m_ItemsCnt = 0; m_Name = m_Page = wxEmptyString; m_Level = 0; m_ID = -1; } wxString GetSupportedTags() { return wxT("UL,OBJECT,PARAM"); } bool HandleTag(const wxHtmlTag& tag); void WriteOut(wxHtmlContentsItem*& array, int& size); -- 2.45.2