From 7058e4eb216e4c1344fe6b727a22e4934c6c29a2 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Wed, 15 Feb 2017 21:06:05 -0500 Subject: [PATCH] Setup painter in PCB_DRAW_PANEL_GAL instead of EDA_DRAW_PANEL_GAL --- common/draw_panel_gal.cpp | 6 ++---- pcbnew/pcb_draw_panel_gal.cpp | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/draw_panel_gal.cpp b/common/draw_panel_gal.cpp index 614a0689a6..e14181d2fc 100644 --- a/common/draw_panel_gal.cpp +++ b/common/draw_panel_gal.cpp @@ -73,10 +73,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin #endif 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->SetPainter( m_painter ); m_view->SetGAL( m_gal ); 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 ); - delete m_painter; delete m_viewControls; delete m_view; delete m_gal; @@ -165,6 +161,8 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) PROF_COUNTER totalRealTime; #endif /* PROFILE */ + wxASSERT( m_painter ); + m_drawing = true; KIGFX::PCB_RENDER_SETTINGS* settings = static_cast( m_painter->GetSettings() ); diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index 422a5a4fee..efa3dd926d 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -107,6 +107,9 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aOptions, aGalTy setDefaultLayerOrder(); setDefaultLayerDeps(); + m_painter = new KIGFX::PCB_PAINTER( m_gal ); + m_view->SetPainter( m_painter ); + // 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) // 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() { + delete m_painter; delete m_worksheet; delete m_ratsnest; }