mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Fixed initialization for custom track/via size values (PNS). More meaningful error messages.
This commit is contained in:
parent
dc33bb1868
commit
d433a06d11
@ -70,6 +70,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
||||
|
||||
m_useCustomTrackVia = false;
|
||||
m_customTrackWidth = Millimeter2iu( DEFAULT_CUSTOMTRACKWIDTH );
|
||||
m_customViaSize.m_Diameter = Millimeter2iu( DEFAULT_VIASMINSIZE );
|
||||
m_customViaSize.m_Drill = Millimeter2iu( DEFAULT_VIASMINDRILL );
|
||||
|
||||
m_TrackMinWidth = Millimeter2iu( DEFAULT_TRACKMINWIDTH ); // track min width
|
||||
m_ViasMinSize = Millimeter2iu( DEFAULT_VIASMINSIZE ); // via (not uvia) min diam
|
||||
m_ViasMinDrill = Millimeter2iu( DEFAULT_VIASMINDRILL ); // via (not uvia) min drill diam
|
||||
@ -204,14 +207,22 @@ bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
|
||||
* are always the Netclass values
|
||||
*/
|
||||
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
||||
}
|
||||
|
||||
if( m_ViasDimensionsList[0].m_Drill != netClass->GetViaDrill() )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
m_ViasDimensionsList[0].m_Drill = netClass->GetViaDrill();
|
||||
}
|
||||
|
||||
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
||||
}
|
||||
|
||||
if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
|
||||
SetViaSizeIndex( m_ViasDimensionsList.size() );
|
||||
|
@ -151,6 +151,7 @@ NETCLASSPTR NETCLASSES::Find( const wxString& aName ) const
|
||||
void BOARD::SynchronizeNetsAndNetClasses()
|
||||
{
|
||||
NETCLASSES& netClasses = m_designSettings.m_NetClasses;
|
||||
NETCLASSPTR defaultNetClass = netClasses.GetDefault();
|
||||
|
||||
// set all NETs to the default NETCLASS, then later override some
|
||||
// as we go through the NETCLASSes.
|
||||
@ -158,7 +159,7 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
||||
for( NETINFO_LIST::iterator net( m_NetInfo.begin() ), netEnd( m_NetInfo.end() );
|
||||
net != netEnd; ++net )
|
||||
{
|
||||
net->SetClass( netClasses.GetDefault() );
|
||||
net->SetClass( defaultNetClass );
|
||||
}
|
||||
|
||||
// Add netclass name and pointer to nets. If a net is in more than one netclass,
|
||||
@ -196,7 +197,7 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
||||
netclass->Clear();
|
||||
}
|
||||
|
||||
netClasses.GetDefault()->Clear();
|
||||
defaultNetClass->Clear();
|
||||
|
||||
for( NETINFO_LIST::iterator net( m_NetInfo.begin() ), netEnd( m_NetInfo.end() );
|
||||
net != netEnd; ++net )
|
||||
@ -211,6 +212,12 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
||||
|
||||
netclass->Add( net->GetNetname() );
|
||||
}
|
||||
|
||||
// Set initial values for custom track width & via size to match the default netclass settings
|
||||
m_designSettings.UseCustomTrackViaSize( false );
|
||||
m_designSettings.SetCustomTrackWidth( defaultNetClass->GetTrackWidth() );
|
||||
m_designSettings.SetCustomViaSize( defaultNetClass->GetViaDiameter() );
|
||||
m_designSettings.SetCustomViaDrill( defaultNetClass->GetViaDrill() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,13 +59,33 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
|
||||
|
||||
bool DIALOG_TRACK_VIA_SIZE::check()
|
||||
{
|
||||
// Wrong input
|
||||
if( m_trackWidth.GetValue() < 0 || m_viaDiameter.GetValue() < 0 || m_viaDrill.GetValue() < 0 )
|
||||
if( m_trackWidth.GetValue() < 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid track width" ) );
|
||||
m_trackWidthText->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Via drill should be smaller than via diameter
|
||||
if( m_viaDrill.GetValue() >= m_viaDiameter.GetValue() )
|
||||
if( m_viaDiameter.GetValue() < 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid via diameter" ) );
|
||||
m_viaDiameterText->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_viaDrill.GetValue() < 0 )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Invalid via drill size" ) );
|
||||
m_viaDrillText->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if( m_viaDrill.GetValue() >= m_viaDiameter.GetValue() )
|
||||
{
|
||||
DisplayError( GetParent(), _( "Via drill size has to be smaller than via diameter" ) );
|
||||
m_viaDrillText->SetFocus();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -87,11 +107,6 @@ void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
|
||||
m_settings.SetCustomViaDrill( m_viaDrill.GetValue() );
|
||||
EndModal( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( GetParent(), _( "Settings are incorrect" ) );
|
||||
m_trackWidthText->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user