Commit 8287775b authored by Dick Hollenbeck's avatar Dick Hollenbeck

EAGLE_PLUGIN cu layer map fix broke footprint library loading

parent 22c85e78
...@@ -1057,6 +1057,8 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() : ...@@ -1057,6 +1057,8 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() :
// m_mod_time( wxDateTime::Now() ) // m_mod_time( wxDateTime::Now() )
{ {
init( NULL ); init( NULL );
clear_cu_map();
} }
...@@ -1158,10 +1160,6 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) ...@@ -1158,10 +1160,6 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties )
{ {
m_hole_count = 0; m_hole_count = 0;
// all cu layers are invalid until we see one in the <layers> section while board loading.
for( unsigned i = 0; i < DIM(m_cu_map); ++i )
m_cu_map[i] = -1;
m_xpath->clear(); m_xpath->clear();
m_pads_to_nets.clear(); m_pads_to_nets.clear();
...@@ -1178,6 +1176,15 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) ...@@ -1178,6 +1176,15 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties )
} }
void EAGLE_PLUGIN::clear_cu_map()
{
// All cu layers are invalid until we see them in the <layers> section while
// loading either a board or library. See loadLayerDefs().
for( unsigned i = 0; i < DIM(m_cu_map); ++i )
m_cu_map[i] = -1;
}
void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc ) void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc )
{ {
CPTREE& drawing = aDoc.get_child( "eagle.drawing" ); CPTREE& drawing = aDoc.get_child( "eagle.drawing" );
...@@ -1195,8 +1202,12 @@ void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc ) ...@@ -1195,8 +1202,12 @@ void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc )
} }
{ {
m_xpath->push( "layers" );
CPTREE& layers = drawing.get_child( "layers" ); CPTREE& layers = drawing.get_child( "layers" );
loadLayerDefs( layers ); loadLayerDefs( layers );
m_xpath->pop();
} }
{ {
...@@ -1231,8 +1242,6 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules ) ...@@ -1231,8 +1242,6 @@ void EAGLE_PLUGIN::loadDesignRules( CPTREE& aDesignRules )
void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
{ {
m_xpath->push( "layers.layer" );
typedef std::vector<ELAYER> ELAYERS; typedef std::vector<ELAYER> ELAYERS;
typedef ELAYERS::const_iterator EITER; typedef ELAYERS::const_iterator EITER;
...@@ -1281,8 +1290,6 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) ...@@ -1281,8 +1290,6 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers )
// could map the colors here // could map the colors here
} }
m_xpath->pop();
} }
...@@ -2664,12 +2671,17 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath ) ...@@ -2664,12 +2671,17 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath )
read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments );
CPTREE& library = doc.get_child( "eagle.drawing.library" ); // clear the cu map and then rebuild it.
clear_cu_map();
m_xpath->push( "eagle.drawing.library" ); m_xpath->push( "eagle.drawing.layers" );
CPTREE& layers = doc.get_child( "eagle.drawing.layers" );
loadLayerDefs( layers );
m_xpath->pop();
m_xpath->push( "eagle.drawing.library" );
CPTREE& library = doc.get_child( "eagle.drawing.library" );
loadLibrary( library, NULL ); loadLibrary( library, NULL );
m_xpath->pop(); m_xpath->pop();
m_mod_time = modtime; m_mod_time = modtime;
......
...@@ -142,6 +142,8 @@ private: ...@@ -142,6 +142,8 @@ private:
/// 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 );
void clear_cu_map();
/// Convert an Eagle distance to a KiCad distance. /// Convert an Eagle distance to a KiCad distance.
int kicad( double d ) const; int kicad( double d ) const;
int kicad_y( double y ) const { return -kicad( y ); } int kicad_y( double y ) const { return -kicad( y ); }
......
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