Pcbnew: Fix an issue when try to importing gpcb footprints
This commit is contained in:
parent
31ed2c288c
commit
0dff6b9bd3
|
@ -56,6 +56,9 @@
|
||||||
|
|
||||||
// use one of the following __LOC__ defs, depending on whether your
|
// use one of the following __LOC__ defs, depending on whether your
|
||||||
// compiler supports __func__ or not, and how it handles __LINE__
|
// compiler supports __func__ or not, and how it handles __LINE__
|
||||||
|
#if defined ( _MSC_VER )
|
||||||
|
#define __func__ __FUNCTION__
|
||||||
|
#endif
|
||||||
#define __LOC__ ((std::string(__func__) + "() : line ") + TOSTRING(__LINE__)).c_str()
|
#define __LOC__ ((std::string(__func__) + "() : line ") + TOSTRING(__LINE__)).c_str()
|
||||||
//#define __LOC__ TOSTRING(__LINE__)
|
//#define __LOC__ TOSTRING(__LINE__)
|
||||||
|
|
||||||
|
|
|
@ -361,9 +361,13 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
// Currently unused
|
// Currently unused
|
||||||
|
|
||||||
// Read pad number:
|
// Read pad number:
|
||||||
if( params.GetCount() > 10 )
|
if( params[1] == wxT( "(" ) )
|
||||||
{
|
{
|
||||||
strncpy( Pad->m_Padname, TO_UTF8( params[10] ), 4 );
|
Pad->SetPadName( params[8] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pad->SetPadName( params[10] );
|
||||||
}
|
}
|
||||||
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
|
Pad->m_Pos.x = (ibuf[0] + ibuf[2]) / 2;
|
||||||
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
|
Pad->m_Pos.y = (ibuf[1] + ibuf[3]) / 2;
|
||||||
|
@ -415,9 +419,13 @@ bool MODULE::Read_GPCB_Descr( const wxString& CmpFullFileName )
|
||||||
// Currently unused
|
// Currently unused
|
||||||
|
|
||||||
// Read pad number:
|
// Read pad number:
|
||||||
if( params.GetCount() > 9 )
|
if( params[1] == wxT( "(" ) )
|
||||||
{
|
{
|
||||||
strncpy( Pad->m_Padname, TO_UTF8( params[9] ), 4 );
|
Pad->SetPadName( params[7] );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pad->SetPadName( params[9] );
|
||||||
}
|
}
|
||||||
|
|
||||||
Pad->m_Pos.x = ibuf[0];
|
Pad->m_Pos.x = ibuf[0];
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
const wxString ModExportFileExtension( wxT( "emp" ) );
|
const wxString ModExportFileExtension( wxT( "emp" ) );
|
||||||
|
|
||||||
static const wxString ModExportFileWildcard( _( "KiCad foot print export files (*.emp)|*.emp" ) );
|
static const wxString ModExportFileWildcard( _( "KiCad foot print export files (*.emp)|*.emp" ) );
|
||||||
|
static const wxString ModImportFileWildcard( _( "GPcb foot print files (*)|*" ) );
|
||||||
|
|
||||||
|
|
||||||
MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
|
MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
|
||||||
|
@ -55,9 +56,10 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
|
||||||
if( Config )
|
if( Config )
|
||||||
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading );
|
Config->Read( EXPORT_IMPORT_LASTPATH_KEY, &LastOpenedPathForLoading );
|
||||||
|
|
||||||
|
wxString importWildCard = ModExportFileWildcard + wxT("|") + ModImportFileWildcard;
|
||||||
wxFileDialog dlg( this, _( "Import Footprint Module" ),
|
wxFileDialog dlg( this, _( "Import Footprint Module" ),
|
||||||
LastOpenedPathForLoading, wxEmptyString,
|
LastOpenedPathForLoading, wxEmptyString,
|
||||||
ModExportFileWildcard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
importWildCard, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue