diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index be0602d57f..63c8fc9c60 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -46,6 +46,7 @@ #include #include +#include "tools/pcb_tool.h" #include "pns_kicad_iface.h" #include "pns_routing_settings.h" @@ -470,7 +471,7 @@ PNS_KICAD_IFACE::PNS_KICAD_IFACE() { m_ruleResolver = nullptr; m_board = nullptr; - m_frame = nullptr; + m_tool = nullptr; m_view = nullptr; m_previewItems = nullptr; m_world = nullptr; @@ -989,7 +990,7 @@ void PNS_KICAD_IFACE::Commit() { EraseView(); m_commit->Push( wxT( "Added a track" ) ); - m_commit.reset( new BOARD_COMMIT( m_frame ) ); + m_commit.reset( new BOARD_COMMIT( m_tool ) ); } @@ -1032,10 +1033,13 @@ void PNS_KICAD_IFACE::SetRouter( PNS::ROUTER* aRouter ) } -void PNS_KICAD_IFACE::SetHostFrame( PCB_EDIT_FRAME* aFrame ) +void PNS_KICAD_IFACE::SetHostTool( PCB_TOOL* aTool ) { - m_frame = aFrame; - - m_commit.reset( new BOARD_COMMIT( m_frame ) ); - m_dispOptions = (PCB_DISPLAY_OPTIONS*) m_frame->GetDisplayOptions(); + m_tool = aTool; + m_commit.reset( new BOARD_COMMIT( m_tool ) ); +} + +void PNS_KICAD_IFACE::SetDisplayOptions( PCB_DISPLAY_OPTIONS *aDispOptions ) +{ + m_dispOptions = aDispOptions; } diff --git a/pcbnew/router/pns_kicad_iface.h b/pcbnew/router/pns_kicad_iface.h index cb3f66b008..3d9b6e223a 100644 --- a/pcbnew/router/pns_kicad_iface.h +++ b/pcbnew/router/pns_kicad_iface.h @@ -32,6 +32,7 @@ class PNS_PCBNEW_DEBUG_DECORATOR; class BOARD; class BOARD_COMMIT; class PCB_DISPLAY_OPTIONS; +class PCB_TOOL; namespace KIGFX { @@ -44,7 +45,8 @@ public: ~PNS_KICAD_IFACE(); void SetRouter( PNS::ROUTER* aRouter ) override; - void SetHostFrame( PCB_EDIT_FRAME* aFrame ); + void SetHostTool( PCB_TOOL* aTool ); + void SetDisplayOptions( PCB_DISPLAY_OPTIONS* aDispOptions ); void SetBoard( BOARD* aBoard ); void SetView( KIGFX::VIEW* aView ); @@ -76,7 +78,7 @@ private: PNS::NODE* m_world; PNS::ROUTER* m_router; BOARD* m_board; - PCB_EDIT_FRAME* m_frame; + PCB_TOOL* m_tool; std::unique_ptr m_commit; PCB_DISPLAY_OPTIONS* m_dispOptions; }; diff --git a/pcbnew/router/pns_tool_base.cpp b/pcbnew/router/pns_tool_base.cpp index dc068eb3fc..6f0bf61f24 100644 --- a/pcbnew/router/pns_tool_base.cpp +++ b/pcbnew/router/pns_tool_base.cpp @@ -100,7 +100,7 @@ void TOOL_BASE::Reset( RESET_REASON aReason ) m_iface = new PNS_KICAD_IFACE; m_iface->SetBoard( board() ); m_iface->SetView( getView() ); - m_iface->SetHostFrame( frame() ); + m_iface->SetHostTool( this ); m_router = new ROUTER; m_router->SetInterface( m_iface ); @@ -156,14 +156,12 @@ ITEM* TOOL_BASE::pickSingleItem( const VECTOR2I& aWhere, int aNet, int aLayer ) } ITEM* rv = NULL; - PCB_EDIT_FRAME* frame = getEditFrame(); - PCB_DISPLAY_OPTIONS* displ_opts = (PCB_DISPLAY_OPTIONS*)frame->GetDisplayOptions(); for( int i = 0; i < 4; i++ ) { ITEM* item = prioritized[i]; - if( displ_opts->m_ContrastModeDisplay ) + if( displayOptions()->m_ContrastModeDisplay ) if( item && !item->Layers().Overlaps( tl ) ) item = NULL;