diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index a54ede4907..f47c4464fe 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -72,6 +72,7 @@ static const wxChar HoleWallThickness[] = wxT( "HoleWallPlatingThickness" ); static const wxChar CoroutineStackSize[] = wxT( "CoroutineStackSize" ); static const wxChar ShowRouterDebugGraphics[] = wxT( "ShowRouterDebugGraphics" ); static const wxChar EnableRouterDump[] = wxT( "EnableRouterDump" ); +static const wxChar EnableMultichannelTool[] = wxT( "EnableMultichannelTool" ); static const wxChar HyperZoom[] = wxT( "HyperZoom" ); static const wxChar CompactFileSave[] = wxT( "CompactSave" ); static const wxChar DrawArcAccuracy[] = wxT( "DrawArcAccuracy" ); @@ -206,6 +207,7 @@ ADVANCED_CFG::ADVANCED_CFG() m_CoroutineStackSize = AC_STACK::default_stack; m_ShowRouterDebugGraphics = false; m_EnableRouterDump = false; + m_EnableMultichannelTool = false; m_HyperZoom = false; m_DrawArcAccuracy = 10.0; m_DrawArcCenterMaxAngle = 50.0; @@ -357,6 +359,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) &m_ShowRouterDebugGraphics, m_ShowRouterDebugGraphics ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableMultichannelTool, + &m_EnableMultichannelTool, m_EnableMultichannelTool ) ); + configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableRouterDump, &m_EnableRouterDump, m_EnableRouterDump ) ); diff --git a/include/advanced_config.h b/include/advanced_config.h index c259815ebe..66030b21a7 100644 --- a/include/advanced_config.h +++ b/include/advanced_config.h @@ -227,6 +227,15 @@ public: */ bool m_EnableRouterDump; + /** + * Enable Multichannel tool(s) (repeat layout, placement areas) + * + * Setting name: "EnableMultichannelTool" + * Valid values: 0 or 1 + * Default value: 0 + */ + bool m_EnableMultichannelTool; + /** * Slide the zoom steps over for debugging things "up close". * diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 14696604cf..f0ba7aae1d 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -432,13 +432,17 @@ void PCB_EDIT_FRAME::doReCreateMenuBar() toolsMenu->Add( PCB_ACTIONS::showPythonConsole ); } - ACTION_MENU* multichannelSubmenu = new ACTION_MENU( false, selTool ); - multichannelSubmenu->SetTitle( _( "Multi-Channel" ) ); - multichannelSubmenu->SetIcon( BITMAPS::mode_module ); - multichannelSubmenu->Add( PCB_ACTIONS::generatePlacementRuleAreas ); - multichannelSubmenu->Add( PCB_ACTIONS::repeatLayout ); + if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool ) + { + printf("EnableMCTool\n"); + ACTION_MENU* multichannelSubmenu = new ACTION_MENU( false, selTool ); + multichannelSubmenu->SetTitle( _( "Multi-Channel" ) ); + multichannelSubmenu->SetIcon( BITMAPS::mode_module ); + multichannelSubmenu->Add( PCB_ACTIONS::generatePlacementRuleAreas ); + multichannelSubmenu->Add( PCB_ACTIONS::repeatLayout ); - toolsMenu->Add( multichannelSubmenu ); + toolsMenu->Add( multichannelSubmenu ); + } ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false, selTool ); submenuActionPlugins->SetTitle( _( "External Plugins" ) ); diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index 692abd7c9f..07c14de03a 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -2390,10 +2390,17 @@ void PCB_IO_KICAD_SEXPR::format( const PCB_TRACK* aTrack, int aNestLevel ) const void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone, int aNestLevel ) const { + // temporary safeguard for the multichannel tool (and placement area/room support). When the tool is off + // (default), KiCad will not write any placement info in the RAs (and won't break file format compatibility) + + if( ! ADVANCED_CFG::GetCfg().m_EnableMultichannelTool && aZone->GetIsRuleArea() && aZone->GetRuleAreaType() == RULE_AREA_TYPE::PLACEMENT ) + return; + // Save the NET info. // For keepout and non copper zones, net code and net name are irrelevant // so be sure a dummy value is stored, just for ZONE compatibility // (perhaps netcode and netname should be not stored) + bool has_no_net = aZone->GetIsRuleArea() || !aZone->IsOnCopperLayer(); m_out->Print( aNestLevel, "(zone (net %d) (net_name %s)",