7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-21 00:21:25 +00:00

MULTICHANNEL_TOOL: enable the tool by default and remove ADVANCED_CFG option

This commit is contained in:
Tomasz Wlostowski 2024-11-01 21:45:36 +01:00
parent 27f26822dc
commit 2daabbf6e2
6 changed files with 164 additions and 194 deletions

View File

@ -73,7 +73,6 @@ 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" );
@ -216,7 +215,6 @@ 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;
@ -381,9 +379,6 @@ 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 ) );

View File

@ -234,15 +234,6 @@ 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".
*

View File

@ -119,18 +119,17 @@ DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES( PCB_BASE_FRAME* aPar
m_keepoutProperties = new PANEL_RULE_AREA_PROPERTIES_KEEPOUT_BASE( m_areaPropertiesNb );
m_areaPropertiesNb->AddPage( m_keepoutProperties, _( "Keepouts" ), true );
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
{
m_placementProperties = new PANEL_RULE_AREA_PROPERTIES_PLACEMENT_BASE( m_areaPropertiesNb );
m_areaPropertiesNb->AddPage( m_placementProperties, _( "Placement" ) );
m_placementProperties = new PANEL_RULE_AREA_PROPERTIES_PLACEMENT_BASE( m_areaPropertiesNb );
m_areaPropertiesNb->AddPage( m_placementProperties, _( "Placement" ) );
m_placementProperties->m_SheetCb->Connect( wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnSheetNameClicked ), nullptr,
this );
m_placementProperties->m_ComponentsCb->Connect( wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnComponentClassClicked ),
nullptr, this );
}
m_placementProperties->m_SheetCb->Connect(
wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnSheetNameClicked ), nullptr,
this );
m_placementProperties->m_ComponentsCb->Connect(
wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnComponentClassClicked ), nullptr,
this );
if( aConvertSettings )
{
@ -187,15 +186,14 @@ DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES( PCB_BASE_FRAME* aPar
DIALOG_RULE_AREA_PROPERTIES::~DIALOG_RULE_AREA_PROPERTIES()
{
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
{
m_placementProperties->m_SheetCb->Disconnect( wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnSheetNameClicked ), nullptr,
this );
m_placementProperties->m_ComponentsCb->Disconnect( wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnComponentClassClicked ),
nullptr, this );
}
m_placementProperties->m_SheetCb->Disconnect(
wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnSheetNameClicked ), nullptr,
this );
m_placementProperties->m_ComponentsCb->Disconnect(
wxEVT_CHECKBOX,
wxCommandEventHandler( DIALOG_RULE_AREA_PROPERTIES::OnComponentClassClicked ), nullptr,
this );
}
@ -233,83 +231,80 @@ bool DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow()
m_keepoutProperties->m_cbCopperPourCtrl->SetValue( m_zonesettings.GetDoNotAllowCopperPour() );
// Init placement parameters:
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
m_placementProperties->m_SheetCb->SetValue( false );
m_placementProperties->m_sheetCombo->Clear();
m_placementProperties->m_ComponentsCb->SetValue( false );
m_placementProperties->m_componentClassCombo->Clear();
wxString curSourceName = m_zonesettings.GetRuleAreaPlacementSource();
// Load schematic sheet and component class lists
if( m_board )
{
m_placementProperties->m_SheetCb->SetValue( false );
m_placementProperties->m_sheetCombo->Clear();
// Fetch component classes
std::set<wxString> classNames;
m_placementProperties->m_ComponentsCb->SetValue( false );
m_placementProperties->m_componentClassCombo->Clear();
for( const auto& [k, v] : m_board->GetComponentClassManager().GetClasses() )
classNames.insert( k );
wxString curSourceName = m_zonesettings.GetRuleAreaPlacementSource();
for( const wxString& sourceName : classNames )
m_placementProperties->m_componentClassCombo->Append( sourceName );
// Load schematic sheet and component class lists
if( m_board )
{
// Fetch component classes
std::set<wxString> classNames;
// Fetch sheet names
std::set<wxString> sheetNames;
for( const auto& [k, v] : m_board->GetComponentClassManager().GetClasses() )
classNames.insert( k );
for( FOOTPRINT* fp : m_board->Footprints() )
sheetNames.insert( fp->GetSheetname() );
for( const wxString& sourceName : classNames )
m_placementProperties->m_componentClassCombo->Append( sourceName );
// Fetch sheet names
std::set<wxString> sheetNames;
for( FOOTPRINT* fp : m_board->Footprints() )
sheetNames.insert( fp->GetSheetname() );
for( const wxString& sourceName : sheetNames )
m_placementProperties->m_sheetCombo->Append( sourceName );
}
auto setupCurrentSourceSelection = [&]( wxComboBox* cb )
{
if( curSourceName == wxEmptyString )
return;
if( !cb->SetStringSelection( curSourceName ) )
{
m_notFoundPlacementSource = true;
m_notFoundPlacementSourceName = curSourceName;
wxString notFoundDisplayName = _( "Not found on board: " ) + curSourceName;
cb->Insert( notFoundDisplayName, 0 );
cb->Select( 0 );
}
};
if( m_zonesettings.GetRuleAreaPlacementSourceType()
== RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
{
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
m_placementProperties->m_SheetCb->SetValue( true );
setupCurrentSourceSelection( m_placementProperties->m_sheetCombo );
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
}
else
{
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
m_placementProperties->m_ComponentsCb->SetValue( true );
setupCurrentSourceSelection( m_placementProperties->m_componentClassCombo );
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
}
// Handle most-useful notebook page selection
m_areaPropertiesNb->SetSelection( 0 );
if( !m_zonesettings.HasKeepoutParametersSet()
&& m_zonesettings.GetRuleAreaPlacementEnabled() )
{
m_areaPropertiesNb->SetSelection( 1 );
}
for( const wxString& sourceName : sheetNames )
m_placementProperties->m_sheetCombo->Append( sourceName );
}
auto setupCurrentSourceSelection = [&]( wxComboBox* cb )
{
if( curSourceName == wxEmptyString )
return;
if( !cb->SetStringSelection( curSourceName ) )
{
m_notFoundPlacementSource = true;
m_notFoundPlacementSourceName = curSourceName;
wxString notFoundDisplayName = _( "Not found on board: " ) + curSourceName;
cb->Insert( notFoundDisplayName, 0 );
cb->Select( 0 );
}
};
if( m_zonesettings.GetRuleAreaPlacementSourceType()
== RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
{
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
m_placementProperties->m_SheetCb->SetValue( true );
setupCurrentSourceSelection( m_placementProperties->m_sheetCombo );
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME;
}
else
{
if( m_zonesettings.GetRuleAreaPlacementEnabled() )
m_placementProperties->m_ComponentsCb->SetValue( true );
setupCurrentSourceSelection( m_placementProperties->m_componentClassCombo );
m_originalPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
m_lastPlacementSourceType = RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS;
}
// Handle most-useful notebook page selection
m_areaPropertiesNb->SetSelection( 0 );
if( !m_zonesettings.HasKeepoutParametersSet() && m_zonesettings.GetRuleAreaPlacementEnabled() )
{
m_areaPropertiesNb->SetSelection( 1 );
}
m_cbLocked->SetValue( m_zonesettings.m_Locked );
m_tcName->SetValue( m_zonesettings.m_Name );
@ -383,52 +378,49 @@ bool DIALOG_RULE_AREA_PROPERTIES::TransferDataFromWindow()
m_zonesettings.SetDoNotAllowFootprints( m_keepoutProperties->m_cbFootprintsCtrl->GetValue() );
// Set placement parameters
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
m_zonesettings.SetRuleAreaPlacementEnabled( false );
m_zonesettings.SetRuleAreaPlacementSource( wxEmptyString );
auto setPlacementSource = [this]( RULE_AREA_PLACEMENT_SOURCE_TYPE sourceType )
{
m_zonesettings.SetRuleAreaPlacementEnabled( false );
m_zonesettings.SetRuleAreaPlacementSource( wxEmptyString );
m_zonesettings.SetRuleAreaPlacementSourceType( sourceType );
auto setPlacementSource = [this]( RULE_AREA_PLACEMENT_SOURCE_TYPE sourceType )
{
m_zonesettings.SetRuleAreaPlacementSourceType( sourceType );
wxComboBox* cb;
wxComboBox* cb;
if( sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
cb = m_placementProperties->m_sheetCombo;
else
cb = m_placementProperties->m_componentClassCombo;
int selectedSourceIdx = cb->GetSelection();
if( selectedSourceIdx != wxNOT_FOUND )
{
if( selectedSourceIdx == 0 && m_notFoundPlacementSource
&& m_originalPlacementSourceType == sourceType )
{
m_zonesettings.SetRuleAreaPlacementSource( m_notFoundPlacementSourceName );
}
else
{
m_zonesettings.SetRuleAreaPlacementSource( cb->GetString( selectedSourceIdx ) );
}
}
};
if( m_placementProperties->m_SheetCb->GetValue() )
{
m_zonesettings.SetRuleAreaPlacementEnabled( true );
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
}
else if( m_placementProperties->m_ComponentsCb->GetValue() )
{
m_zonesettings.SetRuleAreaPlacementEnabled( true );
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS );
}
if( sourceType == RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME )
cb = m_placementProperties->m_sheetCombo;
else
cb = m_placementProperties->m_componentClassCombo;
int selectedSourceIdx = cb->GetSelection();
if( selectedSourceIdx != wxNOT_FOUND )
{
setPlacementSource( m_lastPlacementSourceType );
if( selectedSourceIdx == 0 && m_notFoundPlacementSource
&& m_originalPlacementSourceType == sourceType )
{
m_zonesettings.SetRuleAreaPlacementSource( m_notFoundPlacementSourceName );
}
else
{
m_zonesettings.SetRuleAreaPlacementSource( cb->GetString( selectedSourceIdx ) );
}
}
};
if( m_placementProperties->m_SheetCb->GetValue() )
{
m_zonesettings.SetRuleAreaPlacementEnabled( true );
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME );
}
else if( m_placementProperties->m_ComponentsCb->GetValue() )
{
m_zonesettings.SetRuleAreaPlacementEnabled( true );
setPlacementSource( RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS );
}
else
{
setPlacementSource( m_lastPlacementSourceType );
}
if( m_zonesettings.m_Layers.count() == 0 )

View File

@ -440,16 +440,13 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
toolsMenu->Add( PCB_ACTIONS::showPythonConsole );
}
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
{
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 );
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" ) );

View File

@ -2728,30 +2728,27 @@ void PCB_IO_KICAD_SEXPR::format( const ZONE* aZone, int aNestLevel ) const
aZone->GetDoNotAllowFootprints() ? "not_allowed" : "allowed" );
// Multichannel settings
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
m_out->Print( aNestLevel + 1, "(placement" );
m_out->Print( aNestLevel + 2, "(enabled " );
if( aZone->GetRuleAreaPlacementEnabled() )
m_out->Print( aNestLevel + 2, "yes)" );
else
m_out->Print( aNestLevel + 2, "no)" );
switch( aZone->GetRuleAreaPlacementSourceType() )
{
m_out->Print( aNestLevel + 1, "(placement" );
m_out->Print( aNestLevel + 2, "(enabled " );
if( aZone->GetRuleAreaPlacementEnabled() )
m_out->Print( aNestLevel + 2, "yes)" );
else
m_out->Print( aNestLevel + 2, "no)" );
switch( aZone->GetRuleAreaPlacementSourceType() )
{
case RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME:
m_out->Print( aNestLevel + 2, "(sheetname %s)",
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
break;
case RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS:
m_out->Print( aNestLevel + 2, "(component_class %s)",
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
break;
}
m_out->Print( aNestLevel + 1, ")" );
case RULE_AREA_PLACEMENT_SOURCE_TYPE::SHEETNAME:
m_out->Print( aNestLevel + 2, "(sheetname %s)",
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
break;
case RULE_AREA_PLACEMENT_SOURCE_TYPE::COMPONENT_CLASS:
m_out->Print( aNestLevel + 2, "(component_class %s)",
m_out->Quotew( aZone->GetRuleAreaPlacementSource() ).c_str() );
break;
}
m_out->Print( aNestLevel + 1, ")" );
}
m_out->Print( aNestLevel + 1, "(fill" );

View File

@ -1755,29 +1755,27 @@ static struct ZONE_DESC
groupKeepout )
.SetAvailableFunc( isRuleArea );
if( ADVANCED_CFG::GetCfg().m_EnableMultichannelTool )
{
const wxString groupPlacement = _HKI( "Placement" );
propMgr.AddProperty( new PROPERTY<ZONE, bool>( _HKI( "Enable" ),
&ZONE::SetRuleAreaPlacementEnabled,
&ZONE::GetRuleAreaPlacementEnabled ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
const wxString groupPlacement = _HKI( "Placement" );
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, RULE_AREA_PLACEMENT_SOURCE_TYPE>(
_HKI( "Source Type" ),
&ZONE::SetRuleAreaPlacementSourceType,
&ZONE::GetRuleAreaPlacementSourceType ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
propMgr.AddProperty( new PROPERTY<ZONE, bool>( _HKI( "Enable" ),
&ZONE::SetRuleAreaPlacementEnabled,
&ZONE::GetRuleAreaPlacementEnabled ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
propMgr.AddProperty( new PROPERTY_ENUM<ZONE, RULE_AREA_PLACEMENT_SOURCE_TYPE>(
_HKI( "Source Type" ), &ZONE::SetRuleAreaPlacementSourceType,
&ZONE::GetRuleAreaPlacementSourceType ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Source Name" ),
&ZONE::SetRuleAreaPlacementSource,
&ZONE::GetRuleAreaPlacementSource ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
propMgr.AddProperty( new PROPERTY<ZONE, wxString>( _HKI( "Source Name" ),
&ZONE::SetRuleAreaPlacementSource,
&ZONE::GetRuleAreaPlacementSource ),
groupPlacement )
.SetAvailableFunc( isRuleArea );
}
const wxString groupFill = _HKI( "Fill Style" );