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

EAGLE_PLUGIN cu layer map fix broke footprint library loading

parent 22c85e78
Loading
Loading
Loading
Loading
+23 −11
Original line number Original line Diff line number Diff line
@@ -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 )
{
{
    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 )
}
}




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 )
    }
    }


    {
    {
        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 )


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 )


        // could map the colors here
        // could map the colors here
    }
    }

    m_xpath->pop();
}
}




@@ -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;
+2 −0
Original line number Original line Diff line number Diff line
@@ -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 ); }