Setup painter in PCB_DRAW_PANEL_GAL instead of EDA_DRAW_PANEL_GAL

This commit is contained in:
Jon Evans 2017-02-15 21:06:05 -05:00 committed by Maciej Suminski
parent 9375e18fb6
commit 7058e4eb21
2 changed files with 6 additions and 4 deletions

View File

@ -73,10 +73,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
#endif #endif
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
m_painter = new KIGFX::PCB_PAINTER( m_gal );
m_view = new KIGFX::VIEW( true ); m_view = new KIGFX::VIEW( true );
m_view->SetPainter( m_painter );
m_view->SetGAL( m_gal ); m_view->SetGAL( m_gal );
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this ); Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this );
@ -131,7 +128,6 @@ EDA_DRAW_PANEL_GAL::~EDA_DRAW_PANEL_GAL()
assert( !m_drawing ); assert( !m_drawing );
delete m_painter;
delete m_viewControls; delete m_viewControls;
delete m_view; delete m_view;
delete m_gal; delete m_gal;
@ -165,6 +161,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
PROF_COUNTER totalRealTime; PROF_COUNTER totalRealTime;
#endif /* PROFILE */ #endif /* PROFILE */
wxASSERT( m_painter );
m_drawing = true; m_drawing = true;
KIGFX::PCB_RENDER_SETTINGS* settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_painter->GetSettings() ); KIGFX::PCB_RENDER_SETTINGS* settings = static_cast<KIGFX::PCB_RENDER_SETTINGS*>( m_painter->GetSettings() );

View File

@ -107,6 +107,9 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
setDefaultLayerOrder(); setDefaultLayerOrder();
setDefaultLayerDeps(); setDefaultLayerDeps();
m_painter = new KIGFX::PCB_PAINTER( m_gal );
m_view->SetPainter( m_painter );
// Load display options (such as filled/outline display of items). // Load display options (such as filled/outline display of items).
// Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class) // Can be made only if the parent window is an EDA_DRAW_FRAME (or a derived class)
// which is not always the case (namely when it is used from a wxDialog like the pad editor) // which is not always the case (namely when it is used from a wxDialog like the pad editor)
@ -122,6 +125,7 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy
PCB_DRAW_PANEL_GAL::~PCB_DRAW_PANEL_GAL() PCB_DRAW_PANEL_GAL::~PCB_DRAW_PANEL_GAL()
{ {
delete m_painter;
delete m_worksheet; delete m_worksheet;
delete m_ratsnest; delete m_ratsnest;
} }