X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/31e24645c0318d043a9b7f071e4aa26fc8d483d0..08bf1d5d9840668ede9c953c6079b8d1db08c8d1:/src/html/m_pre.cpp?ds=sidebyside diff --git a/src/html/m_pre.cpp b/src/html/m_pre.cpp index e073b69a35..2cf0d2142c 100644 --- a/src/html/m_pre.cpp +++ b/src/html/m_pre.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: mod_pre.cpp +// Name: m_pre.cpp // Purpose: wxHtml module for
 ... 
tag (code citation) // Author: Vaclav Slavik // RCS-ID: $Id$ @@ -14,7 +14,7 @@ #include "wx/wxprec.h" #include "wx/defs.h" -#if wxUSE_HTML +#if wxUSE_HTML && wxUSE_STREAMS #ifdef __BORDLANDC__ #pragma hdrstop #endif @@ -29,8 +29,9 @@ #include "wx/html/htmlcell.h" #include "wx/tokenzr.h" +#include "wx/encconv.h" -FORCE_LINK_ME(mod_pre) +FORCE_LINK_ME(m_pre) //----------------------------------------------------------------------------- @@ -67,7 +68,8 @@ wxHtmlPRECell::wxHtmlPRECell(const wxString& s, wxDC& dc) : wxHtmlCell() m_Width = m_Height = 0; i = 0; - while (tokenizer.HasMoreTokens()) { + while (tokenizer.HasMoreTokens()) + { if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10)); tmp = tokenizer.NextToken(); tmp.Replace(wxT("©"), wxT("(c)"), TRUE); @@ -118,39 +120,46 @@ TAG_HANDLER_BEGIN(PRE, "PRE") { wxHtmlContainerCell *c; - int fixed = m_WParser -> GetFontFixed(), - italic = m_WParser -> GetFontItalic(), - underlined = m_WParser -> GetFontUnderlined(), - bold = m_WParser -> GetFontBold(), - fsize = m_WParser -> GetFontSize(); + int fixed = m_WParser->GetFontFixed(), + italic = m_WParser->GetFontItalic(), + underlined = m_WParser->GetFontUnderlined(), + bold = m_WParser->GetFontBold(), + fsize = m_WParser->GetFontSize(); - m_WParser -> CloseContainer(); - c = m_WParser -> OpenContainer(); - c -> SetAlignHor(wxHTML_ALIGN_LEFT); - c -> SetIndent(m_WParser -> GetCharHeight(), wxHTML_INDENT_VERTICAL); + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + c->SetAlignHor(wxHTML_ALIGN_LEFT); + c->SetIndent(m_WParser->GetCharHeight(), wxHTML_INDENT_VERTICAL); - m_WParser -> SetFontUnderlined(FALSE); - m_WParser -> SetFontBold(FALSE); - m_WParser -> SetFontItalic(FALSE); - m_WParser -> SetFontFixed(TRUE); - m_WParser -> SetFontSize(0); - c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(FALSE); + m_WParser->SetFontBold(FALSE); + m_WParser->SetFontItalic(FALSE); + m_WParser->SetFontFixed(TRUE); + m_WParser->SetFontSize(3); + c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); { wxString cit; - cit = m_WParser -> GetSource() -> Mid(tag.GetBeginPos(), tag.GetEndPos1() - tag.GetBeginPos()); - c -> InsertCell(new wxHtmlPRECell(cit, *(m_WParser -> GetDC()))); + wxEncodingConverter *encconv = m_WParser->GetEncodingConverter(); + cit = m_WParser->GetSource()->Mid(tag.GetBeginPos(), + tag.GetEndPos1() - tag.GetBeginPos()); + if (encconv) + c->InsertCell(new wxHtmlPRECell(encconv->Convert(cit), + *(m_WParser->GetDC()))); + else + c->InsertCell(new wxHtmlPRECell(cit, + *(m_WParser->GetDC()))); } - m_WParser -> SetFontUnderlined(underlined); - m_WParser -> SetFontBold(bold); - m_WParser -> SetFontItalic(italic); - m_WParser -> SetFontFixed(fixed); - m_WParser -> SetFontSize(fsize); - c -> InsertCell(new wxHtmlFontCell(m_WParser -> CreateCurrentFont())); + m_WParser->SetFontUnderlined(underlined); + m_WParser->SetFontBold(bold); + m_WParser->SetFontItalic(italic); + m_WParser->SetFontFixed(fixed); + m_WParser->SetFontSize(fsize); + c->InsertCell(new wxHtmlFontCell(m_WParser->CreateCurrentFont())); - m_WParser -> CloseContainer(); - m_WParser -> OpenContainer(); + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); return TRUE; }