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
...@@ -52,9 +52,9 @@ public: ...@@ -52,9 +52,9 @@ public:
}; };
private: private:
void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_YES ); } void OnSaveAndExit( wxCommandEvent& event ) { EndModal( wxID_YES ); }
void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); } void OnCancel( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); } void OnExitNoSave( wxCommandEvent& event ) { EndModal( wxID_NO ); }
}; };
...@@ -73,10 +73,14 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime ) ...@@ -73,10 +73,14 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
if( displaytime > 0 ) if( displaytime > 0 )
dialog = new wxMessageDialog( parent, text, _( "Warning" ), dialog = new wxMessageDialog( parent, text, _( "Warning" ),
wxOK | wxCENTRE | wxICON_INFORMATION ); wxOK | wxCENTRE | wxICON_INFORMATION
| wxRESIZE_BORDER
);
else else
dialog = new wxMessageDialog( parent, text, _( "Error" ), dialog = new wxMessageDialog( parent, text, _( "Error" ),
wxOK | wxCENTRE | wxICON_ERROR ); wxOK | wxCENTRE | wxICON_ERROR
| wxRESIZE_BORDER
);
dialog->ShowModal(); dialog->ShowModal();
dialog->Destroy(); dialog->Destroy();
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#include <fp_lib_table_lexer.h> #include <fp_lib_table_lexer.h>
#include <invoke_pcb_dialog.h> #include <invoke_pcb_dialog.h>
#include <grid_tricks.h> #include <grid_tricks.h>
#include <confirm.h>
/// grid column order is established by this sequence /// grid column order is established by this sequence
enum COL_ORDER enum COL_ORDER
...@@ -244,7 +244,7 @@ protected: ...@@ -244,7 +244,7 @@ protected:
} }
catch( PARSE_ERROR& pe ) catch( PARSE_ERROR& pe )
{ {
// @todo tell what line and offset DisplayError( NULL, pe.errorText );
parsed = false; parsed = false;
} }
......
...@@ -97,17 +97,28 @@ const wxChar* traceEaglePlugin = wxT( "KicadEaglePlugin" ); ...@@ -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. /// Test footprint name for kicad legality, fix if needed and return true if fixing was required.
static bool fix_eagle_package_name( string* aName ) static bool fix_eagle_package_name( string* aName )
{ {
string result;
bool changed = false; bool changed = false;
for( string::iterator it = aName->begin(); it != aName->end(); ++it ) 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 ':':
case '/': *it = '-'; changed = true; break; 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; return changed;
} }
...@@ -1292,9 +1303,6 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules ) ...@@ -1292,9 +1303,6 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules )
void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
{ {
if( m_board == NULL )
return;
typedef std::vector<ELAYER> ELAYERS; typedef std::vector<ELAYER> ELAYERS;
typedef ELAYERS::const_iterator EITER; typedef ELAYERS::const_iterator EITER;
...@@ -1333,17 +1341,21 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) ...@@ -1333,17 +1341,21 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
} }
#endif #endif
m_board->SetCopperLayerCount( cu.size() ); // Set the layer names and cu count iff we're loading a board.
if( m_board )
for( EITER it = cu.begin(); it != cu.end(); ++it )
{ {
LAYER_NUM layer = kicad_layer( it->number ); m_board->SetCopperLayerCount( cu.size() );
for( EITER it = cu.begin(); it != cu.end(); ++it )
{
LAYER_NUM layer = kicad_layer( it->number );
// these function provide their own protection against UNDEFINED_LAYER: // these function provide their own protection against UNDEFINED_LAYER:
m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) ); m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) );
m_board->SetLayerType( layer, LT_SIGNAL ); m_board->SetLayerType( layer, LT_SIGNAL );
// could map the colors here // could map the colors here
}
} }
} }
...@@ -1625,13 +1637,15 @@ void EAGLE_PLUGIN::loadLibrary( CPTREE& aLib, const string* aLibName ) ...@@ -1625,13 +1637,15 @@ void EAGLE_PLUGIN::loadLibrary( CPTREE& aLib, const string* aLibName )
// add the templating MODULE to the MODULE template factory "m_templates" // add the templating MODULE to the MODULE template factory "m_templates"
std::pair<MODULE_ITER, bool> r = m_templates.insert( key, m ); 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 lib = aLibName ? FROM_UTF8( aLibName->c_str() ) : m_lib_path;
wxString pkg = FROM_UTF8( pack_name.c_str() ); wxString pkg = FROM_UTF8( pack_name.c_str() );
wxString emsg = wxString::Format( wxString emsg = wxString::Format(
_( "<package> name:'%s' duplicated in eagle <library>:'%s'" ), _( "<package> name: '%s' duplicated in eagle <library>: '%s'" ),
GetChars( pkg ), GetChars( pkg ),
GetChars( lib ) GetChars( lib )
); );
...@@ -2876,6 +2890,17 @@ MODULE* EAGLE_PLUGIN::FootprintLoad( const wxString& aLibraryPath, const wxStrin ...@@ -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 ) void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, const PROPERTIES* aProperties )
{ {
......
...@@ -95,6 +95,8 @@ public: ...@@ -95,6 +95,8 @@ public:
return false; // until someone writes others like FootprintSave(), etc. 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 ); 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