Trying to hide evidence of my negative programming skills...
(Why the hell did I write wxHTML in so strange way -- it used recursion a la Lisp instead of normal loop when it needed to iterate over cells...) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,7 +48,6 @@ wxHtmlCell::wxHtmlCell() : wxObject()
|
|||||||
wxHtmlCell::~wxHtmlCell()
|
wxHtmlCell::~wxHtmlCell()
|
||||||
{
|
{
|
||||||
if (m_Link) delete m_Link;
|
if (m_Link) delete m_Link;
|
||||||
if (m_Next) delete m_Next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -74,15 +73,10 @@ bool wxHtmlCell::AdjustPagebreak(int *pagebreak) const
|
|||||||
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
|
m_PosY < *pagebreak && m_PosY + m_Height > *pagebreak)
|
||||||
{
|
{
|
||||||
*pagebreak = m_PosY;
|
*pagebreak = m_PosY;
|
||||||
if (m_Next != NULL) m_Next->AdjustPagebreak(pagebreak);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
return FALSE;
|
||||||
if (m_Next != NULL) return m_Next->AdjustPagebreak(pagebreak);
|
|
||||||
else return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -100,28 +94,12 @@ void wxHtmlCell::SetLink(const wxHtmlLinkInfo& link)
|
|||||||
void wxHtmlCell::Layout(int w)
|
void wxHtmlCell::Layout(int w)
|
||||||
{
|
{
|
||||||
SetPos(0, 0);
|
SetPos(0, 0);
|
||||||
if (m_Next) m_Next->Layout(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|
||||||
{
|
|
||||||
if (m_Next) m_Next->Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlCell::DrawInvisible(wxDC& dc, int x, int y)
|
|
||||||
{
|
|
||||||
if (m_Next) m_Next->DrawInvisible(dc, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const
|
const wxHtmlCell* wxHtmlCell::Find(int condition, const void* param) const
|
||||||
{
|
{
|
||||||
if (m_Next) return m_Next->Find(condition, param);
|
return NULL;
|
||||||
else return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +120,6 @@ wxHtmlWordCell::wxHtmlWordCell(const wxString& word, wxDC& dc) : wxHtmlCell()
|
|||||||
void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
void wxHtmlWordCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
||||||
{
|
{
|
||||||
dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
|
dc.DrawText(m_Word, x + m_PosX, y + m_PosY);
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +147,11 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe
|
|||||||
|
|
||||||
wxHtmlContainerCell::~wxHtmlContainerCell()
|
wxHtmlContainerCell::~wxHtmlContainerCell()
|
||||||
{
|
{
|
||||||
if (m_Cells) delete m_Cells;
|
if (m_Cells)
|
||||||
|
{
|
||||||
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
delete cell;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -225,10 +206,12 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
|
|||||||
|
|
||||||
while (c)
|
while (c)
|
||||||
{
|
{
|
||||||
if (c->AdjustPagebreak(&pbrk)) rt = TRUE;
|
if (c->AdjustPagebreak(&pbrk))
|
||||||
|
rt = TRUE;
|
||||||
c = c->GetNext();
|
c = c->GetNext();
|
||||||
}
|
}
|
||||||
if (rt) *pagebreak = pbrk + m_PosY;
|
if (rt)
|
||||||
|
*pagebreak = pbrk + m_PosY;
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -273,7 +256,8 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
{
|
{
|
||||||
int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
int l = (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
|
||||||
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
int r = (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
|
||||||
m_Cells->Layout(m_Width - (l + r));
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
cell->Layout(m_Width - (l + r));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -420,23 +404,32 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
|
dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_Cells) m_Cells->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
|
if (m_Cells)
|
||||||
|
{
|
||||||
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
cell->Draw(dc, x + m_PosX, y + m_PosY, view_y1, view_y2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// container invisible, just proceed font+color changing:
|
// container invisible, just proceed font+color changing:
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
if (m_Cells)
|
||||||
|
{
|
||||||
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
cell->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
|
void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y)
|
||||||
{
|
{
|
||||||
if (m_Cells) m_Cells->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
if (m_Cells)
|
||||||
wxHtmlCell::DrawInvisible(dc, x, y);
|
{
|
||||||
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
cell->DrawInvisible(dc, x + m_PosX, y + m_PosY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -519,15 +512,17 @@ void wxHtmlContainerCell::SetWidthFloat(const wxHtmlTag& tag, double pixel_scale
|
|||||||
|
|
||||||
const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
|
const wxHtmlCell* wxHtmlContainerCell::Find(int condition, const void* param) const
|
||||||
{
|
{
|
||||||
const wxHtmlCell *r = NULL;
|
|
||||||
|
|
||||||
if (m_Cells)
|
if (m_Cells)
|
||||||
{
|
{
|
||||||
r = m_Cells->Find(condition, param);
|
const wxHtmlCell *r = NULL;
|
||||||
|
|
||||||
|
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
|
||||||
|
{
|
||||||
|
r = cell->Find(condition, param);
|
||||||
if (r) return r;
|
if (r) return r;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return wxHtmlCell::Find(condition, param);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -569,7 +564,6 @@ void wxHtmlColourCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||||
dc.SetTextBackground(m_Colour);
|
dc.SetTextBackground(m_Colour);
|
||||||
}
|
}
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
|
void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
|
||||||
@@ -581,7 +575,6 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
dc.SetBackground(wxBrush(m_Colour, wxSOLID));
|
||||||
dc.SetTextBackground(m_Colour);
|
dc.SetTextBackground(m_Colour);
|
||||||
}
|
}
|
||||||
wxHtmlCell::DrawInvisible(dc, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -594,13 +587,11 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
void wxHtmlFontCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
void wxHtmlFontCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
||||||
{
|
{
|
||||||
dc.SetFont(m_Font);
|
dc.SetFont(m_Font);
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxHtmlFontCell::DrawInvisible(wxDC& dc, int x, int y)
|
void wxHtmlFontCell::DrawInvisible(wxDC& dc, int x, int y)
|
||||||
{
|
{
|
||||||
dc.SetFont(m_Font);
|
dc.SetFont(m_Font);
|
||||||
wxHtmlCell::DrawInvisible(dc, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -638,8 +629,6 @@ void wxHtmlWidgetCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
|
|
||||||
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
||||||
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
||||||
|
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -658,8 +647,6 @@ void wxHtmlWidgetCell::DrawInvisible(wxDC& dc, int x, int y)
|
|||||||
|
|
||||||
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
((wxScrolledWindow*)(m_Wnd->GetParent()))->GetViewStart(&stx, &sty);
|
||||||
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
m_Wnd->SetSize(absx - wxHTML_SCROLL_STEP * stx, absy - wxHTML_SCROLL_STEP * sty, m_Width, m_Height);
|
||||||
|
|
||||||
wxHtmlCell::DrawInvisible(dc, x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -43,7 +43,8 @@ class wxHtmlLineCell : public wxHtmlCell
|
|||||||
public:
|
public:
|
||||||
wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;}
|
wxHtmlLineCell(int size) : wxHtmlCell() {m_Height = size;}
|
||||||
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
|
||||||
void Layout(int w) {m_Width = w; if (m_Next) m_Next->Layout(w);}
|
void Layout(int w)
|
||||||
|
{ m_Width = w; wxHtmlCell::Layout(w); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +55,6 @@ void wxHtmlLineCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
dc.SetBrush(mybrush);
|
dc.SetBrush(mybrush);
|
||||||
dc.SetPen(mypen);
|
dc.SetPen(mypen);
|
||||||
dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
|
dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -350,7 +350,6 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
(int) ((y + m_PosY) / m_Scale), TRUE);
|
(int) ((y + m_PosY) / m_Scale), TRUE);
|
||||||
dc.SetUserScale(us_x, us_y);
|
dc.SetUserScale(us_x, us_y);
|
||||||
}
|
}
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
wxHtmlLinkInfo *wxHtmlImageCell::GetLink( int x, int y ) const
|
||||||
|
@@ -59,7 +59,6 @@ void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
|
|||||||
{
|
{
|
||||||
dc.SetBrush(m_Brush);
|
dc.SetBrush(m_Brush);
|
||||||
dc.DrawEllipse(x + m_PosX + m_Width / 4, y + m_PosY + m_Height / 4, m_Width / 2, m_Width / 2);
|
dc.DrawEllipse(x + m_PosX + m_Width / 4, y + m_PosY + m_Height / 4, m_Width / 2, m_Width / 2);
|
||||||
wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user