/////////////////////////////////////////////////////////////////////////////
-// Name: mod_pre.cpp
+// Name: m_pre.cpp
// Purpose: wxHtml module for <PRE> ... </PRE> tag (code citation)
// Author: Vaclav Slavik
// RCS-ID: $Id$
#pragma implementation
#endif
-#include <wx/wxprec.h>
+#include "wx/wxprec.h"
-#if wxUSE_HTML
+#include "wx/defs.h"
+#if wxUSE_HTML && wxUSE_STREAMS
#ifdef __BORDLANDC__
#pragma hdrstop
#endif
#ifndef WXPRECOMP
-#include <wx/wx.h>
+#include "wx/wx.h"
#endif
#include "wx/html/m_templ.h"
#include "wx/html/htmlcell.h"
-#include <wx/tokenzr.h>
+#include "wx/tokenzr.h"
+#include "wx/encconv.h"
-FORCE_LINK_ME(mod_pre)
+FORCE_LINK_ME(m_pre)
//-----------------------------------------------------------------------------
m_Width = m_Height = 0;
i = 0;
-#if (wxVERSION_NUMBER < 2100)
- while (tokenizer.HasMoreToken()) {
-#else
while (tokenizer.HasMoreTokens()) {
-#endif
if (i % 10 == 0) m_Text = (wxString**) realloc(m_Text, sizeof(wxString*) * (i + 10));
tmp = tokenizer.NextToken();
- tmp.Replace(" ", " ", TRUE);
- tmp.Replace(""", "\"", TRUE);
- tmp.Replace("<", "<", TRUE);
- tmp.Replace(">", ">", TRUE);
- tmp.Replace("&", "&", TRUE);
- tmp.Replace("\t", " ", TRUE);
- tmp.Replace("\r", "", TRUE);
+ tmp.Replace(wxT("©"), wxT("(c)"), TRUE);
+ tmp.Replace(wxT(" "), wxT(" "), TRUE);
+ tmp.Replace(wxT("""), wxT("\""), TRUE);
+ tmp.Replace(wxT("<"), wxT("<"), TRUE);
+ tmp.Replace(wxT(">"), wxT(">"), TRUE);
+ tmp.Replace(wxT("&"), wxT("&"), TRUE);
+ tmp.Replace(wxT("\t"), wxT(" "), TRUE);
+ tmp.Replace(wxT("\r"), wxT(""), TRUE);
m_Text[i++] = new wxString(tmp);
dc.GetTextExtent(tmp, &x, &z, &z);
m_WParser -> CloseContainer();
c = m_WParser -> OpenContainer();
- c -> SetAlignHor(HTML_ALIGN_LEFT);
- c -> SetIndent(m_WParser -> GetCharHeight(), HTML_INDENT_VERTICAL);
+ 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);
+ 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);