diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 66914177bd..e510d3a816 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -80,6 +80,11 @@ static const wxChar RealtimeConnectivity[] = wxT( "RealtimeConnectivity" ); */ static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" ); +/** + * Show PNS router debug graphics while routing + */ +static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" ); + } // namespace KEYS @@ -157,9 +162,10 @@ ADVANCED_CFG::ADVANCED_CFG() // Init defaults - this is done in case the config doesn't exist, // then the values will remain as set here. - m_EnableUsePadProperty = false; - m_realTimeConnectivity = true; - m_coroutineStackSize = AC_STACK::default_stack; + m_EnableUsePadProperty = false; + m_realTimeConnectivity = true; + m_coroutineStackSize = AC_STACK::default_stack; + m_ShowRouterDebugGraphics = false; loadFromConfigFile(); } @@ -203,6 +209,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) &m_coroutineStackSize, AC_STACK::default_stack, AC_STACK::min_stack, AC_STACK::max_stack ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ShowRouterDebugGraphics, + &m_ShowRouterDebugGraphics, false ) ); + wxConfigLoadSetups( &aCfg, configParams ); for( auto param : configParams ) diff --git a/include/advanced_config.h b/include/advanced_config.h index 5db05d2d1f..426a022f57 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -83,6 +83,11 @@ public: */ int m_coroutineStackSize; + /** + * Show PNS router debug graphics + */ + bool m_ShowRouterDebugGraphics; + private: ADVANCED_CFG(); diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index c7188ed945..02b3ab88cf 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -50,6 +50,8 @@ #include +#include + #include "tools/pcb_tool_base.h" #include "pns_kicad_iface.h" @@ -498,6 +500,9 @@ public: void AddLine( const SHAPE_LINE_CHAIN& aLine, int aType, int aWidth, const std::string aName = "" ) override { + if( !m_view ) + return; + ROUTER_PREVIEW_ITEM* pitem = new ROUTER_PREVIEW_ITEM( NULL, m_view ); pitem->Line( aLine, aWidth, aType ); @@ -1237,9 +1242,10 @@ void PNS_KICAD_IFACE::SetView( KIGFX::VIEW* aView ) delete m_debugDecorator; auto dec = new PNS_PCBNEW_DEBUG_DECORATOR(); - dec->SetView( m_view ); - m_debugDecorator = dec; + + if( ADVANCED_CFG::GetCfg().m_ShowRouterDebugGraphics ) + dec->SetView( m_view ); }