22#include "../documentationbrowser.hpp"
23#include "../NumeReWindow.h"
24#include <wx/html/htmprint.h>
48 vHistory.push_back(source);
50 bool res = wxHtmlWindow::SetPage(source);
51 m_browser->setCurrentTabText(GetOpenedPageTitle());
74 if (docID.substr(0,10) ==
"history://")
82 if (docID.find(
'?') != std::string::npos)
83 docID.erase(docID.find(
'?'));
90 else if (docID ==
"forward")
97 else if (docID.substr(0,7) ==
"nhlp://")
103 if (docID.find(
"?frame=new") != std::string::npos)
109 if (docID.find(
'?') != std::string::npos)
110 docID.erase(docID.find(
'?'));
120 if (!pageContent.length())
134 else if (docID.substr(0,15) ==
"<!DOCTYPE html>")
139 else if (docID.find(
"://") == std::string::npos)
145 if (!pageContent.length())
187 if (pageContent.substr(0,15) ==
"<!DOCTYPE html>")
189 return this->
SetPage(pageContent);
191 else if (pageContent.length())
218 if (pageContent.substr(0,15) ==
"<!DOCTYPE html>")
220 return this->
SetPage(pageContent);
222 else if (pageContent.length())
276 wxHtmlPrintout* printout =
new wxHtmlPrintout();
277 printout->SetFonts(wxEmptyString,
"Consolas");
278 printout->SetMargins(12.6f, 12.6f, 12.6f, 12.6f, 2.5f);
279 printout->SetFooter(
"<div align=\"center\">@PAGENUM@ / @PAGESCNT@</div>");
287 if (htmlText.substr(0,15) ==
"<!DOCTYPE html>")
288 printout->SetHtmlText(htmlText);
293 wxPrintPreview *preview =
new wxPrintPreview(printout, printout,
g_printData);
299 wxMessageBox(
_guilang.
get(
"GUI_PREVIEW_ERROR"),
_guilang.
get(
"GUI_PREVIEW_ERROR_HEAD"), wxOK | wxICON_WARNING);
305 wxPreviewFrame *frame =
new wxPreviewFrame (preview,
this,
_guilang.
get(
"GUI_PREVIEW_HEAD"));
308 frame->SetSize(rect);
309 frame->Centre(wxBOTH);
329 if (event.GetKeyCode() == WXK_ESCAPE)
359 wxString linkadress =
event.GetLinkInfo().GetHref();
bool createNewPage(const wxString &docId)
Create a new viewer in a new page.
This class renders the contents of a single page on the DocumentationBrowser. It also governs the bro...
bool GoIndex()
Public member function to display the index page.
std::vector< wxString > vHistory
bool Print()
Public member function to open the print preview page.
bool ShowPageOnItem(wxString docID)
Public member function to display a content in the viewer window. The type of the content is determin...
NumeReWindow * m_mainFrame
bool HistoryGoForward()
Public member function to go one step forward in the history.
virtual bool SetPage(const wxString &source)
Set the contents to be displayed in this window.
bool GoHome()
Public member function to return to the home page.
bool HistoryGoBack()
Public member function to go one step back in the history.
void OnKeyDown(wxKeyEvent &event)
Event handler, which gets fired when the user presses a key.
void OnLinkClick(wxHtmlLinkEvent &event)
Event handler for the case that the user clicks on a link in the document.
DocumentationBrowser * m_browser
void OnEnter(wxMouseEvent &event)
Event handler to automatically focus the window below the mouse pointer.
std::string get(const std::string &sMessage, const std::vector< std::string > &vTokens) const
This member function returns the language string for the passed language identifier and replaces all ...
wxRect DeterminePrintSize()
void OnPrintSetup()
This member function displays the printing page setup dialog.
wxString GetDocContent(wxString docid)
This member function returns the HTML string containing the documentation for the selected topic/doc ...
wxPageSetupData * g_pageSetupData
wxPrintData * g_printData
global print data, to remember settings during the session