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

CvPcb: serious code cleaning. More comments. Remove useless files and some...

CvPcb: serious code cleaning. More comments. Remove useless files and some files renamed with a better name.
parent 2082fbba
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -36,13 +36,12 @@ set(CVPCB_SRCS
    class_footprints_listbox.cpp
    cvframe.cpp
    cvpcb.cpp
    genequiv.cpp
    init.cpp
    listboxes.cpp
    loadcmp.cpp
    menubar.cpp
    readschematicnetlist.cpp
    savecmp.cpp
    read_write_cmpfile.cpp
    readwrite_dlgs.cpp
    setvisu.cpp
    tool_cvpcb.cpp
    )
+6 −6
Original line number Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 *
@@ -242,7 +242,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
    {
        unsigned        ii;
        wxMessageDialog dialog( this,
                                _( "Net and component list modified.\nSave before exit ?" ),
                                _( "Component to Footprint links modified.\nSave before exit ?" ),
                                _( "Confirmation" ),
                                wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );

@@ -259,7 +259,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )

        case wxID_OK:
        case wxID_YES:
            diag = SaveNetList( m_NetlistFileName.GetFullPath() );
            diag = SaveCmpLinkFile( m_NetlistFileName.GetFullPath() );

            if( diag > 0 )
            {
@@ -267,7 +267,7 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
            }
            else if( diag == 0 )
            {
                if( !IsOK( this, _( "Problem when saving files, exit anyway ?" ) ) )
                if( !IsOK( this, _( "Problem when saving file, exit anyway ?" ) ) )
                {
                    Event.Veto();
                    return;
@@ -385,7 +385,7 @@ void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
    if( aEvent.GetId() == wxID_SAVEAS )
        m_NetlistFileName.Clear();

    if( SaveNetList( m_NetlistFileName.GetFullPath() ) > 0 )
    if( SaveCmpLinkFile( m_NetlistFileName.GetFullPath() ) > 0 )
    {
        m_modified = false;

@@ -451,7 +451,7 @@ void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )

    wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
    m_NetlistFileName = newFileName;
    ReadNetList();
    ReadNetListAndLinkFiles();
}


+5 −2
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ const wxString FootprintAliasFileExtension( wxT( "equ" ) );
const wxString RetroFileWildcard( _( "KiCad retroannotation files (*.stf)|*.stf" ) );
const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) );

// Wildcard for cvpcb component to footprint link file ( normal output file )
const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)|*.cmp" ) );

const wxString titleLibLoadError( _( "Library Load Error" ) );


@@ -57,7 +60,7 @@ void EDA_APP::MacOpenFile(const wxString &fileName)
    wxGetApp().GetLibraryPathList().Insert( filename.GetPath(), 0 );

    frame->m_NetlistFileName = filename;
    frame->ReadNetList();
    frame->ReadNetListAndLinkFiles();
}

// Create a new application object
@@ -108,7 +111,7 @@ bool EDA_APP::OnInit()
    {
        frame->m_NetlistFileName = filename;

        if( frame->ReadNetList() )
        if( frame->ReadNetListAndLinkFiles() )
        {
            frame->m_NetlistFileExtension = filename.GetExt();
            return true;
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ extern const wxString ComponentFileExtension;

extern const wxString RetroFileWildcard;
extern const wxString FootprintAliasFileWildcard;
extern const wxString ComponentFileWildcard;

extern const wxString titleLibLoadError;

+49 −29
Original line number Diff line number Diff line
@@ -110,7 +110,15 @@ public:
     */
    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 );

    /**
@@ -123,37 +131,64 @@ public:

    /**
     * Function SetNewPkg
     * set the module to the selected component and selects the next component.
     * links the footprint to the current selected component
     * and selects the next component.
     * @param aFootprintName = the selected footprint
     */
    void             SetNewPkg( const wxString& package );
    void             SetNewPkg( const wxString& aFootprintName );
    void             BuildCmpListBox();
    void             BuildFOOTPRINTS_LISTBOX();
    void             CreateScreenCmp();

    /**
     * Function SaveNetList
     * backup and save netlist (.net) file to \a aFullFileName.
     * Function SaveCmpLinkFile
     * Saves the component - footprint link file (.cmp file) to \a aFullFileName.
     *
     * @param aFullFileName A reference wxString object containing the full
     *                      file name of the netlist or cmp file.
     * If aFullFileName is empty, a file name will be asked to the user
     * @return  0 if an error occurred saving the link file to \a aFullFileName.
     *          -1 if cancelled
     *          1 if OK
     */
    int              SaveCmpLinkFile( const wxString& aFullFileName );


    /**
     * Function LoadComponentFile
     * loads the .cmp link file \a aCmpFileName which stores
     * the component/footprint association.
     *
     * @param aFileName The full filename of .cmp file to load
     * If empty, a filename will be asked to the user
     */
    bool             LoadComponentLinkFile( const wxString& aFileName );

    /**
     * Function WriteComponentLinkFile
     * Writes the component footprint link file \a aFullFileName on disk.
     *
     * @param aFullFileName A reference wxString object containing the full path and
     *                      file name of the netlist to save.
     * @return 0 if an error occurred saving the netlist to \a aFullFileName.
     * @param aFullFileName full filename of .cmp file to write.
     * @return true if OK, false if error.
     */
    int              SaveNetList( const wxString& aFullFileName );
    bool              WriteComponentLinkFile( const wxString& aFullFileName );

    /**
     * Function SaveComponentList
     * backup modules to file \a aFullFileName.
     * Function ReadComponentLinkFile
     * Reads the component footprint link file \a aFullFileName.
     *
     * @param aFullFileName Name of net list file to save.
     * @returns 1 if OK, 0 if error.
     * @param aFile = the opened the opened file to read.
     *  ReadComponentLinkFile will close the file
     * @return true if OK, false if error.
     */
    int              SaveComponentList( const wxString& aFullFileName );
    bool              ReadComponentLinkFile( FILE * aFile );

    /**
     * Function ReadNetList
     * reads the netlist (.net) file defined by #m_NetlistFileName.
     * and the corresponding cmp to footprint (.cmp) link file
     */
    bool             ReadNetList();
    bool             ReadNetListAndLinkFiles();

    int              ReadSchematicNetlist();

@@ -200,21 +235,6 @@ public:
     */
    bool             LoadFootprintFiles();

    /**
     * function GenNetlistPcbnew
     * writes the output netlist file
     *
     */
    int              GenNetlistPcbnew( FILE* f, bool isEESchemaNetlist = true );

    /**
     * Function LoadComponentFile
     * loads the .cmp file \a aCmpFileName that stores the component/footprint association.
     *
     * @param aFileName The full filename of .cmp file to load
     */
    bool             LoadComponentFile( const wxString& aFileName );

    /**
     * Function GetProjectFileParameters
     * return project file parameter list for CvPcb.
Loading