Commit 2fd7f4ca authored by jean-pierre charras's avatar jean-pierre charras

StrPurge( char* text ): Fix incorrect behavior when string text is void.

Very minor enhancement in module edition dialogs.
Fix a minor bug in design rules editor: in Global Rules Edition: drill values > via diameter not checked
and the first item (track or via) in list was not checked (explains Bug 702177, that is not really a bug)
parent c4722e0f
......@@ -37,8 +37,8 @@ int ReadDelimitedText( char* dest, char* source, int NbMaxChar )
}
/* Remove training spaces in text
* return a pointer on the first non space char in text
/* Remove leading and training spaces, tabs and end of line chars in text
* return a pointer on the first n char in text
*/
char* StrPurge( char* text )
{
......@@ -46,7 +46,7 @@ char* StrPurge( char* text )
if( text )
{
while( strchr( whitespace, *text ) )
while( *text && strchr( whitespace, *text ) )
++text;
char* cp = text + strlen( text ) - 1;
......
......@@ -1069,7 +1069,8 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
}
// Test list of values for specific vias and tracks
for( int row = 1; row < m_gridTrackWidthList->GetNumberRows(); ++row )
// Test tracks
for( int row = 0; row < m_gridTrackWidthList->GetNumberRows(); ++row )
{
wxString tvalue = m_gridTrackWidthList->GetCellValue( row, 0 );
if( tvalue.IsEmpty() )
......@@ -1096,14 +1097,19 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
}
}
for( int row = 1; row < m_gridViaSizeList->GetNumberRows(); ++row )
// Test vias
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
{
wxString tvalue = m_gridViaSizeList->GetCellValue( row, 0 );
if( tvalue.IsEmpty() )
continue;
int viadia = ReturnValueFromString( g_UserUnit,
tvalue,
int viadia = ReturnValueFromString( g_UserUnit, tvalue,
m_Parent->m_InternalUnits );
int viadrill = 0;
wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
if( !drlvalue.IsEmpty() )
viadrill = ReturnValueFromString( g_UserUnit, drlvalue,
m_Parent->m_InternalUnits );
if( viadia < minViaDia )
{
......@@ -1113,7 +1119,18 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
m_MessagesList->AppendToPage( msg );
}
if( viadia > 10000 )
if( viadia < viadrill )
{
result = false;
msg.Printf( _( "<b>Extra Via %d Size</b> %s &lt; <b> Drill Size</b> %s<br>" ),
row + 1, GetChars( tvalue ), GetChars( drlvalue ) );
m_MessagesList->AppendToPage( msg );
}
// Test for a reasonnable via size:
if( viadia > 10000 ) // 1 inch!
{
result = false;
msg.Printf( _( "<b>Extra Via %d Size</b>%s &gt; <b>1 inch!</b><br>" ),
......
......@@ -275,6 +275,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
m_3D_Rotation = new WinEDA_VertexCtrl( m_Panel3D, _( "Shape Rotation:" ),
BoxSizer, UNSCALED_UNITS, 1 );
m_Sizer3DValues->Add( BoxSizer, 0, wxGROW | wxALL, 5 );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
if( m_3D_ShapeNameListBox->GetCount() > 0 )
{
m_LastSelected3DShapeIndex = 0;
m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] );
}
}
......
......@@ -156,6 +156,14 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
else
msg.Printf( wxT( "%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
if( m_3D_ShapeNameListBox->GetCount() > 0 )
{
m_LastSelected3DShapeIndex = 0;
m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
Transfert3DValuesToDisplay( m_Shapes3D_list[m_LastSelected3DShapeIndex] );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment