improvements, hopefully
This commit is contained in:
parent
fac288cffa
commit
b3a6ddb6e9
|
@ -141,6 +141,9 @@ const wxPoint D_PAD::ReturnShapePos()
|
||||||
|
|
||||||
const wxString D_PAD::GetPadName() const
|
const wxString D_PAD::GetPadName() const
|
||||||
{
|
{
|
||||||
|
#if 0 // m_Padname is not ASCII and not UTF8, it is LATIN1 basically, whatever
|
||||||
|
// 8 bit font is supported in KiCad plotting and drawing.
|
||||||
|
|
||||||
// Return pad name as wxString, assume it starts as a non-terminated
|
// Return pad name as wxString, assume it starts as a non-terminated
|
||||||
// utf8 character sequence
|
// utf8 character sequence
|
||||||
|
|
||||||
|
@ -151,11 +154,21 @@ const wxString D_PAD::GetPadName() const
|
||||||
temp[sizeof(m_Padname)] = 0;
|
temp[sizeof(m_Padname)] = 0;
|
||||||
|
|
||||||
return FROM_UTF8( temp );
|
return FROM_UTF8( temp );
|
||||||
|
#else
|
||||||
|
|
||||||
|
wxString name;
|
||||||
|
|
||||||
|
ReturnStringPadName( name );
|
||||||
|
return name;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void D_PAD::ReturnStringPadName( wxString& text ) const
|
void D_PAD::ReturnStringPadName( wxString& text ) const
|
||||||
{
|
{
|
||||||
|
#if 0 // m_Padname is not ASCII and not UTF8, it is LATIN1 basically, whatever
|
||||||
|
// 8 bit font is supported in KiCad plotting and drawing.
|
||||||
|
|
||||||
// Return pad name as wxString, assume it starts as a non-terminated
|
// Return pad name as wxString, assume it starts as a non-terminated
|
||||||
// utf8 character sequence
|
// utf8 character sequence
|
||||||
|
|
||||||
|
@ -166,6 +179,20 @@ void D_PAD::ReturnStringPadName( wxString& text ) const
|
||||||
temp[sizeof(m_Padname)] = 0;
|
temp[sizeof(m_Padname)] = 0;
|
||||||
|
|
||||||
text = FROM_UTF8( temp );
|
text = FROM_UTF8( temp );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
text.Empty();
|
||||||
|
|
||||||
|
for( int ii = 0; ii < PADNAMEZ; ii++ )
|
||||||
|
{
|
||||||
|
if( !m_Padname[ii] )
|
||||||
|
break;
|
||||||
|
|
||||||
|
// add an unsigned 8 bit byte, which is LATIN1 or CRYLIC
|
||||||
|
text.Append( (unsigned char) m_Padname[ii] );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,25 +203,17 @@ void D_PAD::SetPadName( const wxString& name )
|
||||||
|
|
||||||
len = name.Length();
|
len = name.Length();
|
||||||
|
|
||||||
if( len > 4 )
|
if( len > PADNAMEZ )
|
||||||
len = 4;
|
len = PADNAMEZ;
|
||||||
|
|
||||||
|
// m_Padname[] is not UTF8, it is an 8 bit character that matches the KiCad font,
|
||||||
|
// so only copy the lower 8 bits of each character.
|
||||||
|
|
||||||
for( ii = 0; ii < len; ii++ )
|
for( ii = 0; ii < len; ii++ )
|
||||||
m_Padname[ii] = name.GetChar( ii );
|
m_Padname[ii] = (char) name.GetChar( ii );
|
||||||
|
|
||||||
for( ii = len; ii < 4; ii++ )
|
for( ii = len; ii < PADNAMEZ; ii++ )
|
||||||
m_Padname[ii] = 0;
|
m_Padname[ii] = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
void D_PAD::SetPadName( const char* aName )
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
for( i=0; i<sizeof(m_Padname) && *aName; ++i )
|
|
||||||
m_Padname[i] = *aName++;
|
|
||||||
|
|
||||||
while( i < sizeof(m_Padname) )
|
|
||||||
m_Padname[i++] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,18 +71,21 @@ private:
|
||||||
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by Eeschema
|
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by Eeschema
|
||||||
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
|
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
|
||||||
|
|
||||||
|
/// Pad name (4 char) or a long identifier (used in pad name
|
||||||
|
/// comparisons because this is faster than string comparison)
|
||||||
|
union
|
||||||
|
{
|
||||||
|
#define PADNAMEZ 4
|
||||||
|
char m_Padname[PADNAMEZ]; // zero padded at end to full size
|
||||||
|
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
|
||||||
|
};
|
||||||
|
|
||||||
|
int m_SubRatsnest; // variable used in rats nest computations
|
||||||
|
// handle subnet (block) number in ratsnest connection
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxPoint m_Pos; // pad Position on board
|
wxPoint m_Pos; // pad Position on board
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
unsigned long m_NumPadName;
|
|
||||||
char m_Padname[4]; /* Pad name (4 char) or a long identifier (used in pad name
|
|
||||||
* comparisons because this is faster than string comparison)
|
|
||||||
*/
|
|
||||||
};
|
|
||||||
|
|
||||||
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
|
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
|
||||||
// 2..14 = internal layers
|
// 2..14 = internal layers
|
||||||
// 16 .. 31 = technical layers
|
// 16 .. 31 = technical layers
|
||||||
|
@ -134,10 +137,6 @@ public:
|
||||||
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
|
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
|
||||||
// The final margin is the sum of these 2 values
|
// The final margin is the sum of these 2 values
|
||||||
|
|
||||||
private:
|
|
||||||
int m_SubRatsnest; // variable used in rats nest computations
|
|
||||||
// handle subnet (block) number in ratsnest connection
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
D_PAD( MODULE* parent );
|
D_PAD( MODULE* parent );
|
||||||
D_PAD( D_PAD* pad );
|
D_PAD( D_PAD* pad );
|
||||||
|
@ -147,6 +146,14 @@ public:
|
||||||
|
|
||||||
D_PAD* Next() { return (D_PAD*) Pnext; }
|
D_PAD* Next() { return (D_PAD*) Pnext; }
|
||||||
|
|
||||||
|
void SetPadName( const wxString& name ); // Change pad name
|
||||||
|
const wxString GetPadName() const;
|
||||||
|
|
||||||
|
bool PadNameEqual( const D_PAD* other ) const
|
||||||
|
{
|
||||||
|
return m_NumPadName == other->m_NumPadName; // hide tricks behind sensible API
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetNetname
|
* Function SetNetname
|
||||||
* @param aNetname: the new netname
|
* @param aNetname: the new netname
|
||||||
|
@ -347,10 +354,6 @@ public:
|
||||||
*/
|
*/
|
||||||
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
|
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
|
||||||
|
|
||||||
void SetPadName( const wxString& name ); // Change pad name
|
|
||||||
void SetPadName( const char* aName );
|
|
||||||
const wxString GetPadName() const;
|
|
||||||
|
|
||||||
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
|
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
|
||||||
|
|
||||||
void ComputeShapeMaxRadius(); // compute radius
|
void ComputeShapeMaxRadius(); // compute radius
|
||||||
|
|
|
@ -664,7 +664,7 @@ bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_li
|
||||||
// one can argue that this 2nd test is not necessary, that any
|
// one can argue that this 2nd test is not necessary, that any
|
||||||
// two pads from a single module are acceptable. This 2nd test
|
// two pads from a single module are acceptable. This 2nd test
|
||||||
// should eventually be a configuration option.
|
// should eventually be a configuration option.
|
||||||
if( pad->m_NumPadName == aRefPad->m_NumPadName )
|
if( pad->PadNameEqual( aRefPad ) )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ void PCB_EDIT_FRAME::GenModuleReport( wxCommandEvent& event )
|
||||||
|
|
||||||
for( pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
for( pad = Module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
fprintf( rptfile, "$PAD \"%.4s\"\n", pad->m_Padname );
|
fprintf( rptfile, "$PAD \"%s\"\n", TO_UTF8( pad->GetPadName() ) );
|
||||||
sprintf( line, "position %9.6f %9.6f\n",
|
sprintf( line, "position %9.6f %9.6f\n",
|
||||||
pad->m_Pos0.x * conv_unit,
|
pad->m_Pos0.x * conv_unit,
|
||||||
pad->m_Pos0.y * conv_unit );
|
pad->m_Pos0.y * conv_unit );
|
||||||
|
|
|
@ -60,13 +60,7 @@
|
||||||
#include <auto_ptr.h>
|
#include <auto_ptr.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
#include <build_version.h>
|
//#include <build_version.h>
|
||||||
|
|
||||||
//#include <fctsys.h>
|
|
||||||
//#include <confirm.h>
|
|
||||||
//#include <wxPcbStruct.h">
|
|
||||||
//#include <pcbcommon.h>
|
|
||||||
|
|
||||||
#include <zones.h>
|
#include <zones.h>
|
||||||
|
|
||||||
#ifdef CVPCB
|
#ifdef CVPCB
|
||||||
|
@ -90,17 +84,15 @@
|
||||||
|
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
|
|
||||||
|
|
||||||
|
//#define KICAD_NANOMETRE
|
||||||
|
|
||||||
|
|
||||||
#define VERSION_ERROR_FORMAT _( "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." )
|
#define VERSION_ERROR_FORMAT _( "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." )
|
||||||
#define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d")
|
#define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d")
|
||||||
#define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d")
|
#define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d")
|
||||||
#define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" )
|
#define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" )
|
||||||
|
|
||||||
/*
|
|
||||||
#include <pcbnew.h>
|
|
||||||
#include <pcbnew_id.h>
|
|
||||||
#include <autorout.h>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// C string compare test for a specific length of characters.
|
/// C string compare test for a specific length of characters.
|
||||||
|
@ -330,6 +322,8 @@ void KICAD_PLUGIN::checkVersion()
|
||||||
m_error.Printf( VERSION_ERROR_FORMAT, ver );
|
m_error.Printf( VERSION_ERROR_FORMAT, ver );
|
||||||
THROW_IO_ERROR( m_error );
|
THROW_IO_ERROR( m_error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_loading_format_version = ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1039,11 +1033,15 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
||||||
// e.g. "Sh "A2" C 520 520 0 0 900"
|
// e.g. "Sh "A2" C 520 520 0 0 900"
|
||||||
// or "Sh "1" R 157 1378 0 0 900"
|
// or "Sh "1" R 157 1378 0 0 900"
|
||||||
|
|
||||||
char padname[sizeof(pad->m_Padname)+1];
|
// mypadname is LATIN1/CRYLIC for BOARD_FORMAT_VERSION 1,
|
||||||
|
// but for BOARD_FORMAT_VERSION 2, it is UTF8 from disk.
|
||||||
|
// So we have to go through two code paths. Moving forward
|
||||||
|
// padnames will be in UTF8 on disk, as are all KiCad strings on disk.
|
||||||
|
char mypadname[50];
|
||||||
|
|
||||||
data = line + SZ( "Sh" ) + 1; // +1 skips trailing whitespace
|
data = line + SZ( "Sh" ) + 1; // +1 skips trailing whitespace
|
||||||
|
|
||||||
data = data + ReadDelimitedText( padname, data, sizeof(padname) ) + 1; // +1 trailing whitespace
|
data = data + ReadDelimitedText( mypadname, data, sizeof(mypadname) ) + 1; // +1 trailing whitespace
|
||||||
|
|
||||||
// sscanf( PtLine, " %s %d %d %d %d %d", BufCar, &m_Size.x, &m_Size.y, &m_DeltaSize.x, &m_DeltaSize.y, &m_Orient );
|
// sscanf( PtLine, " %s %d %d %d %d %d", BufCar, &m_Size.x, &m_Size.y, &m_DeltaSize.x, &m_DeltaSize.y, &m_Orient );
|
||||||
|
|
||||||
|
@ -1066,6 +1064,26 @@ void KICAD_PLUGIN::loadPAD( MODULE* aModule )
|
||||||
THROW_IO_ERROR( m_error );
|
THROW_IO_ERROR( m_error );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// go through a wxString to establish a universal character set properly
|
||||||
|
wxString padname;
|
||||||
|
|
||||||
|
if( m_loading_format_version == 1 )
|
||||||
|
{
|
||||||
|
// add 8 bit bytes, file format 1 was KiCad font type byte,
|
||||||
|
// simply promote those 8 bit bytes up into UNICODE. (subset of LATIN1)
|
||||||
|
const unsigned char* cp = (unsigned char*) mypadname;
|
||||||
|
while( *cp )
|
||||||
|
{
|
||||||
|
padname += *cp++; // unsigned, ls 8 bits only
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// version 2, which is UTF8.
|
||||||
|
padname = FROM_UTF8( mypadname );
|
||||||
|
}
|
||||||
|
// chances are both were ASCII, but why take chances?
|
||||||
|
|
||||||
pad->SetPadName( padname );
|
pad->SetPadName( padname );
|
||||||
pad->SetShape( padshape );
|
pad->SetShape( padshape );
|
||||||
pad->SetSize( wxSize( size_x, size_y ) );
|
pad->SetSize( wxSize( size_x, size_y ) );
|
||||||
|
@ -3059,8 +3077,28 @@ void KICAD_PLUGIN::savePAD( const D_PAD* me ) const
|
||||||
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
|
THROW_IO_ERROR( wxString::Format( UNKNOWN_PAD_FORMAT, me->GetShape() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// universal character set padname
|
||||||
|
wxString padname = me->GetPadName();
|
||||||
|
|
||||||
|
#if BOARD_FORMAT_VERSION == 1
|
||||||
|
|
||||||
|
char mypadname[PADNAMEZ+1];
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for( i = 0; i<PADNAMEZ && padname[i]; ++i )
|
||||||
|
{
|
||||||
|
// truncate from universal character down to 8 bit foreign jibber jabber byte
|
||||||
|
mypadname[i] = (char) padname[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
mypadname[i] = 0;
|
||||||
|
|
||||||
|
fprintf( m_fp, "Sh \"%s\" %c %s %s %s\n",
|
||||||
|
mypadname, // probably ASCII, but possibly jibber jabber
|
||||||
|
#else
|
||||||
fprintf( m_fp, "Sh %s %c %s %s %s\n",
|
fprintf( m_fp, "Sh %s %c %s %s %s\n",
|
||||||
EscapedUTF8( me->GetPadName() ).c_str(),
|
EscapedUTF8( me->GetPadName() ).c_str(),
|
||||||
|
#endif
|
||||||
cshape,
|
cshape,
|
||||||
fmtBIUSize( me->GetSize() ).c_str(),
|
fmtBIUSize( me->GetSize() ).c_str(),
|
||||||
fmtBIUSize( me->GetDelta() ).c_str(),
|
fmtBIUSize( me->GetDelta() ).c_str(),
|
||||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
||||||
wxString m_filename; ///< for saves only, name is in m_reader for loads
|
wxString m_filename; ///< for saves only, name is in m_reader for loads
|
||||||
|
|
||||||
wxString m_field; ///< reused to stuff MODULE fields.
|
wxString m_field; ///< reused to stuff MODULE fields.
|
||||||
|
int m_loading_format_version; ///< which BOARD_FORMAT_VERSION am I Load()ing?
|
||||||
|
|
||||||
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
|
/// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed.
|
||||||
void init( PROPERTIES* aProperties );
|
void init( PROPERTIES* aProperties );
|
||||||
|
|
|
@ -97,7 +97,8 @@ public:
|
||||||
bool m_ChangeFootprints; // Set to true to change existing footprints to new ones
|
bool m_ChangeFootprints; // Set to true to change existing footprints to new ones
|
||||||
// when netlist gives a different footprint name
|
// when netlist gives a different footprint name
|
||||||
|
|
||||||
public: NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NULL )
|
public:
|
||||||
|
NETLIST_READER( PCB_EDIT_FRAME* aFrame, wxTextCtrl* aMessageWindow = NULL )
|
||||||
{
|
{
|
||||||
m_pcbframe = aFrame;
|
m_pcbframe = aFrame;
|
||||||
m_messageWindow = aMessageWindow;
|
m_messageWindow = aMessageWindow;
|
||||||
|
@ -199,7 +200,7 @@ private:
|
||||||
static FILE* OpenNetlistFile( const wxString& aFullFileName )
|
static FILE* OpenNetlistFile( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
if( aFullFileName.IsEmpty() )
|
if( aFullFileName.IsEmpty() )
|
||||||
return false; /* No filename: exit */
|
return false; // No filename: exit
|
||||||
|
|
||||||
FILE* file = wxFopen( aFullFileName, wxT( "rt" ) );
|
FILE* file = wxFopen( aFullFileName, wxT( "rt" ) );
|
||||||
|
|
||||||
|
@ -341,7 +342,7 @@ void NETLIST_READER::RemoveExtraFootprints( const wxString& aNetlistFileName )
|
||||||
for( ii = 0; ii < modulesCount; ii++ )
|
for( ii = 0; ii < modulesCount; ii++ )
|
||||||
{
|
{
|
||||||
if( module->m_Reference->m_Text.CmpNoCase( componentsInNetlist[ii] ) == 0 )
|
if( module->m_Reference->m_Text.CmpNoCase( componentsInNetlist[ii] ) == 0 )
|
||||||
break; /* Module is found in net list. */
|
break; // Module is found in net list.
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ii == modulesCount ) // Module not found in netlist.
|
if( ii == modulesCount ) // Module not found in netlist.
|
||||||
|
@ -404,7 +405,7 @@ bool NETLIST_READER::ReadNetList( FILE* aFile,
|
||||||
{
|
{
|
||||||
char* line = StrPurge( netlineReader.Line() );
|
char* line = StrPurge( netlineReader.Line() );
|
||||||
|
|
||||||
if( is_comment ) /* Comments in progress */
|
if( is_comment ) // Comments in progress
|
||||||
{
|
{
|
||||||
// Test for end of the current comment
|
// Test for end of the current comment
|
||||||
if( ( line = strchr( line, '}' ) ) == NULL )
|
if( ( line = strchr( line, '}' ) ) == NULL )
|
||||||
|
@ -412,7 +413,7 @@ bool NETLIST_READER::ReadNetList( FILE* aFile,
|
||||||
|
|
||||||
is_comment = false;
|
is_comment = false;
|
||||||
}
|
}
|
||||||
if( *line == '{' ) /* Start Comment */
|
if( *line == '{' ) // Start Comment
|
||||||
{
|
{
|
||||||
is_comment = true;
|
is_comment = true;
|
||||||
|
|
||||||
|
@ -438,7 +439,7 @@ bool NETLIST_READER::ReadNetList( FILE* aFile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load new footprints */
|
// Load new footprints
|
||||||
bool success = loadNewModules();
|
bool success = loadNewModules();
|
||||||
|
|
||||||
if( ! success )
|
if( ! success )
|
||||||
|
@ -487,11 +488,9 @@ bool NETLIST_READER::ReadNetList( FILE* aFile,
|
||||||
// footprint not found in library)
|
// footprint not found in library)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else /* clear pads netnames */
|
else // clear pads netnames
|
||||||
{
|
{
|
||||||
D_PAD* pad = m_currModule->m_Pads;
|
for( D_PAD* pad = m_currModule->m_Pads; pad; pad = pad->Next() )
|
||||||
|
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
|
||||||
{
|
{
|
||||||
pad->SetNetname( wxEmptyString );
|
pad->SetNetname( wxEmptyString );
|
||||||
}
|
}
|
||||||
|
@ -576,7 +575,7 @@ MODULE* NETLIST_READER::ReadNetlistModuleDescr( char* aText, bool aTstOnly )
|
||||||
if( error )
|
if( error )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Test if module is already loaded. */
|
// Test if module is already loaded.
|
||||||
wxString * identMod = &textCmpReference;
|
wxString * identMod = &textCmpReference;
|
||||||
|
|
||||||
if( m_UseTimeStamp )
|
if( m_UseTimeStamp )
|
||||||
|
@ -590,12 +589,12 @@ MODULE* NETLIST_READER::ReadNetlistModuleDescr( char* aText, bool aTstOnly )
|
||||||
{
|
{
|
||||||
nextModule = module->Next();
|
nextModule = module->Next();
|
||||||
|
|
||||||
if( m_UseTimeStamp ) /* identification by time stamp */
|
if( m_UseTimeStamp ) // identification by time stamp
|
||||||
{
|
{
|
||||||
if( timeStampPath.CmpNoCase( module->m_Path ) == 0 )
|
if( timeStampPath.CmpNoCase( module->m_Path ) == 0 )
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else /* identification by Reference */
|
else // identification by Reference
|
||||||
{
|
{
|
||||||
if( textCmpReference.CmpNoCase( module->m_Reference->m_Text ) == 0 )
|
if( textCmpReference.CmpNoCase( module->m_Reference->m_Text ) == 0 )
|
||||||
found = true;
|
found = true;
|
||||||
|
@ -696,36 +695,34 @@ MODULE* NETLIST_READER::ReadNetlistModuleDescr( char* aText, bool aTstOnly )
|
||||||
*/
|
*/
|
||||||
bool NETLIST_READER::SetPadNetName( char* aText )
|
bool NETLIST_READER::SetPadNetName( char* aText )
|
||||||
{
|
{
|
||||||
D_PAD* pad;
|
char* p;
|
||||||
char* TextPinName, * TextNetName;
|
char line[256];
|
||||||
bool found;
|
|
||||||
bool error = false;
|
|
||||||
char Line[256];
|
|
||||||
|
|
||||||
if( m_currModule == NULL )
|
if( m_currModule == NULL )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
strcpy( Line, aText );
|
strncpy( line, aText, sizeof(line) );
|
||||||
|
|
||||||
if( ( TextPinName = strtok( Line, " ()\t\n" ) ) == NULL )
|
if( ( p = strtok( line, " ()\t\n" ) ) == NULL )
|
||||||
error = true;
|
return false;
|
||||||
|
|
||||||
if( ( TextNetName = strtok( NULL, " ()\t\n" ) ) == NULL )
|
wxString pinName = FROM_UTF8( p );
|
||||||
error = true;
|
|
||||||
|
|
||||||
if( error )
|
if( ( p = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
pad = m_currModule->m_Pads;
|
wxString netName = FROM_UTF8( p );
|
||||||
found = false;
|
|
||||||
|
|
||||||
for( ; pad != NULL; pad = pad->Next() )
|
bool found = false;
|
||||||
|
for( D_PAD* pad = m_currModule->m_Pads; pad; pad = pad->Next() )
|
||||||
{
|
{
|
||||||
if( strnicmp( TextPinName, pad->m_Padname, 4 ) == 0 )
|
wxString padName = pad->GetPadName();
|
||||||
|
|
||||||
|
if( padName == pinName )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
if( *TextNetName != '?' )
|
if( (char) netName[0] != '?' )
|
||||||
pad->SetNetname( FROM_UTF8( TextNetName ) );
|
pad->SetNetname( netName );
|
||||||
else
|
else
|
||||||
pad->SetNetname( wxEmptyString );
|
pad->SetNetname( wxEmptyString );
|
||||||
}
|
}
|
||||||
|
@ -736,10 +733,9 @@ bool NETLIST_READER::SetPadNetName( char* aText )
|
||||||
if( m_messageWindow )
|
if( m_messageWindow )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString pin_name = FROM_UTF8( TextPinName );
|
|
||||||
msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
|
msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
|
||||||
GetChars( m_currModule->m_Reference->m_Text ),
|
GetChars( m_currModule->m_Reference->m_Text ),
|
||||||
GetChars( pin_name ) );
|
GetChars( pinName ) );
|
||||||
m_messageWindow->AppendText( msg + wxT( "\n" ) );
|
m_messageWindow->AppendText( msg + wxT( "\n" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -812,12 +808,12 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the list of references of the net list modules. */
|
// Build the list of references of the net list modules.
|
||||||
NETLIST_READER netList_Reader( this );
|
NETLIST_READER netList_Reader( this );
|
||||||
NbModulesNetListe = netList_Reader.BuildComponentsListFromNetlist( aNetlistFullFilename, tmp );
|
NbModulesNetListe = netList_Reader.BuildComponentsListFromNetlist( aNetlistFullFilename, tmp );
|
||||||
|
|
||||||
if( NbModulesNetListe < 0 )
|
if( NbModulesNetListe < 0 )
|
||||||
return; /* File not found */
|
return; // File not found
|
||||||
|
|
||||||
if( NbModulesNetListe == 0 )
|
if( NbModulesNetListe == 0 )
|
||||||
{
|
{
|
||||||
|
@ -825,7 +821,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for duplicate footprints. */
|
// Search for duplicate footprints.
|
||||||
list.Add( _( "Duplicates" ) );
|
list.Add( _( "Duplicates" ) );
|
||||||
|
|
||||||
MODULE* module = GetBoard()->m_Modules;
|
MODULE* module = GetBoard()->m_Modules;
|
||||||
|
@ -849,7 +845,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for the missing module by the net list. */
|
// Search for the missing module by the net list.
|
||||||
list.Add( _( "Missing:" ) );
|
list.Add( _( "Missing:" ) );
|
||||||
|
|
||||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||||
|
@ -871,7 +867,7 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search for modules not in net list. */
|
// Search for modules not in net list.
|
||||||
list.Add( _( "Not in Netlist:" ) );
|
list.Add( _( "Not in Netlist:" ) );
|
||||||
|
|
||||||
module = GetBoard()->m_Modules;
|
module = GetBoard()->m_Modules;
|
||||||
|
@ -881,11 +877,11 @@ void PCB_EDIT_FRAME::Test_Duplicate_Missing_And_Extra_Footprints(
|
||||||
{
|
{
|
||||||
if( module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
if( module->m_Reference->m_Text.CmpNoCase( tmp[ii] ) == 0 )
|
||||||
{
|
{
|
||||||
break; /* Module is in net list. */
|
break; // Module is in net list.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ii == NbModulesNetListe ) /* Module not found in netlist */
|
if( ii == NbModulesNetListe ) // Module not found in netlist
|
||||||
{
|
{
|
||||||
list.Add( module->m_Reference->m_Text );
|
list.Add( module->m_Reference->m_Text );
|
||||||
nberr++;
|
nberr++;
|
||||||
|
@ -938,7 +934,7 @@ int NETLIST_READER::BuildComponentsListFromNetlist( const wxString& aNetlistFile
|
||||||
is_comment = false;
|
is_comment = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( *text == '{' ) /* Comments. */
|
if( *text == '{' ) // Comments.
|
||||||
{
|
{
|
||||||
is_comment = true;
|
is_comment = true;
|
||||||
|
|
||||||
|
@ -1035,7 +1031,7 @@ bool NETLIST_READER::readModuleComponentLinkfile( const wxString* aCmpIdent,
|
||||||
if( ! buffer.StartsWith( wxT("BeginCmp") ) )
|
if( ! buffer.StartsWith( wxT("BeginCmp") ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Begin component description. */
|
// Begin component description.
|
||||||
refcurrcmp.Empty();
|
refcurrcmp.Empty();
|
||||||
idmod.Empty();
|
idmod.Empty();
|
||||||
timestamp.Empty();
|
timestamp.Empty();
|
||||||
|
@ -1130,7 +1126,7 @@ bool NETLIST_READER::loadNewModules()
|
||||||
|
|
||||||
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
|
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
|
||||||
{
|
{
|
||||||
/* New footprint : must be loaded from a library */
|
// New footprint : must be loaded from a library
|
||||||
Module = m_pcbframe->GetModuleLibrary( wxEmptyString, cmp->m_LibName, false );
|
Module = m_pcbframe->GetModuleLibrary( wxEmptyString, cmp->m_LibName, false );
|
||||||
ref = cmp;
|
ref = cmp;
|
||||||
|
|
||||||
|
@ -1167,7 +1163,7 @@ bool NETLIST_READER::loadNewModules()
|
||||||
{
|
{
|
||||||
// Footprint already loaded from a library, duplicate it (faster)
|
// Footprint already loaded from a library, duplicate it (faster)
|
||||||
if( Module == NULL )
|
if( Module == NULL )
|
||||||
continue; /* Module does not exist in library. */
|
continue; // Module does not exist in library.
|
||||||
|
|
||||||
MODULE* newmodule = new MODULE( pcb );
|
MODULE* newmodule = new MODULE( pcb );
|
||||||
newmodule->Copy( Module );
|
newmodule->Copy( Module );
|
||||||
|
|
|
@ -530,7 +530,7 @@ void PCB_EDIT_FRAME::Exchange_Module( MODULE* aOldModule,
|
||||||
|
|
||||||
for( ; old_pad != NULL; old_pad = old_pad->Next() )
|
for( ; old_pad != NULL; old_pad = old_pad->Next() )
|
||||||
{
|
{
|
||||||
if( strnicmp( pad->m_Padname, old_pad->m_Padname, sizeof(pad->m_Padname) ) == 0 )
|
if( pad->PadNameEqual( old_pad ) )
|
||||||
{
|
{
|
||||||
pad->SetNetname( old_pad->GetNetname() );
|
pad->SetNetname( old_pad->GetNetname() );
|
||||||
pad->SetNet( old_pad->GetNet() );
|
pad->SetNet( old_pad->GetNet() );
|
||||||
|
|
Loading…
Reference in New Issue