DIALOG_CREATE_ARRAY: enhancement to commit f775637d: ensure last selection

(Set center by radius / Set center by position) has the right widgets enabled
when reopen the dialog.
This commit is contained in:
jean-pierre charras 2023-09-19 16:22:38 +02:00
parent f775637da8
commit e24c6d04ff
4 changed files with 27 additions and 21 deletions

View File

@ -1,7 +1,7 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -245,6 +245,7 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
// Run the callbacks once to process the dialog contents // Run the callbacks once to process the dialog contents
setControlEnablement(); setControlEnablement();
setCircularArrayEnablement();
calculateCircularArrayProperties(); calculateCircularArrayProperties();
SetupStandardButtons(); SetupStandardButtons();
@ -252,18 +253,20 @@ DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY( PCB_BASE_FRAME* aParent,
SetMinSize( GetSize() ); SetMinSize( GetSize() );
} }
void DIALOG_CREATE_ARRAY::OnButtonPosition( wxCommandEvent& event ) void DIALOG_CREATE_ARRAY::OnButtonPosition( wxCommandEvent& event )
{ {
if( m_radioBtnSetByPos->GetValue() ) setCircularArrayEnablement();
{
m_entryCentreX->Enable();
m_entryCentreY->Enable();
m_tcValueCircRadius->Disable();
m_tcValueCircCenterAngle->Disable();
}
} }
void DIALOG_CREATE_ARRAY::OnButtonRadius( wxCommandEvent& event ) void DIALOG_CREATE_ARRAY::OnButtonRadius( wxCommandEvent& event )
{
setCircularArrayEnablement();
}
void DIALOG_CREATE_ARRAY::setCircularArrayEnablement()
{ {
if( m_radioBtnSetByRadius->GetValue() ) if( m_radioBtnSetByRadius->GetValue() )
{ {
@ -272,17 +275,22 @@ void DIALOG_CREATE_ARRAY::OnButtonRadius( wxCommandEvent& event )
m_tcValueCircRadius->Enable(); m_tcValueCircRadius->Enable();
m_tcValueCircCenterAngle->Enable(); m_tcValueCircCenterAngle->Enable();
} }
} else
void DIALOG_CREATE_ARRAY::OnParameterChanged( wxCommandEvent& event )
{
if( m_radioBtnSetByPos->GetValue() )
{ {
m_entryCentreX->Enable(); m_entryCentreX->Enable();
m_entryCentreY->Enable(); m_entryCentreY->Enable();
m_tcValueCircRadius->Disable(); m_tcValueCircRadius->Disable();
m_tcValueCircCenterAngle->Disable(); m_tcValueCircCenterAngle->Disable();
}
}
void DIALOG_CREATE_ARRAY::OnParameterChanged( wxCommandEvent& event )
{
setCircularArrayEnablement();
if( m_radioBtnSetByPos->GetValue() )
{
setControlEnablement(); setControlEnablement();
calculateCircularArrayProperties(); calculateCircularArrayProperties();
} }
@ -290,13 +298,10 @@ void DIALOG_CREATE_ARRAY::OnParameterChanged( wxCommandEvent& event )
void DIALOG_CREATE_ARRAY::OnRadiusChanged( wxCommandEvent& event ) void DIALOG_CREATE_ARRAY::OnRadiusChanged( wxCommandEvent& event )
{ {
setCircularArrayEnablement();
if( m_radioBtnSetByRadius->GetValue() ) if( m_radioBtnSetByRadius->GetValue() )
{ {
m_entryCentreX->Disable();
m_entryCentreY->Disable();
m_tcValueCircRadius->Enable();
m_tcValueCircCenterAngle->Enable();
setControlEnablement(); setControlEnablement();
calculateCircularArrayProperties(); calculateCircularArrayProperties();
} }

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 John Beard, john.j.beard@gmail.com * Copyright (C) 2015 John Beard, john.j.beard@gmail.com
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -61,6 +61,7 @@ private:
// Internal callback handlers // Internal callback handlers
void setControlEnablement(); void setControlEnablement();
void setCircularArrayEnablement();
void calculateCircularArrayProperties(); void calculateCircularArrayProperties();
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!