void wxHtmlWinParser::DoneParser() { m_Container = NULL; #if !wxUSE_UNICODE SetInputEncoding(wxFONTENCODING_ISO8859_1); // for next call #endif wxHtmlParser::DoneParser(); }
void CHtmlWinParser::InitParser(const wxString& source) { CHtmlParser::InitParser(source); wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to CHtmlWinParser!!")); m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE; m_FontSize = 3; //default one CreateCurrentFont(); // we're selecting default font into m_DC->GetTextExtent( wxT("H"), &m_CharWidth, &m_CharHeight); /* NOTE : we're not using GetCharWidth/Height() because of differences under X and win */ m_UseLink = false; m_Link = CHtmlLinkInfo( wxEmptyString ); m_LinkColor.Set(0, 0, 0xFF); m_ActualColor.Set(0, 0, 0); m_Align = wxHTML_ALIGN_LEFT; m_tmpLastWasSpace = false; m_lastWordCell = NULL; OpenContainer(); OpenContainer(); #if !wxUSE_UNICODE wxString charset = ExtractCharsetInformation(source); if (!charset.empty()) { wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset); if (enc != wxFONTENCODING_SYSTEM) SetInputEncoding(enc); } #endif m_Container->InsertCell(new CHtmlColourCell(m_ActualColor)); wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ; m_Container->InsertCell( new CHtmlColourCell(GetWindow() ? GetWindow()->GetBackgroundColour() : windowColour, wxHTML_CLR_BACKGROUND)); m_Container->InsertCell(new CHtmlFontCell(CreateCurrentFont())); }
void CHtmlWinParser::SetFonts(wxString normal_face, wxString fixed_face, const int *sizes) { static int default_sizes[7] = { wxHTML_FONT_SIZE_1, wxHTML_FONT_SIZE_2, wxHTML_FONT_SIZE_3, wxHTML_FONT_SIZE_4, wxHTML_FONT_SIZE_5, wxHTML_FONT_SIZE_6, wxHTML_FONT_SIZE_7 }; if (sizes == NULL) sizes = default_sizes; int i, j, k, l, m; for (i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i]; m_FontFaceFixed = fixed_face; m_FontFaceNormal = normal_face; #if !wxUSE_UNICODE SetInputEncoding(m_InputEnc); #endif for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) for (l = 0; l < 2; l++) for (m = 0; m < 7; m++) { if (m_FontsTable[i][j][k][l][m] != NULL) { delete m_FontsTable[i][j][k][l][m]; m_FontsTable[i][j][k][l][m] = NULL; } } }
void wxHtmlWinParser::SetFonts(const wxString& normal_face, const wxString& fixed_face, const int *sizes) { static int default_sizes[7] = { 0 }; if ( !sizes ) { if ( !default_sizes[0] ) wxBuildFontSizes(default_sizes, wxGetDefaultHTMLFontSize()); sizes = default_sizes; } int i, j, k, l, m; for (i = 0; i < 7; i++) m_FontsSizes[i] = sizes[i]; m_FontFaceFixed = fixed_face; m_FontFaceNormal = normal_face; #if !wxUSE_UNICODE SetInputEncoding(m_InputEnc); #endif for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) for (k = 0; k < 2; k++) for (l = 0; l < 2; l++) for (m = 0; m < 7; m++) { if (m_FontsTable[i][j][k][l][m] != NULL) { delete m_FontsTable[i][j][k][l][m]; m_FontsTable[i][j][k][l][m] = NULL; } } }
void wxHtmlWinParser::InitParser(const wxString& source) { wxHtmlParser::InitParser(source); wxASSERT_MSG(m_DC != NULL, wxT("no DC assigned to wxHtmlWinParser!!")); m_FontBold = m_FontItalic = m_FontUnderlined = m_FontFixed = FALSE; m_FontSize = 3; //default one CreateCurrentFont(); // we're selecting default font into // we're not using GetCharWidth/Height() because of // differences under X and win wxCoord w,h; m_DC->GetTextExtent( wxT("H"), &w, &h); m_CharWidth = w; m_CharHeight = h; m_UseLink = false; m_Link = wxHtmlLinkInfo( wxEmptyString ); m_LinkColor.Set(0, 0, 0xFF); m_ActualColor.Set(0, 0, 0); const wxColour windowColour = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) ; m_ActualBackgroundColor = m_windowInterface ? m_windowInterface->GetHTMLBackgroundColour() : windowColour; m_ActualBackgroundMode = wxTRANSPARENT; m_Align = wxHTML_ALIGN_LEFT; m_ScriptMode = wxHTML_SCRIPT_NORMAL; m_ScriptBaseline = 0; m_tmpLastWasSpace = false; m_lastWordCell = NULL; // open the toplevel container that contains everything else and that // is never closed (this makes parser's life easier): OpenContainer(); // then open the first container into which page's content will go: OpenContainer(); #if !wxUSE_UNICODE wxString charset = ExtractCharsetInformation(source); if (!charset.empty()) { wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charset); if (enc != wxFONTENCODING_SYSTEM) SetInputEncoding(enc); } #endif m_Container->InsertCell(new wxHtmlColourCell(m_ActualColor)); m_Container->InsertCell ( new wxHtmlColourCell ( m_ActualBackgroundColor, m_ActualBackgroundMode == wxTRANSPARENT ? wxHTML_CLR_TRANSPARENT_BACKGROUND : wxHTML_CLR_BACKGROUND ) ); m_Container->InsertCell(new wxHtmlFontCell(CreateCurrentFont())); }