Commit 619125f9 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Changes for CvPcb to eeschema stuff file: the stuff file generation from CvPcb...

Changes for CvPcb to eeschema stuff file: the stuff file generation from CvPcb is removed. Eeschema now imports footprints names from the .cmp usual file created by CvPcb or by Pcbnew (Why to use 2 file formats for the same thing?) .
Pcbnew: in netlist dialog: The user now can choose between the netlist and the .cmp file to import footprints names.
Therfore no need to delete the .cmp file when exists to use only the netlist.
This is useful for users who use CvPcb only once to fill footprints fields in schematic, and after edit/modify the footprints fields in schematic outside CvPcb.
parent 638decaf
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,7 @@ const wxString LegacyFootprintLibPathWildcard( _( "Legacy footprint library file
const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) );
const wxString EagleFootprintLibPathWildcard( _( "Eagle ver. 6.x XML library files (*.lbr)|*.lbr" ) );
const wxString GedaPcbFootprintLibFileWildcard( _( "Geda PCB footprint library file (*.fp)|*.fp" ) );
const wxString GedaPcbFootprintLibFileWildcard( _( "Geda PCB footprint library file (*.fp)|*.fp" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
const wxString ComponentFileExtensionWildcard( _( "Component-footprint link file (*.cmp)|*cmp" ) );


// generic:
// generic:
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
+0 −1
Original line number Original line Diff line number Diff line
@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
    EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
    EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
    EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
    EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
    EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule )
    EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule )
    EVT_TOOL( ID_CVPCB_CREATE_STUFF_FILE, CVPCB_MAINFRAME::WriteStuffList )
    EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
    EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
    EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
    EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
              CVPCB_MAINFRAME::OnSelectFilteringFootprint )
              CVPCB_MAINFRAME::OnSelectFilteringFootprint )
+0 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,6 @@ enum id_cvpcb_frm
    ID_CVPCB_AUTO_ASSOCIE,
    ID_CVPCB_AUTO_ASSOCIE,
    ID_CVPCB_COMPONENT_LIST,
    ID_CVPCB_COMPONENT_LIST,
    ID_CVPCB_FOOTPRINT_LIST,
    ID_CVPCB_FOOTPRINT_LIST,
    ID_CVPCB_CREATE_STUFF_FILE,
    ID_CVPCB_SHOW3D_FRAME,
    ID_CVPCB_SHOW3D_FRAME,
    ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
    ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
    ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
    ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
+0 −9
Original line number Original line Diff line number Diff line
@@ -112,15 +112,6 @@ public:
     */
     */
    void             AssocieModule( wxCommandEvent& event );
    void             AssocieModule( wxCommandEvent& event );


    /**
     * Function WriteStuffList
     * Creates a file for Eeschema, import footprint selections
     * in schematic
     * the file format is
     * comp = "<reference>" module = "<footprint name">
     */
    void             WriteStuffList( wxCommandEvent& event );

    void             DisplayDocFile( wxCommandEvent& event );
    void             DisplayDocFile( wxCommandEvent& event );


    /**
    /**
+2 −47
Original line number Original line Diff line number Diff line
@@ -233,48 +233,3 @@ int CVPCB_MAINFRAME::SaveCmpLinkFile( const wxString& aFullFileName )
    SetStatusText( msg );
    SetStatusText( msg );
    return 1;
    return 1;
}
}

/* Creates a file for Eeschema, import footprint selections in schematic
 * the file format is
 * comp = "<reference>" module = "<footprint name">
 */

void CVPCB_MAINFRAME::WriteStuffList( wxCommandEvent& event )
{
    FILE*      FileEquiv;
    wxString   Line;
    wxFileName fn = m_NetlistFileName;

    if( m_components.empty() )
        return;

    fn.SetExt( RetroFileExtension );

    wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
                      fn.GetFullName(), RetroFileWildcard,
                      wxFD_SAVE | wxFD_OVERWRITE_PROMPT );

    if( dlg.ShowModal() == wxID_CANCEL )
        return;

    FileEquiv = wxFopen( dlg.GetPath(), wxT( "wt" ) );

    if( FileEquiv == 0 )
    {
        Line = _( "Unable to create " ) + dlg.GetPath();
        DisplayError( this, Line, 30 );
        return;
    }

    BOOST_FOREACH( COMPONENT_INFO& component, m_components )
    {
        if( component.m_Footprint.empty() )
            continue;

        fprintf( FileEquiv, "comp = %s module = %s\n",
                 EscapedUTF8( component.m_Reference ).c_str(),
                 EscapedUTF8( component.m_Footprint ).c_str() );
    }

    fclose( FileEquiv );
}
Loading