void PrintableHtmlWindow::OnMenuSave(wxCommandEvent& WXUNUSED(event)) { wxString filename = wxFileSelector(_("Save as HTML..."), wxEmptyString, GetOpenedPageTitle(), "*.html", _("HTML files (*.html)|*.html|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT, this); if (filename.IsEmpty()) return; wxFile f; if (f.Open(filename, wxFile::write)) { wxString ns(pageSourceM.Upper()); while (true) // remove links, but leave text { size_t p1 = ns.find("<A"); if (p1 == wxNOT_FOUND) break; size_t pb = ns.find(">", p1); if (pb == wxNOT_FOUND) break; size_t p2 = ns.find("</A>", pb); if (p2 == wxNOT_FOUND) break; ns.Remove(p2, 4); ns.Remove(p1, pb - p1 + 1); } f.Write(ns); f.Close(); } }
void PrintableHtmlWindow::OnMenuPrint(wxCommandEvent& WXUNUSED(event)) { HtmlPrinter::getHEP()->SetHeader(GetOpenedPageTitle()); HtmlPrinter::getHEP()->SetFooter( _("Printed from FlameRobin - www.flamerobin.org")); HtmlPrinter::getHEP()->PrintText(pageSourceM); }
bool CustomWxHtmlWindow::LoadPage(const wxString& inLocation) { bool loaded = wxHtmlWindow::LoadPage(inLocation); if (loaded) { // We can't use inLocation here, because it may be relative. EventDispatcherPtr dispatcher = mElement->GetEventDispatcher(); dispatcher->DoEventBrowserPageChanged(GetOpenedPage()); dispatcher->DoEventBrowserTitleChanged(GetOpenedPageTitle()); dispatcher->DoEventUpdateUI(wxT("back")); dispatcher->DoEventUpdateUI(wxT("forward")); } return loaded; }