preserve window's content when changing the fonts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37862 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3568f700f6
commit
73de5077ce
@ -269,9 +269,13 @@ protected:
|
||||
void StopAutoScrolling();
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
protected:
|
||||
wxString DoSelectionToText(wxHtmlSelection *sel);
|
||||
|
||||
private:
|
||||
// implementation of SetPage()
|
||||
bool DoSetPage(const wxString& source);
|
||||
|
||||
protected:
|
||||
// This is pointer to the first cell in parsed data. (Note: the first cell
|
||||
// is usually top one = all other cells are sub-cells of this one)
|
||||
wxHtmlContainerCell *m_Cell;
|
||||
|
@ -237,30 +237,29 @@ void wxHtmlWindow::SetRelatedStatusBar(int bar)
|
||||
|
||||
void wxHtmlWindow::SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes)
|
||||
{
|
||||
wxString op = m_OpenedPage;
|
||||
|
||||
m_Parser->SetFonts(normal_face, fixed_face, sizes);
|
||||
// fonts changed => contents invalid, so reload the page:
|
||||
SetPage(wxT("<html><body></body></html>"));
|
||||
if (!op.empty())
|
||||
LoadPage(op);
|
||||
|
||||
// re-layout the page after changing fonts:
|
||||
DoSetPage(*(m_Parser->GetSource()));
|
||||
}
|
||||
|
||||
void wxHtmlWindow::SetStandardFonts(int size,
|
||||
const wxString& normal_face,
|
||||
const wxString& fixed_face)
|
||||
{
|
||||
wxString op = m_OpenedPage;
|
||||
|
||||
m_Parser->SetStandardFonts(size, normal_face, fixed_face);
|
||||
// fonts changed => contents invalid, so reload the page:
|
||||
SetPage(wxT("<html><body></body></html>"));
|
||||
if (!op.empty())
|
||||
LoadPage(op);
|
||||
|
||||
// re-layout the page after changing fonts:
|
||||
DoSetPage(*(m_Parser->GetSource()));
|
||||
}
|
||||
|
||||
|
||||
bool wxHtmlWindow::SetPage(const wxString& source)
|
||||
{
|
||||
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
||||
return DoSetPage(source);
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::DoSetPage(const wxString& source)
|
||||
{
|
||||
wxString newsrc(source);
|
||||
|
||||
@ -307,7 +306,7 @@ bool wxHtmlWindow::SetPage(const wxString& source)
|
||||
dc->SetMapMode(wxMM_TEXT);
|
||||
SetBackgroundColour(wxColour(0xFF, 0xFF, 0xFF));
|
||||
SetBackgroundImage(wxNullBitmap);
|
||||
m_OpenedPage = m_OpenedAnchor = m_OpenedPageTitle = wxEmptyString;
|
||||
|
||||
m_Parser->SetDC(dc);
|
||||
if (m_Cell)
|
||||
{
|
||||
@ -326,7 +325,7 @@ bool wxHtmlWindow::SetPage(const wxString& source)
|
||||
|
||||
bool wxHtmlWindow::AppendToPage(const wxString& source)
|
||||
{
|
||||
return SetPage(*(GetParser()->GetSource()) + source);
|
||||
return DoSetPage(*(GetParser()->GetSource()) + source);
|
||||
}
|
||||
|
||||
bool wxHtmlWindow::LoadPage(const wxString& location)
|
||||
|
Loading…
Reference in New Issue
Block a user