Commit 8df7407b authored by Dick Hollenbeck's avatar Dick Hollenbeck

FIX: regression loading of SMD pads within EAGLE_PLUGIN::FootprintLoad().

FIX: unique renaming of eagle footprints by substituting illegal : and / with URL encoding technique.
ADD: window resize border to DisplayError() windows.
parent 53f33d39
......@@ -73,10 +73,14 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
if( displaytime > 0 )
dialog = new wxMessageDialog( parent, text, _( "Warning" ),
wxOK | wxCENTRE | wxICON_INFORMATION );
wxOK | wxCENTRE | wxICON_INFORMATION
| wxRESIZE_BORDER
);
else
dialog = new wxMessageDialog( parent, text, _( "Error" ),
wxOK | wxCENTRE | wxICON_ERROR );
wxOK | wxCENTRE | wxICON_ERROR
| wxRESIZE_BORDER
);
dialog->ShowModal();
dialog->Destroy();
......
......@@ -40,7 +40,7 @@
#include <fp_lib_table_lexer.h>
#include <invoke_pcb_dialog.h>
#include <grid_tricks.h>
#include <confirm.h>
/// grid column order is established by this sequence
enum COL_ORDER
......@@ -244,7 +244,7 @@ protected:
}
catch( PARSE_ERROR& pe )
{
// @todo tell what line and offset
DisplayError( NULL, pe.errorText );
parsed = false;
}
......
......@@ -97,17 +97,28 @@ const wxChar* traceEaglePlugin = wxT( "KicadEaglePlugin" );
/// Test footprint name for kicad legality, fix if needed and return true if fixing was required.
static bool fix_eagle_package_name( string* aName )
{
string result;
bool changed = false;
for( string::iterator it = aName->begin(); it != aName->end(); ++it )
{
switch( *it ) // for mapping, I always prefer a tabular switch presentation:
switch( *it )
{
case ':': *it = '_'; changed = true; break;
case '/': *it = '-'; changed = true; break;
case ':':
case '/':
// replace *it with %xx, as in URL encoding
StrPrintf( &result, "%%%02x", *it );
changed = true;
break;
default:
result += *it;
}
}
if( changed )
*aName = result;
return changed;
}
......@@ -1292,9 +1303,6 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules )
void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
{
if( m_board == NULL )
return;
typedef std::vector<ELAYER> ELAYERS;
typedef ELAYERS::const_iterator EITER;
......@@ -1333,6 +1341,9 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
}
#endif
// Set the layer names and cu count iff we're loading a board.
if( m_board )
{
m_board->SetCopperLayerCount( cu.size() );
for( EITER it = cu.begin(); it != cu.end(); ++it )
......@@ -1345,6 +1356,7 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
// could map the colors here
}
}
}
......@@ -1625,13 +1637,15 @@ void EAGLE_PLUGIN::loadLibrary( CPTREE& aLib, const string* aLibName )
// add the templating MODULE to the MODULE template factory "m_templates"
std::pair<MODULE_ITER, bool> r = m_templates.insert( key, m );
if( !r.second )
if( !r.second
// && !( m_props && m_props->Value( "ignore_duplicates" ) )
)
{
wxString lib = aLibName ? FROM_UTF8( aLibName->c_str() ) : m_lib_path;
wxString pkg = FROM_UTF8( pack_name.c_str() );
wxString emsg = wxString::Format(
_( "<package> name:'%s' duplicated in eagle <library>:'%s'" ),
_( "<package> name: '%s' duplicated in eagle <library>: '%s'" ),
GetChars( pkg ),
GetChars( lib )
);
......@@ -2876,6 +2890,17 @@ MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxStrin
}
void EAGLE_PLUGIN::FootprintLibOptions( PROPERTIES* aListToAppendTo ) const
{
/*
(*aListToAppendTo)["ignore_duplicates"] = wxString( _(
"Ignore duplicately named footprints within the same Eagle library. "
"Only the first similarly named footprint will be loaded."
)).utf8_str();
*/
}
/*
void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties )
{
......
......@@ -95,6 +95,8 @@ public:
return false; // until someone writes others like FootprintSave(), etc.
}
void FootprintLibOptions( PROPERTIES* aProperties ) const;
/*
void Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties = NULL );
......
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