From 0027bb14c5213abfea68c6a4f75f66fdf0479f54 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 12 Jun 2015 14:46:41 +0200 Subject: [PATCH] Pcbnew: read netlist dialog: remove the .cmp file option. Use only the netlist to know the footprint associated to a component. --- include/wxPcbStruct.h | 22 ------- pcbnew/dialogs/dialog_netlist.cpp | 46 +++----------- pcbnew/dialogs/dialog_netlist.h | 10 +-- pcbnew/dialogs/dialog_netlist_fbp.cpp | 10 +-- pcbnew/dialogs/dialog_netlist_fbp.fbp | 90 --------------------------- pcbnew/dialogs/dialog_netlist_fbp.h | 3 +- pcbnew/netlist.cpp | 2 +- pcbnew/pcbframe.cpp | 1 - pcbnew/pcbnew_config.cpp | 1 - 9 files changed, 12 insertions(+), 173 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index d32d13acf5..53689c40c1 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -109,8 +109,6 @@ protected: PARAM_CFG_ARRAY m_configSettings; ///< List of Pcbnew configuration settings. wxString m_lastNetListRead; ///< Last net list read with relative path. - bool m_useCmpFileForFpNames; ///< is true, use the .cmp file from CvPcb, else use the netlist - // to know the footprint name of components. // The Tool Framework initalization void setupTools(); @@ -417,26 +415,6 @@ public: */ void SetLastNetListRead( const wxString& aNetListFile ); - /** - * @return true if the .cmp file created by CvPcb should be used to know the - * footprint associated to components, false to use the netlist file only - */ - bool GetUseCmpFileForFpNames() { return m_useCmpFileForFpNames; } - - /** - * Set the default option to use or not the .cmp file craeted by CvPcb - * should be used to know the footprints associated to components when - * reading a netlist - * When the .cmp netlist is not used, footprint names are read from the netlist. - * This imply the user has filled the footprint fields in schematic - * @param aUseCmpfile = true to use the .cmp file, - * false to use the netlist file only - */ - void SetUseCmpFileForFpNames( bool aUseCmpfile) - { - m_useCmpFileForFpNames = aUseCmpfile; - } - ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const; diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 7a85aef537..92803a5279 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -75,14 +75,7 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) // Project settings are saved in the corresponding .pro file bool configChanged = lastNetlistName != GetLastNetListRead(); - if( dlg.UseCmpFileForFpNames() != GetUseCmpFileForFpNames() ) - { - SetUseCmpFileForFpNames( dlg.UseCmpFileForFpNames() ); - configChanged = true; - } - - if( configChanged - && !GetBoard()->GetFileName().IsEmpty() + if( configChanged && !GetBoard()->GetFileName().IsEmpty() && IsOK( NULL, _( "The project configuration has changed. Do you want to save it?" ) ) ) { wxFileName fn = Prj().AbsolutePath( GetBoard()->GetFileName() ); @@ -108,7 +101,6 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, bool tmp = m_config->Read( NETLIST_DELETESINGLEPADNETS_KEY, 0l ); m_rbSingleNets->SetSelection( tmp == 0 ? 0 : 1); m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename ); - m_cmpNameSourceOpt->SetSelection( m_parent->GetUseCmpFileForFpNames() ? 1 : 0 ); m_checkBoxSilentMode->SetValue( m_silentMode ); m_checkBoxFullMessages->SetValue( m_reportAll ); @@ -158,14 +150,6 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) { wxString msg; wxString netlistFileName = m_NetlistFilenameCtrl->GetValue(); - wxString cmpFileName; - - if( UseCmpFileForFpNames() ) - { - wxFileName fn = m_NetlistFilenameCtrl->GetValue(); - fn.SetExt( ComponentFileExtension ); - cmpFileName = fn.GetFullPath(); - } // Give the user a chance to bail out when making changes from a netlist. if( !m_checkDryRun->GetValue() && !m_silentMode @@ -180,23 +164,17 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) msg.Printf( _( "Reading netlist file \"%s\".\n" ), GetChars( netlistFileName ) ); m_MessageWindow->AppendText( msg ); - if( !cmpFileName.IsEmpty() ) - { - msg.Printf( _( "Using component footprint link file \"%s\".\n" ), GetChars( cmpFileName ) ); - m_MessageWindow->AppendText( msg ); - } - if( m_Select_By_Timestamp->GetSelection() == 1 ) - { - msg.Printf( _( "Using time stamps to select footprints in file \"%s\".\n" ), - GetChars( cmpFileName ) ); - m_MessageWindow->AppendText( msg ); - } + msg = _( "Using time stamps to match components and footprints.\n" ); + else + msg = _( "Using references to match components and footprints.\n" ); + + m_MessageWindow->AppendText( msg ); WX_TEXT_CTRL_REPORTER reporter( m_MessageWindow ); reporter.SetReportAll( m_reportAll ); - m_parent->ReadPcbNetlist( netlistFileName, cmpFileName, &reporter, + m_parent->ReadPcbNetlist( netlistFileName, wxEmptyString, &reporter, m_ChangeExistingFootprintCtrl->GetSelection() == 1, m_DeleteBadTracks->GetSelection() == 1, m_RemoveExtraFootprintsCtrl->GetSelection() == 1, @@ -219,16 +197,8 @@ void DIALOG_NETLIST::OnTestFootprintsClick( wxCommandEvent& event ) wxArrayString missing; std::vector notInNetlist; wxString netlistFilename = m_NetlistFilenameCtrl->GetValue(); - wxString cmpFilename; - if( UseCmpFileForFpNames() ) - { - wxFileName fn = m_NetlistFilenameCtrl->GetValue(); - fn.SetExt( ComponentFileExtension ); - cmpFilename = fn.GetFullPath(); - } - - if( !verifyFootprints( netlistFilename, cmpFilename, duplicate, missing, notInNetlist ) ) + if( !verifyFootprints( netlistFilename, wxEmptyString, duplicate, missing, notInNetlist ) ) return; #define ERR_CNT_MAX 100 // Max number of errors to output in dialog diff --git a/pcbnew/dialogs/dialog_netlist.h b/pcbnew/dialogs/dialog_netlist.h index 33910fbbe5..b2050e9441 100644 --- a/pcbnew/dialogs/dialog_netlist.h +++ b/pcbnew/dialogs/dialog_netlist.h @@ -5,7 +5,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -49,14 +49,6 @@ public: DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC* aDC, const wxString & aNetlistFullFilename ); ~DIALOG_NETLIST(); - // return true if the user choice is to use the .cmp file - // created by CvPcb to know footprint names associated to components - // and false to use the netlist only - bool UseCmpFileForFpNames() - { - return m_cmpNameSourceOpt->GetSelection() == 1; - } - private: /** * Function verifyFootprints diff --git a/pcbnew/dialogs/dialog_netlist_fbp.cpp b/pcbnew/dialogs/dialog_netlist_fbp.cpp index 22b72881ba..c4280f1280 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.cpp +++ b/pcbnew/dialogs/dialog_netlist_fbp.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -36,14 +36,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w bmodulesOptSizer->Add( m_Select_By_Timestamp, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_cmpNameSourceOptChoices[] = { _("From netlist"), _("From separate .cmp file") }; - int m_cmpNameSourceOptNChoices = sizeof( m_cmpNameSourceOptChoices ) / sizeof( wxString ); - m_cmpNameSourceOpt = new wxRadioBox( this, wxID_ANY, _("Footprint Name Source"), wxDefaultPosition, wxDefaultSize, m_cmpNameSourceOptNChoices, m_cmpNameSourceOptChoices, 1, wxRA_SPECIFY_COLS ); - m_cmpNameSourceOpt->SetSelection( 0 ); - m_cmpNameSourceOpt->SetToolTip( _("Source of footprints names for component:\n- the netlist (if you have filled the footprint field of each component in schematic)\n- the .cmp file created by CvPcb") ); - - bmodulesOptSizer->Add( m_cmpNameSourceOpt, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - wxString m_ChangeExistingFootprintCtrlChoices[] = { _("Keep"), _("Change") }; int m_ChangeExistingFootprintCtrlNChoices = sizeof( m_ChangeExistingFootprintCtrlChoices ) / sizeof( wxString ); m_ChangeExistingFootprintCtrl = new wxRadioBox( this, wxID_ANY, _("Exchange Footprint"), wxDefaultPosition, wxDefaultSize, m_ChangeExistingFootprintCtrlNChoices, m_ChangeExistingFootprintCtrlChoices, 1, wxRA_SPECIFY_COLS ); diff --git a/pcbnew/dialogs/dialog_netlist_fbp.fbp b/pcbnew/dialogs/dialog_netlist_fbp.fbp index fe4568c299..046362c4e8 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.fbp +++ b/pcbnew/dialogs/dialog_netlist_fbp.fbp @@ -219,96 +219,6 @@ - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "From netlist" "From separate .cmp file" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Footprint Name Source - 1 - - 0 - - - 0 - - 1 - m_cmpNameSourceOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - Source of footprints names for component: - the netlist (if you have filled the footprint field of each component in schematic) - the .cmp file created by CvPcb - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 wxEXPAND|wxTOP|wxRIGHT|wxLEFT diff --git a/pcbnew/dialogs/dialog_netlist_fbp.h b/pcbnew/dialogs/dialog_netlist_fbp.h index dcd4d7be0d..c707516f67 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.h +++ b/pcbnew/dialogs/dialog_netlist_fbp.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 6 2014) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -47,7 +47,6 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM }; wxRadioBox* m_Select_By_Timestamp; - wxRadioBox* m_cmpNameSourceOpt; wxRadioBox* m_ChangeExistingFootprintCtrl; wxRadioBox* m_DeleteBadTracks; wxRadioBox* m_RemoveExtraFootprintsCtrl; diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index 3f309a0f73..a8d1bb21de 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -244,7 +244,7 @@ void PCB_EDIT_FRAME::loadFootprints( NETLIST& aNetlist, REPORTER* aReporter ) { if( aReporter ) { - msg.Printf( _( "* Warning: component '%s' has footprint '%s' and should be '%s'\n" ), + msg.Printf( _( "* Warning: component '%s': board footprint '%s', netlist footprint '%s'\n" ), GetChars( component->GetReference() ), GetChars( fpOnBoard->GetFPID().Format() ), GetChars( component->GetFPID().Format() ) ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 132a5c3479..fab3ed5308 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -320,7 +320,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_hasAutoSave = true; m_RecordingMacros = -1; m_microWaveToolBar = NULL; - m_useCmpFileForFpNames = true; m_rotationAngle = 900; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 6354c5318d..1419efdd9a 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -319,7 +319,6 @@ PARAM_CFG_ARRAY PCB_EDIT_FRAME::GetProjectFileParameters() pca.push_back( new PARAM_CFG_FILENAME( wxT( "LastNetListRead" ), &m_lastNetListRead ) ); - pca.push_back( new PARAM_CFG_BOOL( wxT( "UseCmpFile" ), &m_useCmpFileForFpNames, true ) ); GetBoard()->GetDesignSettings().AppendConfigs( &pca ); return pca;