X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0646614dadb768dfa17a568bb0193deaf5007e85..236a9de39afa090fdee3cf91cb5364ceca69e3f8:/src/html/helpfrm.cpp diff --git a/src/html/helpfrm.cpp b/src/html/helpfrm.cpp index e1dda001ad..b36d1c62e6 100644 --- a/src/html/helpfrm.cpp +++ b/src/html/helpfrm.cpp @@ -29,6 +29,7 @@ #endif #include "wx/html/helpfrm.h" +#include "wx/html/helpctrl.h" #include "wx/notebook.h" #include "wx/imaglist.h" #include "wx/treectrl.h" @@ -91,6 +92,7 @@ class wxHtmlHelpHashData : public wxObject public: wxHtmlHelpHashData(int index, wxTreeItemId id) : wxObject() { m_Index = index; m_Id = id;} + ~wxHtmlHelpHashData() {} int m_Index; wxTreeItemId m_Id; @@ -183,6 +185,7 @@ void wxHtmlHelpFrame::Init(wxHtmlHelpData* data) m_PagesHash = NULL; m_UpdateContents = TRUE; + m_helpController = (wxHelpControllerBase*) NULL; } // Create: builds the GUI components. @@ -349,7 +352,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti m_IndexCountInfo -> SetConstraints(b5); wxLayoutConstraints *b3 = new wxLayoutConstraints; - m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_ALWAYS_SB); + m_IndexList = new wxListBox(dummy, wxID_HTML_INDEXLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); b3 -> top.Below (m_IndexCountInfo, 5); b3 -> left.SameAs (dummy, wxLeft, 0); b3 -> right.SameAs (dummy, wxRight, 0); @@ -417,7 +420,7 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti m_SearchButton -> SetConstraints(b2); wxLayoutConstraints *b3 = new wxLayoutConstraints; - m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE | wxLB_ALWAYS_SB); + m_SearchList = new wxListBox(dummy, wxID_HTML_SEARCHLIST, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_SINGLE); b3 -> top.Below (m_SearchButton, 10); b3 -> left.SameAs (dummy, wxLeft, 0); b3 -> right.SameAs (dummy, wxRight, 0); @@ -431,7 +434,6 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti } m_HtmlWin -> Show(TRUE); - RefreshLists(); // showtime @@ -457,12 +459,13 @@ bool wxHtmlHelpFrame::Create(wxWindow* parent, wxWindowID id, const wxString& ti wxHtmlHelpFrame::~wxHtmlHelpFrame() { - PopEventHandler(); // wxhtmlhelpcontroller + // PopEventHandler(); // wxhtmlhelpcontroller (not any more!) delete m_ContentsImageList; if (m_DataCreated) delete m_Data; if (m_NormalFonts) delete m_NormalFonts; if (m_FixedFonts) delete m_FixedFonts; + if (m_PagesHash) delete m_PagesHash; } @@ -513,6 +516,13 @@ void wxHtmlHelpFrame::AddToolbarButtons(wxToolBar *toolBar, int style) } +void wxHtmlHelpFrame::SetTitleFormat(const wxString& format) +{ + if (m_HtmlWin) + m_HtmlWin->SetRelatedFrame(this, format); + m_TitleFormat = format; +} + bool wxHtmlHelpFrame::Display(const wxString& x) { @@ -597,7 +607,7 @@ bool wxHtmlHelpFrame::KeywordSearch(const wxString& keyword) wxProgressDialog progress(_("Searching..."), _("No matching page found yet"), status.GetMaxIndex(), this, - wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE | wxGA_SMOOTH); + wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_AUTO_HIDE); while (status.IsActive()) { curi = status.GetCurIndex(); @@ -917,7 +927,7 @@ class wxHtmlHelpFrameOptionsDialog : public wxDialog "")); } - void OnUpdate(wxCloseEvent& event) + void OnUpdate(wxCommandEvent& event) { UpdateTestWin(); } @@ -1062,15 +1072,19 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) if (m_PagesHash) { wxString an = m_HtmlWin -> GetOpenedAnchor(); + wxString adr; wxHtmlHelpHashData *ha; - if (an.IsEmpty()) - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage()); - else - ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(m_HtmlWin -> GetOpenedPage() + wxT("#") + an); + + if (an.IsEmpty()) adr = m_HtmlWin -> GetOpenedPage(); + else adr = m_HtmlWin -> GetOpenedPage() + wxT("#") + an; + + ha = (wxHtmlHelpHashData*) m_PagesHash -> Get(adr); if (ha && ha -> m_Index < m_Data -> GetContentsCnt() - 1) { wxHtmlContentsItem *it = m_Data -> GetContents() + (ha -> m_Index + 1); + + while (it -> m_Book -> GetBasePath() + it -> m_Page == adr) it++; m_HtmlWin -> LoadPage(it -> m_Book -> GetBasePath() + it -> m_Page); NotifyPageChanged(); } @@ -1134,7 +1148,10 @@ void wxHtmlHelpFrame::OnToolbar(wxCommandEvent& event) { if (m_Printer == NULL) m_Printer = new wxHtmlEasyPrinting(_("Help Printing"), this); - m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); + if (!m_HtmlWin -> GetOpenedPage()) + wxLogWarning(_("Cannot print empty page.")); + else + m_Printer -> PrintFile(m_HtmlWin -> GetOpenedPage()); } break; #endif @@ -1298,6 +1315,11 @@ void wxHtmlHelpFrame::OnCloseWindow(wxCloseEvent& evt) if (m_Config) WriteCustomization(m_Config, m_ConfigRoot); + if (m_helpController && m_helpController->IsKindOf(CLASSINFO(wxHtmlHelpController))) + { + ((wxHtmlHelpController*) m_helpController)->OnCloseFrame(evt); + } + evt.Skip(); }