From 9214f5849ef42621e440dfd29acd27042fc57a05 Mon Sep 17 00:00:00 2001 From: Marco Serantoni Date: Fri, 20 May 2011 20:25:11 +0200 Subject: [PATCH] MacOSX: Complete support for wxOverlay (http://trac.wxwidgets.org/ticket/12894) --- common/zoom.cpp | 12 ------------ eeschema/controle.cpp | 20 ++++++++++++++++++++ pcbnew/editrack.cpp | 3 ++- pcbnew/moduleframe.cpp | 10 ++++++++++ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/common/zoom.cpp b/common/zoom.cpp index 775b5c635b..7a3d2b8760 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -22,20 +22,8 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe { AdjustScrollBars( aCenterPoint ); -#if !defined(__WXMAC__) - /* DrawPanel->Refresh() is not used here because the redraw is delayed and the mouse - * events (from MoveCursorToCrossHair ot others) during this delay create problems: the - * mouse cursor position is false in calculations. TODO: see exactly how the mouse - * creates problems when moving during refresh use Refresh() and update() do not change - * problems - */ - INSTALL_DC( dc, DrawPanel ); - DrawPanel->SetClipBox( dc ); - DrawPanel->ReDraw( &dc, true ); -#else DrawPanel->Refresh(); DrawPanel->Update(); -#endif /* Move the mouse cursor to the on grid graphic cursor position */ if( aWarpPointer ) diff --git a/eeschema/controle.cpp b/eeschema/controle.cpp index 7bd6454466..550f9328d8 100644 --- a/eeschema/controle.cpp +++ b/eeschema/controle.cpp @@ -221,8 +221,18 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( DrawPanel->IsMouseCaptured() ) { +#ifdef USE_WX_OVERLAY + wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + oDC.Clear(); + DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); +#else DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); +#endif } +#ifdef USE_WX_OVERLAY + else + DrawPanel->m_overlay.Reset(); +#endif } if( aHotKey ) @@ -294,8 +304,18 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH if( DrawPanel->IsMouseCaptured() ) { +#ifdef USE_WX_OVERLAY + wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + oDC.Clear(); + DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); +#else DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); +#endif } +#ifdef USE_WX_OVERLAY + else + DrawPanel->m_overlay.Reset(); +#endif } if( aHotKey ) diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 785344e593..a09c6723e4 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -688,6 +688,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE ) DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; +#ifndef USE_WX_OVERLAY /* Erase old track */ if( aErase ) { @@ -705,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo color ); } } - +#endif // MacOSX seems to need this. if( g_CurrentTrackList.GetCount() == 0 ) return; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index f1a8e3fa9c..d1593ec9d3 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -387,8 +387,18 @@ void WinEDA_ModuleEditFrame::GeneralControl( wxDC* aDC, const wxPoint& aPosition if( DrawPanel->IsMouseCaptured() ) { +#ifdef USE_WX_OVERLAY + wxDCOverlay oDC( DrawPanel->m_overlay, (wxWindowDC*)aDC ); + oDC.Clear(); + DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, false ); +#else DrawPanel->m_mouseCaptureCallback( DrawPanel, aDC, aPosition, true ); +#endif } +#ifdef USE_WX_OVERLAY + else + DrawPanel->m_overlay.Reset(); +#endif } if( aHotKey )