Make shape properties layer selection obey cancel command

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16735
This commit is contained in:
Ian McInerney 2024-02-13 20:07:12 +00:00 committed by Ian McInerney
parent f75c72ebb5
commit b86bf19328
1 changed files with 5 additions and 7 deletions

View File

@ -61,8 +61,10 @@ private:
// Show/hide the widgets used in net selection (shown only for copper layers) // Show/hide the widgets used in net selection (shown only for copper layers)
void showHideNetInfo() void showHideNetInfo()
{ {
m_netSelector->Show( m_item->IsOnCopperLayer() ); bool isCopper = IsCopperLayer( m_LayerSelectionCtrl->GetLayerSelection() );
m_netLabel->Show( m_item->IsOnCopperLayer() );
m_netSelector->Show( isCopper );
m_netLabel->Show( isCopper );
} }
@ -199,15 +201,11 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent,
m_endY.Show( false ); m_endY.Show( false );
} }
showHideNetInfo();
SetInitialFocus( m_startXCtrl ); SetInitialFocus( m_startXCtrl );
SetupStandardButtons(); SetupStandardButtons();
// Now all widgets have the size fixed, call FinishDialogSettings // Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings(); finishDialogSettings();
Layout();
} }
@ -232,7 +230,6 @@ void DIALOG_SHAPE_PROPERTIES::onLayerSelection( wxCommandEvent& event )
{ {
if( m_LayerSelectionCtrl->GetLayerSelection() >= 0 ) if( m_LayerSelectionCtrl->GetLayerSelection() >= 0 )
{ {
m_item->SetLayer( ToLAYER_ID( m_LayerSelectionCtrl->GetLayerSelection() ) );
showHideNetInfo(); showHideNetInfo();
} }
} }
@ -335,6 +332,7 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
wxFAIL_MSG( "Line type not found in the type lookup map" ); wxFAIL_MSG( "Line type not found in the type lookup map" );
m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() ); m_LayerSelectionCtrl->SetLayerSelection( m_item->GetLayer() );
showHideNetInfo();
return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow(); return DIALOG_SHAPE_PROPERTIES_BASE::TransferDataToWindow();
} }