From 68df211faedeabdf4259858109d1bd7385fdccf5 Mon Sep 17 00:00:00 2001 From: Jamie Gadd Date: Sun, 5 Feb 2006 11:59:59 +0000 Subject: [PATCH] Deprecate wxDC::{Begin,End}Drawing() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/samples/ogl/ogledit/view.cpp | 2 -- contrib/src/gizmos/ledctrl.cpp | 3 --- contrib/src/gizmos/statpict.cpp | 3 --- contrib/src/stc/ScintillaWX.cpp | 2 -- demos/life/life.cpp | 11 ----------- docs/latex/wx/dc.tex | 25 ------------------------- include/wx/dc.h | 6 ++++-- include/wx/generic/dcpsg.h | 3 --- include/wx/gtk/gnome/gprint.h | 3 --- samples/rotate/rotate.cpp | 3 --- src/common/dcbase.cpp | 10 ++++++++++ src/generic/colrdlgg.cpp | 14 -------------- src/generic/listctrl.cpp | 8 -------- src/msw/dcmemory.cpp | 4 ---- src/msw/metafile.cpp | 4 ---- src/msw/ole/activex.cpp | 3 --- src/msw/window.cpp | 3 --- src/os2/dcmemory.cpp | 2 -- src/os2/metafile.cpp | 4 ---- src/os2/window.cpp | 2 -- src/stc/ScintillaWX.cpp | 2 -- 21 files changed, 14 insertions(+), 103 deletions(-) diff --git a/contrib/samples/ogl/ogledit/view.cpp b/contrib/samples/ogl/ogledit/view.cpp index dcf1ac3e09..4ada8beebe 100644 --- a/contrib/samples/ogl/ogledit/view.cpp +++ b/contrib/samples/ogl/ogledit/view.cpp @@ -118,7 +118,6 @@ void DiagramView::OnDraw(wxDC *dc) // This part was added to preform the print preview and printing functions - dc->BeginDrawing(); // Allows optimization of drawing code under MS Windows. wxDiagram *diagram_p=((DiagramDocument*)GetDocument())->GetDiagram(); // Get the current diagram if (diagram_p->GetShapeList()) { @@ -135,7 +134,6 @@ void DiagramView::OnDraw(wxDC *dc) current = current->GetNext(); // Procede to the next shape in the list } } - dc->EndDrawing(); // Allows optimization of drawing code under MS Windows. } void DiagramView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint)) diff --git a/contrib/src/gizmos/ledctrl.cpp b/contrib/src/gizmos/ledctrl.cpp index 0d87f8c1c7..458af3f4cc 100644 --- a/contrib/src/gizmos/ledctrl.cpp +++ b/contrib/src/gizmos/ledctrl.cpp @@ -174,7 +174,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event)) wxMemoryDC MemDc; MemDc.SelectObject(*pMemoryBitmap); - MemDc.BeginDrawing(); // Draw background. MemDc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID)); @@ -241,8 +240,6 @@ void wxLEDNumberCtrl::OnPaint(wxPaintEvent &WXUNUSED(event)) } } - MemDc.EndDrawing(); - // Blit the memory dc to screen. Dc.Blit(0, 0, Width, Height, &MemDc, 0, 0, wxCOPY); delete pMemoryBitmap; diff --git a/contrib/src/gizmos/statpict.cpp b/contrib/src/gizmos/statpict.cpp index f6b97869df..a6fd9f768e 100644 --- a/contrib/src/gizmos/statpict.cpp +++ b/contrib/src/gizmos/statpict.cpp @@ -89,7 +89,6 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event)) wxPaintDC dc( this ); PrepareDC( dc ); - dc.BeginDrawing(); wxSize sz = GetSize(); wxSize bmpsz( Bitmap.GetWidth(), Bitmap.GetHeight() ); @@ -145,7 +144,5 @@ void wxStaticPicture::OnPaint(wxPaintEvent& WXUNUSED(event)) } else dc.DrawBitmap( Bitmap, pos.x, pos.y ); - - dc.EndDrawing(); } diff --git a/contrib/src/stc/ScintillaWX.cpp b/contrib/src/stc/ScintillaWX.cpp index 07d8349199..a5e5c66804 100644 --- a/contrib/src/stc/ScintillaWX.cpp +++ b/contrib/src/stc/ScintillaWX.cpp @@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { PRectangle rcClient = GetClientRectangle(); paintingAllText = rcPaint.Contains(rcClient); - dc->BeginDrawing(); ClipChildren(*dc, rcPaint); Paint(surfaceWindow, rcPaint); @@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { FullPaint(); } paintState = notPainting; - dc->EndDrawing(); } diff --git a/demos/life/life.cpp b/demos/life/life.cpp index cc61369e11..dc1ca609fa 100644 --- a/demos/life/life.cpp +++ b/demos/life/life.cpp @@ -771,9 +771,7 @@ void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, bool alive) dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN); dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH); - dc.BeginDrawing(); DrawCell(i, j, dc); - dc.EndDrawing(); } void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, wxDC &dc) @@ -810,8 +808,6 @@ void LifeCanvas::DrawChanged() m_viewportY + m_viewportH, true); - dc.BeginDrawing(); - if (m_cellsize == 1) { dc.SetPen(*wxBLACK_PEN); @@ -830,7 +826,6 @@ void LifeCanvas::DrawChanged() for (size_t m = 0; m < ncells; m++) DrawCell(cells[m].i, cells[m].j, dc); } - dc.EndDrawing(); } // event handlers @@ -859,7 +854,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) bool done = m_life->FindMore(&cells, &ncells); // erase all damaged cells and draw the grid - dc.BeginDrawing(); dc.SetBrush(*wxWHITE_BRUSH); if (m_cellsize <= 2) @@ -897,8 +891,6 @@ void LifeCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) // last set for (size_t m = 0; m < ncells; m++) DrawCell(cells[m].i, cells[m].j, dc); - - dc.EndDrawing(); } void LifeCanvas::OnMouse(wxMouseEvent& event) @@ -951,7 +943,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event) wxClientDC dc(this); dc.SetPen(alive? *wxBLACK_PEN : *wxWHITE_PEN); dc.SetBrush(alive? *wxBLACK_BRUSH : *wxWHITE_BRUSH); - dc.BeginDrawing(); // draw a line of cells using Bresenham's algorithm wxInt32 d, ii, jj, di, ai, si, dj, aj, sj; @@ -1007,8 +998,6 @@ void LifeCanvas::OnMouse(wxMouseEvent& event) DrawCell(ii, jj, dc); m_mi = ii; m_mj = jj; - - dc.EndDrawing(); } ((LifeFrame *) wxGetApp().GetTopWindow())->UpdateInfoText(); diff --git a/docs/latex/wx/dc.tex b/docs/latex/wx/dc.tex index a1ee49c5d6..6ee2cd24e6 100644 --- a/docs/latex/wx/dc.tex +++ b/docs/latex/wx/dc.tex @@ -33,22 +33,6 @@ them. \latexignore{\rtfignore{\wxheading{Members}}} -\membersection{wxDC::BeginDrawing}\label{wxdcbegindrawing} - -\func{void}{BeginDrawing}{\void} - -Allows optimization of drawing code under MS Windows. Enclose -drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp -calls. - -Drawing to a wxDialog panel device context outside of a -system-generated OnPaint event {\it requires} this pair of calls to -enclose drawing code. This is because a Windows dialog box does not have -a retained device context associated with it, and selections such as pen -and brush settings would be lost if the device context were obtained and -released for each drawing operation. - - \membersection{wxDC::Blit}\label{wxdcblit} \func{bool}{Blit}{\param{wxCoord}{ xdest}, \param{wxCoord}{ ydest}, \param{wxCoord}{ width}, \param{wxCoord}{ height}, @@ -556,15 +540,6 @@ wxUSE\_DC\_CACHEING preprocessor symbol for portability. Ends a document (only relevant when outputting to a printer). -\membersection{wxDC::EndDrawing}\label{wxdcenddrawing} - -\func{void}{EndDrawing}{\void} - -Allows optimization of drawing code under MS Windows. Enclose -drawing primitives between {\bf BeginDrawing} and {\bf EndDrawing}\rtfsp -calls. - - \membersection{wxDC::EndPage}\label{wxdcendpage} \func{void}{EndPage}{\void} diff --git a/include/wx/dc.h b/include/wx/dc.h index a95bd99da4..4924efc592 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -136,8 +136,10 @@ public: ~wxDCBase() { } - virtual void BeginDrawing() { } - virtual void EndDrawing() { } +#if WXWIN_COMPATIBILITY_2_6 + wxDEPRECATED( virtual void BeginDrawing() ); + wxDEPRECATED( virtual void EndDrawing() ); +#endif // WXWIN_COMPATIBILITY_2_6 // graphic primitives // ------------------ diff --git a/include/wx/generic/dcpsg.h b/include/wx/generic/dcpsg.h index 6dfc6804b5..e3186aabb4 100644 --- a/include/wx/generic/dcpsg.h +++ b/include/wx/generic/dcpsg.h @@ -44,9 +44,6 @@ public: virtual bool Ok() const; - virtual void BeginDrawing() {} - virtual void EndDrawing() {} - bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; diff --git a/include/wx/gtk/gnome/gprint.h b/include/wx/gtk/gnome/gprint.h index 80189e3561..9397e2f3af 100644 --- a/include/wx/gtk/gnome/gprint.h +++ b/include/wx/gtk/gnome/gprint.h @@ -202,9 +202,6 @@ public: bool Ok() const; - virtual void BeginDrawing() {} - virtual void EndDrawing() {} - bool DoFloodFill(wxCoord x1, wxCoord y1, const wxColour &col, int style=wxFLOOD_SURFACE ); bool DoGetPixel(wxCoord x1, wxCoord y1, wxColour *col) const; void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); diff --git a/samples/rotate/rotate.cpp b/samples/rotate/rotate.cpp index 7313f50ec8..fb1f8c286f 100644 --- a/samples/rotate/rotate.cpp +++ b/samples/rotate/rotate.cpp @@ -213,7 +213,6 @@ void MyCanvas::OnPaint (wxPaintEvent &) size_t numImages = m_images.GetCount(); wxPaintDC dc(this); - dc.BeginDrawing(); dc.SetTextForeground(wxColour(255, 255, 255)); dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10); @@ -222,8 +221,6 @@ void MyCanvas::OnPaint (wxPaintEvent &) MyRenderedImage & image = m_images.Item(i); dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true); } - - dc.EndDrawing(); } // ---------------------------------------------------------------------------- diff --git a/src/common/dcbase.cpp b/src/common/dcbase.cpp index 4cb7b53482..092f356574 100644 --- a/src/common/dcbase.cpp +++ b/src/common/dcbase.cpp @@ -33,6 +33,16 @@ // implementation // ============================================================================ +#if WXWIN_COMPATIBILITY_2_6 +void wxDCBase::BeginDrawing() +{ +} + +void wxDCBase::EndDrawing() +{ +} +#endif // WXWIN_COMPATIBILITY_2_6 + // ---------------------------------------------------------------------------- // special symbols // ---------------------------------------------------------------------------- diff --git a/src/generic/colrdlgg.cpp b/src/generic/colrdlgg.cpp index c347ecc31b..a868d28d58 100644 --- a/src/generic/colrdlgg.cpp +++ b/src/generic/colrdlgg.cpp @@ -367,8 +367,6 @@ void wxGenericColourDialog::InitializeColours(void) void wxGenericColourDialog::PaintBasicColours(wxDC& dc) { - dc.BeginDrawing(); - int i; for (i = 0; i < 6; i++) { @@ -387,13 +385,10 @@ void wxGenericColourDialog::PaintBasicColours(wxDC& dc) dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y); } } - dc.EndDrawing(); } void wxGenericColourDialog::PaintCustomColours(wxDC& dc) { - dc.BeginDrawing(); - int i; for (i = 0; i < 2; i++) { @@ -413,7 +408,6 @@ void wxGenericColourDialog::PaintCustomColours(wxDC& dc) dc.DrawRectangle( x, y, smallRectangleSize.x, smallRectangleSize.y); } } - dc.EndDrawing(); } void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw) @@ -421,8 +415,6 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw) if ( colourSelection < 0 ) return; - dc.BeginDrawing(); - // Number of pixels bigger than the standard rectangle size // for drawing a highlight int deltaX = 2; @@ -462,14 +454,10 @@ void wxGenericColourDialog::PaintHighlight(wxDC& dc, bool draw) dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.DrawRectangle( x, y, (smallRectangleSize.x + (2*deltaX)), (smallRectangleSize.y + (2*deltaY))); } - - dc.EndDrawing(); } void wxGenericColourDialog::PaintCustomColour(wxDC& dc) { - dc.BeginDrawing(); - dc.SetPen(*wxBLACK_PEN); wxBrush *brush = new wxBrush(colourData.m_dataColour, wxSOLID); @@ -480,8 +468,6 @@ void wxGenericColourDialog::PaintCustomColour(wxDC& dc) dc.SetBrush(wxNullBrush); delete brush; - - dc.EndDrawing(); } void wxGenericColourDialog::OnBasicColourClick(int which) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index bc9bb84c92..62fd813fbe 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -1683,8 +1683,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) PrepareDC( dc ); AdjustDC( dc ); - dc.BeginDrawing(); - dc.SetFont( GetFont() ); // width and height of the entire header window @@ -1794,8 +1792,6 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) x += wCol; } - - dc.EndDrawing(); } void wxListHeaderWindow::DrawCurrent() @@ -2591,8 +2587,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) int dev_x, dev_y; CalcScrolledPosition( 0, 0, &dev_x, &dev_y ); - dc.BeginDrawing(); - dc.SetFont( GetFont() ); if ( InReportView() ) @@ -2700,8 +2694,6 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } } #endif - - dc.EndDrawing(); } void wxListMainWindow::HighlightAll( bool on ) diff --git a/src/msw/dcmemory.cpp b/src/msw/dcmemory.cpp index 3d1201ce1b..9633d80691 100644 --- a/src/msw/dcmemory.cpp +++ b/src/msw/dcmemory.cpp @@ -58,12 +58,8 @@ wxMemoryDC::wxMemoryDC(wxDC *dc) { wxCHECK_RET( dc, _T("NULL dc in wxMemoryDC ctor") ); - dc->BeginDrawing(); - CreateCompatible(dc); - dc->EndDrawing(); - Init(); } diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 3032a5e2cd..0092107a7c 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -122,8 +122,6 @@ bool wxMetafile::Play(wxDC *dc) if (!m_refData) return false; - dc->BeginDrawing(); - if (dc->GetHDC() && M_METAFILEDATA->m_metafile) { if ( !::PlayMetaFile(GetHdcOf(*dc), (HMETAFILE) @@ -133,8 +131,6 @@ bool wxMetafile::Play(wxDC *dc) } } - dc->EndDrawing(); - return true; } diff --git a/src/msw/ole/activex.cpp b/src/msw/ole/activex.cpp index e6a9fc2902..5b086b77db 100644 --- a/src/msw/ole/activex.cpp +++ b/src/msw/ole/activex.cpp @@ -813,7 +813,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event)) // Draw only when control is windowless or deactivated if (m_viewObject) { - dc.BeginDrawing(); int w, h; GetParent()->GetSize(&w, &h); RECT posRect; @@ -830,8 +829,6 @@ void wxActiveXContainer::OnPaint(wxPaintEvent& WXUNUSED(event)) RECTL *prcBounds = (RECTL *) &posRect; m_viewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, (HDC)dc.GetHDC(), prcBounds, NULL, NULL, 0); - - dc.EndDrawing(); } // We've got this one I think diff --git a/src/msw/window.cpp b/src/msw/window.cpp index cac2a3f2db..88ec734530 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -4079,14 +4079,11 @@ bool wxWindowMSW::HandleEraseBkgnd(WXHDC hdc) dc.SetHDC(hdc); dc.SetWindow((wxWindow *)this); - dc.BeginDrawing(); wxEraseEvent event(m_windowId, &dc); event.SetEventObject(this); bool rc = GetEventHandler()->ProcessEvent(event); - dc.EndDrawing(); - // must be called manually as ~wxDC doesn't do anything for wxDCTemp dc.SelectOldObjects(hdc); diff --git a/src/os2/dcmemory.cpp b/src/os2/dcmemory.cpp index 26e11bfe8d..a786f31641 100644 --- a/src/os2/dcmemory.cpp +++ b/src/os2/dcmemory.cpp @@ -38,9 +38,7 @@ wxMemoryDC::wxMemoryDC( wxDC* pOldDC ) { - pOldDC->BeginDrawing(); CreateCompatible(pOldDC); - pOldDC->EndDrawing(); Init(); } // end of wxMemoryDC::wxMemoryDC diff --git a/src/os2/metafile.cpp b/src/os2/metafile.cpp index b2b402c794..797b023742 100644 --- a/src/os2/metafile.cpp +++ b/src/os2/metafile.cpp @@ -93,13 +93,9 @@ bool wxMetafile::Play(wxDC *dc) if (!m_refData) return FALSE; - dc->BeginDrawing(); - // if (dc->GetHDC() && M_METAFILEDATA->m_metafile) // PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile); - dc->EndDrawing(); - return true; } diff --git a/src/os2/window.cpp b/src/os2/window.cpp index e504c87e52..801175c4ea 100644 --- a/src/os2/window.cpp +++ b/src/os2/window.cpp @@ -3737,7 +3737,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC ) vDC.m_hPS = (HPS)hDC; // this is really a PS vDC.SetWindow((wxWindow*)this); - vDC.BeginDrawing(); wxEraseEvent vEvent(m_windowId, &vDC); @@ -3745,7 +3744,6 @@ bool wxWindowOS2::HandleEraseBkgnd( WXHDC hDC ) rc = GetEventHandler()->ProcessEvent(vEvent); - vDC.EndDrawing(); vDC.m_hPS = NULLHANDLE; return true; } // end of wxWindowOS2::HandleEraseBkgnd diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 07d8349199..a5e5c66804 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -678,7 +678,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { PRectangle rcClient = GetClientRectangle(); paintingAllText = rcPaint.Contains(rcClient); - dc->BeginDrawing(); ClipChildren(*dc, rcPaint); Paint(surfaceWindow, rcPaint); @@ -689,7 +688,6 @@ void ScintillaWX::DoPaint(wxDC* dc, wxRect rect) { FullPaint(); } paintState = notPainting; - dc->EndDrawing(); } -- 2.47.2