Don't allow editing design rules without a project
Also fix a crash initializing DRC engine on an empty board Fixes https://gitlab.com/kicad/code/kicad/-/issues/5835
This commit is contained in:
parent
8fad4bb34c
commit
4dda3a1715
|
@ -251,6 +251,9 @@ bool PANEL_SETUP_LAYERS::TransferDataToWindow()
|
|||
{
|
||||
m_enabledLayers = m_pcb->GetEnabledLayers();
|
||||
|
||||
// Rescue may be enabled, but should not be shown in this dialog
|
||||
m_enabledLayers.reset( Rescue );
|
||||
|
||||
showCopperChoice( m_pcb->GetCopperLayerCount() );
|
||||
setCopperLayerCheckBoxes( m_pcb->GetCopperLayerCount() );
|
||||
|
||||
|
|
|
@ -349,6 +349,13 @@ bool PANEL_SETUP_RULES::TransferDataToWindow()
|
|||
|
||||
m_originalText = m_textEditor->GetText();
|
||||
|
||||
if( m_frame->Prj().IsNullProject() )
|
||||
{
|
||||
m_textEditor->ClearAll();
|
||||
m_textEditor->AddText( _( "Design rules cannot be added without a project" ) );
|
||||
m_textEditor->Disable();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -358,6 +365,9 @@ bool PANEL_SETUP_RULES::TransferDataFromWindow()
|
|||
if( m_originalText == m_textEditor->GetText() )
|
||||
return true;
|
||||
|
||||
if( m_frame->Prj().IsNullProject() )
|
||||
return true;
|
||||
|
||||
try
|
||||
{
|
||||
std::vector<DRC_RULE*> dummyRules;
|
||||
|
|
|
@ -143,6 +143,12 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
|
||||
GetCanvas()->GetGAL()->SetGridOrigin( VECTOR2D( aBoard->GetDesignSettings().m_GridOrigin ) );
|
||||
|
||||
if( new_board )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
|
||||
}
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
{
|
||||
|
@ -153,12 +159,7 @@ void PCB_BASE_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
GetCanvas()->GetViewControls(), config(), this );
|
||||
|
||||
if( new_board )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
bds.m_DRCEngine = std::make_shared<DRC_ENGINE>( aBoard, &bds );
|
||||
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue