Fix assert in CvPcb when opening footprint equate file dialog.

Fixes lp:1774726

https://bugs.launchpad.net/kicad/+bug/1774726
This commit is contained in:
Wayne Stambaugh 2018-06-04 10:06:33 -04:00
parent e4a6f2e523
commit 6f65f835f4
1 changed files with 13 additions and 12 deletions

View File

@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -49,7 +49,8 @@ DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
m_Config = Pgm().CommonSettings();
PROJECT& prj = Prj();
SetTitle( wxString::Format( _( "Project file: \"%s\"" ), GetChars( prj.GetProjectFullName() ) ) );
SetTitle( wxString::Format( _( "Project file: \"%s\"" ),
GetChars( prj.GetProjectFullName() ) ) );
Init( );
@ -57,6 +58,7 @@ DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES( CVPCB_MAINFRAME* aParent ) :
Center();
}
void CVPCB_MAINFRAME::OnEditEquFilesList( wxCommandEvent& aEvent )
{
DIALOG_CONFIG_EQUFILES dlg( this );
@ -69,6 +71,8 @@ void DIALOG_CONFIG_EQUFILES::Init()
{
m_sdbSizerOK->SetDefault();
m_ListChanged = false;
if( !m_Parent->m_EquFilesNames.IsEmpty() )
m_ListEquiv->InsertItems( m_Parent->m_EquFilesNames, 0 );
if( getEnvVarCount() < 2 )
@ -90,6 +94,7 @@ void DIALOG_CONFIG_EQUFILES::Init()
}
void DIALOG_CONFIG_EQUFILES::OnEditEquFile( wxCommandEvent& event )
{
wxString editorname = Pgm().GetEditorName();
@ -141,9 +146,7 @@ void DIALOG_CONFIG_EQUFILES::OnCloseWindow( wxCloseEvent& event )
}
/********************************************************************/
void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
/********************************************************************/
{
wxArrayInt selections;
@ -176,9 +179,7 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveUp( wxCommandEvent& event )
}
/*********************************************************************/
void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
/*********************************************************************/
{
wxArrayInt selections;
m_ListEquiv->GetSelections( selections );
@ -195,7 +196,7 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
int jj = selections[ii];
std::swap( libnames[jj], libnames[jj+1]);
std::swap( libnames[jj], libnames[jj+1] );
}
m_ListEquiv->Set( libnames );
@ -204,7 +205,7 @@ void DIALOG_CONFIG_EQUFILES::OnButtonMoveDown( wxCommandEvent& event )
for( size_t ii = 0; ii < selections.GetCount(); ii++ )
{
int jj = selections[ii];
m_ListEquiv->SetSelection(jj+1);
m_ListEquiv->SetSelection( jj+1 );
}
m_ListChanged = true;
@ -223,7 +224,7 @@ void DIALOG_CONFIG_EQUFILES::OnRemoveFiles( wxCommandEvent& event )
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
{
m_ListEquiv->Delete(selections[ii] );
m_ListEquiv->Delete( selections[ii] );
m_ListChanged = true;
}
}
@ -268,7 +269,7 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
if( fn.MakeRelativeTo( libpath ) )
{
equFilename.Printf( wxT("${%s}%c%s"),
equFilename.Printf( wxT( "${%s}%c%s" ),
GetChars( m_gridEnvVars->GetCellValue( wxGridCellCoords( row, 0 ) ) ),
fn.GetPathSeparator(),
GetChars( fn.GetFullPath() ) );
@ -284,7 +285,7 @@ void DIALOG_CONFIG_EQUFILES::OnAddFiles( wxCommandEvent& event )
if( list->FindString( equFilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
{
m_ListChanged = true;
equFilename.Replace( wxT("\\"), wxT("/") ); // Use unix separators only.
equFilename.Replace( wxT( "\\" ), wxT( "/" ) ); // Use unix separators only.
list->Append( equFilename );
}
else