reduced code duplication in wxHtmlWinParser::AddText (no real change)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -133,6 +133,8 @@ protected:
|
||||
virtual void AddText(const wxChar* txt);
|
||||
|
||||
private:
|
||||
void DoAddText(wxChar *temp, int& templen, wxChar nbsp);
|
||||
|
||||
bool m_tmpLastWasSpace;
|
||||
wxChar *m_tmpStrBuf;
|
||||
size_t m_tmpStrBufSize;
|
||||
|
@@ -300,7 +300,6 @@ wxFSFile *wxHtmlWinParser::OpenURL(wxHtmlURLType type,
|
||||
|
||||
void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
{
|
||||
wxHtmlCell *c;
|
||||
size_t i = 0,
|
||||
x,
|
||||
lng = wxStrlen(txt);
|
||||
@@ -338,6 +337,20 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
if (x)
|
||||
{
|
||||
temp[templen-1] = wxT(' ');
|
||||
DoAddText(temp, templen, nbsp);
|
||||
m_tmpLastWasSpace = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (templen && (templen > 1 || temp[0] != wxT(' ')))
|
||||
{
|
||||
DoAddText(temp, templen, nbsp);
|
||||
m_tmpLastWasSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
void wxHtmlWinParser::DoAddText(wxChar *temp, int& templen, wxChar nbsp)
|
||||
{
|
||||
temp[templen] = 0;
|
||||
templen = 0;
|
||||
#if !wxUSE_UNICODE
|
||||
@@ -346,37 +359,18 @@ void wxHtmlWinParser::AddText(const wxChar* txt)
|
||||
#endif
|
||||
size_t len = wxStrlen(temp);
|
||||
for (size_t j = 0; j < len; j++)
|
||||
{
|
||||
if (temp[j] == nbsp)
|
||||
temp[j] = wxT(' ');
|
||||
c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||
if (m_UseLink)
|
||||
c->SetLink(m_Link);
|
||||
m_Container->InsertCell(c);
|
||||
((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
|
||||
m_lastWordCell = (wxHtmlWordCell*)c;
|
||||
m_tmpLastWasSpace = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (templen && (templen > 1 || temp[0] != wxT(' ')))
|
||||
{
|
||||
temp[templen] = 0;
|
||||
#if !wxUSE_UNICODE
|
||||
if (m_EncConv)
|
||||
m_EncConv->Convert(temp);
|
||||
#endif
|
||||
size_t len = wxStrlen(temp);
|
||||
for (size_t j = 0; j < len; j++)
|
||||
if (temp[j] == nbsp)
|
||||
temp[j] = wxT(' ');
|
||||
c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||
wxHtmlCell *c = new wxHtmlWordCell(temp, *(GetDC()));
|
||||
|
||||
if (m_UseLink)
|
||||
c->SetLink(m_Link);
|
||||
m_Container->InsertCell(c);
|
||||
((wxHtmlWordCell*)c)->SetPreviousWord(m_lastWordCell);
|
||||
m_lastWordCell = (wxHtmlWordCell*)c;
|
||||
m_tmpLastWasSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user