TransLine default parameters (Er, TanD, Rho) are now equal to the previously selected values when opening the selection window

Fixes: lp:1828857
* https://bugs.launchpad.net/kicad/+bug/1828857
This commit is contained in:
Fabien Corona 2019-11-02 09:27:50 +01:00 committed by jean-pierre charras
parent cbb88ce609
commit bb938b2af4
1 changed files with 28 additions and 15 deletions

View File

@ -42,12 +42,16 @@ extern double DoubleFromString( const wxString& TextValue );
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
{ {
wxArrayString list = StandardRelativeDielectricConstantList(); static int prevChoice = 0;
wxString value = wxGetSingleChoice( wxEmptyString, wxArrayString list = StandardRelativeDielectricConstantList();
_("Relative Dielectric Constants"), list).BeforeFirst( ' ' ); int index = wxGetSingleChoiceIndex( wxEmptyString, _("Relative Dielectric Constants"), list,
if( ! value.IsEmpty() ) prevChoice, NULL);
m_Value_EpsilonR->SetValue( value ); if( index != -1 )
{
prevChoice = index;
m_Value_EpsilonR->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
}
} }
/** /**
@ -57,12 +61,16 @@ void PCB_CALCULATOR_FRAME::OnTranslineEpsilonR_Button( wxCommandEvent& event )
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
{ {
wxArrayString list = StandardLossTangentList(); static int prevChoice = 0;
wxString value = wxGetSingleChoice( wxEmptyString, wxArrayString list = StandardLossTangentList();
_("Dielectric Loss Factor"), list).BeforeFirst( ' ' ); int index = wxGetSingleChoiceIndex( wxEmptyString, _("Dielectric Loss Factor"), list,
if( ! value.IsEmpty() ) prevChoice, NULL);
m_Value_TanD->SetValue( value ); if( index != -1 )
{
prevChoice = index;
m_Value_TanD->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
}
} }
/** /**
@ -72,12 +80,16 @@ void PCB_CALCULATOR_FRAME::OnTranslineTanD_Button( wxCommandEvent& event )
*/ */
void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event ) void PCB_CALCULATOR_FRAME::OnTranslineRho_Button( wxCommandEvent& event )
{ {
wxArrayString list = StandardResistivityList(); static int prevChoice = 0;
wxString value = wxGetSingleChoice( wxEmptyString, wxArrayString list = StandardResistivityList();
_("Specific Resistance"), list).BeforeFirst( ' ' ); int index = wxGetSingleChoiceIndex( wxEmptyString, _("Specific Resistance"), list,
if( ! value.IsEmpty() ) prevChoice, NULL);
m_Value_Rho->SetValue( value ); if( index != -1 )
{
prevChoice = index;
m_Value_Rho->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
}
} }
// Minor helper struct to handle dialog items for a given parameter // Minor helper struct to handle dialog items for a given parameter
@ -343,3 +355,4 @@ void PCB_CALCULATOR_FRAME::OnTranslineSelection( wxCommandEvent& event )
m_panelTransline->Refresh(); m_panelTransline->Refresh();
} }