- wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
- int v_y, v_h;
-
- if (m_tmpCanDrawLocks > 0) return;
- dc.SetMapMode(wxMM_TEXT);
-#if 0
-/* VS - I don't think this is neccessary any longer
- MSC_VER 1200 means MSVC 6.0 and it works fine */
-#if defined(_MSC_VER) && (_MSC_VER == 1200)
- ::SetMapMode((HDC)dc.GetHDC(), MM_TEXT);
-#endif
+ GetViewStart(&x, &y);
+ wxRect rect = GetUpdateRegion().GetBox();
+ wxSize sz = GetSize();
+
+ wxMemoryDC dcm;
+ if ( !m_backBuffer )
+ m_backBuffer = new wxBitmap(sz.x, sz.y);
+ dcm.SelectObject(*m_backBuffer);
+
+ // preserve the existing background, otherwise we'd erase anything the user
+ // code had drawn in its EVT_ERASE_BACKGROUND handler when we do the Blit
+ // back below
+ dcm.Blit(0, rect.GetTop(),
+ sz.x, rect.GetBottom() - rect.GetTop() + 1,
+ &dc,
+ 0, rect.GetTop());
+
+ PrepareDC(dcm);
+ dcm.SetMapMode(wxMM_TEXT);
+ dcm.SetBackgroundMode(wxTRANSPARENT);
+
+ wxHtmlRenderingInfo rinfo;
+ wxDefaultHtmlRenderingStyle rstyle;
+ rinfo.SetSelection(m_selection);
+ rinfo.SetStyle(&rstyle);
+ m_Cell->Draw(dcm, 0, 0,
+ y * wxHTML_SCROLL_STEP + rect.GetTop(),
+ y * wxHTML_SCROLL_STEP + rect.GetBottom(),
+ rinfo);
+
+//#define DEBUG_HTML_SELECTION
+#ifdef DEBUG_HTML_SELECTION
+ {
+ int xc, yc, x, y;
+ wxGetMousePosition(&xc, &yc);
+ ScreenToClient(&xc, &yc);
+ CalcUnscrolledPosition(xc, yc, &x, &y);
+ wxHtmlCell *at = m_Cell->FindCellByPos(x, y);
+ wxHtmlCell *before =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_BEFORE);
+ wxHtmlCell *after =
+ m_Cell->FindCellByPos(x, y, wxHTML_FIND_NEAREST_AFTER);
+
+ dcm.SetBrush(*wxTRANSPARENT_BRUSH);
+ dcm.SetPen(*wxBLACK_PEN);
+ if (at)
+ dcm.DrawRectangle(at->GetAbsPos(),
+ wxSize(at->GetWidth(),at->GetHeight()));
+ dcm.SetPen(*wxGREEN_PEN);
+ if (before)
+ dcm.DrawRectangle(before->GetAbsPos().x+1, before->GetAbsPos().y+1,
+ before->GetWidth()-2,before->GetHeight()-2);
+ dcm.SetPen(*wxRED_PEN);
+ if (after)
+ dcm.DrawRectangle(after->GetAbsPos().x+2, after->GetAbsPos().y+2,
+ after->GetWidth()-4,after->GetHeight()-4);
+ }